springboot启动报错:Consider defining a bean of type 'com.xx.xx.TokenService' in your configuration.
原因:找不到请求的bean类型
1. 方法一:添加config注入bean
/**/ @Configuration public class TokenConfig { /** * */ @Bean public TokenService tokenService() { return new TokenService(); } }
2. 方法二:在启动类DemoApplication上添加包所在位置注解
@ComponentScan(value = {"com.bat.demo","com.bat.token.common"})

浙公网安备 33010602011771号