新建微服务,启动时报错'TokenStore' that could not be found.

提问 2 1631
austin.li
austin.li 2023-01-28
版本:renren-cloud 开发环境:
ResourceServerConfig和 ModuleConfigImpl已配置,代码如下: ResourceServerConfig: @Configuration @AllArgsConstructor @EnableResourceServer @EnableGlobalMethodSecurity(prePostEnabled = true) public class ResourceServerConfig extends ResourceServerConfigurerAdapter { private TokenStore tokenStore; @Override public void configure(ResourceServerSecurityConfigurer resources) { resources.tokenStore(tokenStore); //token不存在或错误时,异常处理 resources.authenticationEntryPoint(new SecurityAuthenticationEntryPoint()); } @Override public void configure(HttpSecurity http) throws Exception { http .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers("/**").permitAll() .anyRequest().authenticated() ; } } ModuleConfigImpl: @Service public class ModuleConfigImpl implements ModuleConfig { @Override public String getName() { return "evaluation"; } } 报错信息: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2023-01-28 10:43:08.181 ERROR 19577 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Parameter 0 of constructor in com.ryxy.evaluation.config.ResourceServerConfig required a bean of type 'org.springframework.security.oauth2.provider.token.TokenStore' that could not be found. Action: Consider defining a bean of type 'org.springframework.security.oauth2.provider.token.TokenStore' in your configuration.
回帖
  • austin.li
    austin.li (楼主)
    2023-01-28
    靠,config的包名必须是io.renren
    0
  • lidy
    2023-01-30
    应该能改啊
    0
本帖已结贴