使用Spring cloud security Oauth2进行接口鉴权,资源服务器使用的堆内存会持续增长,直到设置的-Xmx值,如果使用security.ignored忽略该接口鉴权,就没有这种情况,请问这种情况要怎样解决呀?
接口鉴权的情况下:
接口取消鉴权的情况下:
资源服务器配置如下:
@Configuration
@EnableResourceServer
public class ResourceConfiguration extends ResourceServerConfigurerAdapter {
private static final String DEMO_RESOURCE_ID = "*";
@Autowired
private RedisConnectionFactory connectionFactory;
@Bean
public RedisTokenStore tokenStore() {
return new RedisTokenStore(connectionFactory);
}
@Override
public void configure(ResourceServerSecurityConfigurer resources) {
resources.resourceId(DEMO_RESOURCE_ID).stateless(true);
}
@Override
public void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
// Since we want the protected resources to be accessible in the UI as well we need
// session creation to be allowed (it's disabled by default in 2.0.6)
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
.and()
.authorizeRequests()//请求授权
.anyRequest().authenticated();//所有的url通过认证后才可以访问
}
}