admin管理员组文章数量:1794759
关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案
Description: Field helloService in com.example.demo.service.TestController required a bean of type 'com.example.service.HelloService' that could not be found. Action: Consider defining a bean of type 'com.example.service.HelloService' in your configuration.
这个问题就是@springbootApplication无法生效的问题。因为根据英文的提示是在配置中找不到一个指定自动注入类型的bean,经过多方排查得出结论: Mapper包是没有被扫描到的,那么我们需要在启动类上面加上注解@MapperScan,这个注解是在org…下面,不是在tk…下面。引入org…包下面的@MapperScan,需要添加依赖:
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.0.1</version> </dependency>本文标签: 解决方案definingbeanspringboot
版权声明:本文标题:关于spring boot自动注入出现Consider defining a bean of type &#039;xxx&#039; in your configuration问题解决方案 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686550030a80754.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论