错误信息 Description: Field areaService in com.imooc.demo.web.AreaController required a bean of type 'com.imooc.demo.service.AreaService' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.ann
Spring 自 2.0 版本开始,陆续引入了一些注解用于简化 Spring 的开发.@Repository注解便属于最先引入的一批,它用于将数据访问层 (DAO 层 ) 的类标识为 Spring Bean.具体只需将该注解标注在 DAO类上即可.同时,为了让 Spring 能够扫描类路径中的类并识别出 @Repository 注解,需要在 XML 配置文件中启用Bean 的自动扫描功能,这可以通过<context:component-scan/>实现; Spring 2.5 在 @Repos
报错:Consider defining a bean of type 'xxxxxxxxxxxxx' in your configuration 1. 你应该在 ApplyApplication 启动类里,扫描你的 Service包,多包扫描方法如下 @SpringBootApplication(scanBasePackages = {"xx.xxx.apply.controller", "xx.xxx.apply.service.*", "xx.xxx