Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name
目前有发现的两种情况
第一种:是在继承jpa的时候检查实体类@id和@Entity引进的包是否是
import javax.persistence.Id
imprt javax.persistence.Entity;
import javax.persistence.Table;
第一次引进很容易引错包下面是错误的包
org.springframework.data.annotation.Id;
要不然你就得去找找你的dao与service的注解是不是漏掉了
第二种:情况属于比较少见的
无法注入Dao中的Bean!
SpringBoot项目的Bean装配默认规则是根据Application类所在的包位置从上往下扫描! “Application类”是指SpringBoot项目入口类。这个类的位置很关键:
如果Application类所在的包为:com.ssm.springboot
,则只会扫描com.ssm.springboot
包及其所有子包,如果service或dao所在包不在com.ssm.springboot
及其子包下,则不会被扫描!
这种情况也会导致注入不进去的错误
解决办法
将SpringbootApplication放在要扫描包包中
一定不要如下图另起一个包要不然
@ComponentScan他也救不了你
最简单的你是这样了
放置于自动扫描包的同一包名下
Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name的更多相关文章
- ssh整合报错严重: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx'
错误描述:eclipse整合ssh的时候 报不能创建名字为xxx的对象 信息: Destroying singletons in org.springframework.beans.factory.s ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
七月 05, 2018 10:26:54 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin警告: [SetPropertiesRul ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource
二月 20, 2017 3:09:47 下午 org.apache.catalina.startup.SetAllPropertiesRule begin警告: [SetAllPropertiesRu ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'catchFromPBomService': Cannot create inner bean '(inner bean)#302efb82' of type [com.thinkgem.jeesite.modules.fd
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'catchFromPBo ...
- mvn ssm 异常 org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'multipartResolver'
解决方案: 添加 commons-fileupload-1.2.jar <!-- https://mvnrepository.com/artifact/commons-fileupload/co ...
- Dubbo管理平台搭建(duboo-admin-2.5.4)遇到的问题:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uriBrokerService': Cannot create inner bean '(inner bean)' of type
1.将dubbo的war包方式tomcat的webapps文件夹下,启动tomcat报错 错误信息如下: ERROR context.ContextLoader - Context initializ ...
- 【解决方案】 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userHandler': Injection of resource dependencies failed;
一个错误会浪费好多青春绳命 鉴于此,为了不让大家也走弯路,分享解决方案. [错误代码提示] StandardWrapper.Throwableorg.springframework.beans.fac ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is
在复制xml文件进行修改的时候,我经常将不小心对原文件进行修改,而导致创建bean出错.报错如下所示: Exception sending context initialized event to l ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined ...
随机推荐
- H3C FTP主动数据传输方式
- linux 在 open 时复制设备
管理存取控制的另一个技术是创建设备的不同的私有拷贝, 根据打开它的进程. 明显地, 这只当设备没有绑定到一个硬件实体时有可能; scull 是一个这样的"软件"设备 的例子. /d ...
- Python7_内置函数总结
Python Built-In 函数: str(obj) :输入(对象),返回一个对象的string格式: isinstance(object,classinfo):判断一个对象是否是一个已知的类型, ...
- vue新增属性响应式更新的问题
根据官方文档定义: 如果在实例创建之后添加新的属性到实例上,它不会触发视图更新. 受现代 JavaScript 的限制 (以及废弃 Object.observe),Vue 不能检测到对象属性的添加或删 ...
- #mysql查询特定数据库中的所有表名
#mysql查询特定数据库中的所有表名select table_namefrom information_schema.tableswhere table_schema='smbms' and tab ...
- mysql中information_schema.columns字段说明
1. 获取所有列信息(COLUMNS) SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='数据库名'; COLUMNS表 ...
- eclipse中如何配置jdk
1.在eclipse的上方打开Windows这个选项,选择Preferences==>Java==>Installed JREs 2.然后选择Add==>Standard VM==& ...
- javaweb项目添加log4j日志
谈到我们在Java程序中经常用的日志,Log4j应该是耳熟能详了.这里先提下slf4j,英文全名是Simple Logging Facade for Java,直面意思是:Java的简单日志门面.sl ...
- ApacheHudi常见问题汇总
欢迎关注公众号:ApacheHudi 1. ApacheHudi对个人和组织何时有用 如果你希望将数据快速提取到HDFS或云存储中,Hudi可以提供帮助.另外,如果你的ETL /hive/spark作 ...
- Django 多表、跨表、聚合、分组查询
前期准备: 创建表 class Book(models.Model): title = models.CharField(max_length=32) price = models.DecimalFi ...