IntelliJ IDEA 2017版 spring-boot 报错Consider defining a bean of type 'xxx' in your configuration问题解决方案
问题分析:
通过问题的英文可知,这个错误是service的bean注入失败,那么为什么会产生这个问题呢?
主要是框架的Application产生的,所以我们建立项目的时候,要保证项目中的类跟Application启动服务器类在一个目录层级,如图:

观察目录名称就可以得到,com.spring.boot.jap.perform,这个根目录,其他的子目录都要以它开头,这样就不会出现这个错误了.
解决方案二:
在Application中加入注解来识别bean注入,注解用@ComponentScan后面加括号()使用属性basePackages,它后面接的是一个数组,可以接多个包的地址.

IntelliJ IDEA 2017版 spring-boot 报错Consider defining a bean of type 'xxx' in your configuration问题解决方案的更多相关文章
- 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案
搭建完spring boot的demo后自然要实现自动注入来体现spring ioc的便利了,但是我在实施过程中出现了这么一个问题,见下面,这里找到解决办法记录下来,供遇到同样的问题的同僚参考 Des ...
- spring boot注入error,Consider defining a bean of type 'xxx' in your configuration问题解决方案
经常出现这问题一定是非spring生态圈的@标签 没被spring引入,如mybatis等 因为在默认情况下只能扫描与控制器在同一个包下以及其子包下的@Component注解,以及能将指定注解的类自动 ...
- springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.
一.前言: 使用springboot自动注入的方式搭建好了工程,结果启动的时候报错了!!!,错误如下图: Description: Field userEntityMapper in com.xxx. ...
- Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path resource
spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误: Error starting ApplicationContext. To display th ...
- Spring mvc 报错:No qualifying bean of type [java.lang.String] found for dependency:
具体错误: No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean w ...
- springboot 启动报错Consider defining a bean of type 'com.example.springbootdruid.mapper.UserMapper' in your configurati
一.问题 springboot项目启动时报错: Field userMapper in com.example.springbootdruid.service.impl.UserServiceImpl ...
- Spring Boot报错 MultipartException The temporary upload...
Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...
- Spring Boot 报错记录
Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = Dat ...
- SpringBoot- springboot集成Redis出现报错:No qualifying bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory'
Springboot将accessToke写入Redisk 缓存,springboot集成Redis出现报错 No qualifying bean of type 'org.springframewo ...
随机推荐
- Jsonlib 属性过滤器
/** * @title JSON转换属性过滤器 * @description 用于JSON lib的JSON转换 * @author maohuidong * @date 2017-04-06 */ ...
- java.util包简介
java.util包含集合框架.遗留的 collection 类.事件模型.日期和时间设施.国际化和各种实用工具类(字符串标记生成器.随机数生成器和位数组.日期Date类.堆栈Stack类.向量Vec ...
- Buffer I/O error on device sr0
Buffer I/O error on device sr0, logical block 0 I check today some old CDs, some of them were from ’ ...
- tflearn 实现DNN 全连接
https://github.com/tflearn/tflearn/blob/master/examples/others/recommender_wide_and_deep.py import n ...
- 在hadoop运行tensor flow
http://www.infoq.com/cn/articles/deeplearning-tensorflow-casestudy http://www.tuicool.com/articles/a ...
- 两个onCreate方法?你真的了解onCreate()么?
Activity的onCreate方法一直是我们编写一个activity最先重载的方法.细心的小伙伴在编写代码的时候回看到这样一幕: 咦,这里怎么会有两个onCreate提供给我们重载?选择困难症患者 ...
- 网站连接数据库连接不上原因是ip地址与端口号格式不对
192.168.1.1:8080这样连接一直出错, 后来改为192.168.1.1,8080就可以了 原因是格式不对,把冒号给为逗号就可以了
- java.lang.Error: Unresolved compilation problem: 解决方案
严重: Allocate exception for servlet WX_Interfacejava.lang.Error: Unresolved compilation problem: The ...
- ubuntu连有线网 无法连接外网
问题:连上网线后,有ip,但是无法访问外网. 我的解决方案是: .通过命令行ifconfig命令查看以太网(即网线插口)的名称,如下图,'enp3s0'是网线插口(Ethernet以太网): zhum ...
- OpenCV(图像处理)—访问像素的三种方法
方法一:用指针访问像素 #include <opencv2/opencv.hpp> #include <opencv2/core/core.hpp> #include < ...