这段代码可以优化(this code below can be optimise)
lingpeiyong opened this issue · 1 comments
lingpeiyong commented
代码位置(file location):/spring-security-oauth/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/request/DefaultOAuth2RequestFactory.java
- checkUserScopes 这个方法不需要clientDetails这个参数(the method of checkUserScopes is not need clientDetails parameter)
- extractScopes 这个方法里clientDetailsService.loadClientByClientId(clientId) 可以放在 if ((scopes == null || scopes.isEmpty())) 方法里,这样当判断为false时,可以减少一次数据库的查询操作。
clientDetailsService.loadClientByClientId(clientId) in the method of "extractScopes" can be write in the body of " if ((scopes == null || scopes.isEmpty())) " , that can reduce one database query operation
TDtianzhenjiu commented
wether loadClientByClientId is going to query database is determined by ur loadClientByClientId method implication.
you can cache Details