在配置类上添加 @ComponentScan 注解.该注解默认会扫描该类所在的包下所有的配置类,相当于xml的 <context:component-scan>. @ComponentScan注解默认就会装配标识了@Controller,@Service,@Repository,@Component注解的类到spring容器中. 新建三个类 @Controller public class OrderController { } @Service public class OrderServi
张艳涛写于2021-2-8日 构建后端项目的时候遇到一个问题,在zyt-auth项目的依赖定义了@Component类,这个类在项目启动的时候提示没有找到bean Field tokenService in com.zyt.zytauth.controller.TokenController required a bean of type 'com.zyt.common.security.service.TokenService' that could not be found. 问题是:依赖模