错误截图

后面发现原来和入口类代码有关。

//@SpringBootApplication(scanBasePackages = {"org.jzc.odata.cboard","org.jzc.odata.cboard.odataservice","com.sdl.odata.api.service","com.sdl.odata.api.service.ODataService"})
@EnableAutoConfiguration(exclude = {HibernateJpaAutoConfiguration.class
, DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class })
@Configuration
@Import({
ODataDataSourceConfiguration.class,
ODataServiceConfiguration.class
})
@ComponentScan
@RestController
@ComponentScan(basePackages = {"org.jzc.odata.cboard","org.jzc.odata.cboard.odataservice","com.sdl.odata.api.service","com.sdl.odata.api.service.ODataService"})
public class ServiceContainer {

其中

@EnableAutoConfiguration(exclude = {HibernateJpaAutoConfiguration.class
, DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class })

这段的解释如下,

参考

https://stackoverflow.com/questions/45350546/entitymanagerfactory-not-found-in-springboot

也就是说,不去掉@EnableAutoConfiguration 和里面exclude 包含对EntityManagerFactory 的注释的话,EntityManagerFactory是不会被实例化的,这样肯定就不能发现entityManagerFactory的Bean了。

那么解决方案就是把这段注释掉,重新编译打包

//@SpringBootApplication(scanBasePackages = {"org.jzc.odata.cboard","org.jzc.odata.cboard.odataservice","com.sdl.odata.api.service","com.sdl.odata.api.service.ODataService"})
//@EnableAutoConfiguration(exclude = {HibernateJpaAutoConfiguration.class
// , DataSourceAutoConfiguration.class,
// DataSourceTransactionManagerAutoConfiguration.class })
@Configuration
@Import({
ODataDataSourceConfiguration.class,
ODataServiceConfiguration.class
})
@ComponentScan
@RestController
@ComponentScan(basePackages = {"org.jzc.odata.cboard","org.jzc.odata.cboard.odataservice","com.sdl.odata.api.service","com.sdl.odata.api.service.ODataService"})
public class ServiceContainer {

再运行,成功了!

SpringBoot 启动的时候提示 Field *** in *** required a bean named 'entityManagerFactory' that could not be found.的更多相关文章

  1. springboot jpa mongodb 整合mysql Field in required a bean of type that could not be found Failed to load ApplicationContext

    1.完整报错 *************************** APPLICATION FAILED TO START *************************** Descripti ...

  2. TClientDataSet 提交时提示 Field value Required 但是未提示具体哪个字段。

    TClientDataSet 提交时提示 Field value Required 但是未提示具体哪个字段. 这个错误特别麻烦,要使用 midas 控件时,虽然很方便.但是出错了根本找不到原因,特别是 ...

  3. 2. springboot启动报错:Field userMapper in com.service.UserService required a bean of type 'com.dao.UserMapper' that could not be found.

    报错信息: 2018-06-25 14:26:17.103  WARN 49752 --- [  restartedMain] ationConfigEmbeddedWebApplicationCon ...

  4. SpringBoot启动项目时提示:Error:java: 读取***.jar时出错;

    场景 在IDEA中新建SpringBoot项目后,修改了默认的Maven仓库和配置文件,然后在启动项目时提示: Error:java: 读取\org\assertj\assertj-core\3.11 ...

  5. SpringBoot启动项目时提示:Error:(3, 32) java: 程序包org.springframework.boot不存在

    场景 在IDEA中新建SpringBoot项目,后启动项目时提示: Error:(3, 32) java: 程序包org.springframework.boot不存在 实现 将pom.xml中par ...

  6. SpringBoot中service注入失败(A component required a bean of type 'XXService' that could not found)

    先写了JUnit,发现启动不了,注释掉有问题的service也不可以.可能是因为spring开始时会加载所有service吧. 按照网友们的说法,一般需要检查: 1.入口类有没有写MapperScan ...

  7. A component required a bean named xxx that could not be found. Action: Consider defining

    0 环境 系统:win10 1 正文 https://stackoverflow.com/questions/44474367/field-in-com-xxx-required-a-bean-of- ...

  8. 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.

    运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...

  9. myeclipse2015不能启动tomcat,提示: Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at local

    myeclipse2015不能启动tomcat,提示: Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at local ...

随机推荐

  1. JMS 之 Active MQ 的消息传输

    本文使用Active MQ5.6 一.消息协商器(Message Broker) broke:消息的交换器,就是对消息进行管理的容器.ActiveMQ 可以创建多个 Broker,客户端与Active ...

  2. 汉诺塔(hanoi)

    汉诺塔代码: def hanoi(n,x,y,z): if n == 1: print(x,'-->',z) else: hanoi(n-1,x,z,y) print(x,'-->',z) ...

  3. Hadoop权威指南文摘

    第1章 初识Hadoop 1.1 数据!数据! 1.2 数据的存储与分析 HDFS实现数据的存储,MapReduce实现数据额分析与处理 1.3 相较于其他系统的优势 MapReduce是一个批量查询 ...

  4. 解决gitosis中authorized_keys不自动更新问题

    1.拷贝一个管理员权限用户的id_rsa.pub到服务器端 这里我拷贝的是yang电脑的key,命令如下: scp  /home/yang/.ssh/id_rsa.pub serveradmin@服务 ...

  5. javascript总结36:DOM-点击按钮切换图片案例

    <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8& ...

  6. Hadoop-2.4.0分布式安装手册

    目录 目录 1 1. 前言 2 2. 部署 2 2.1. 机器列表 2 2.2. 主机名 2 2.2.1. 临时修改主机名 3 2.2.2. 永久修改主机名 3 2.3. 免密码登录范围 4 3. 约 ...

  7. java程序员修炼之前笔记(前半部分)

    第一部分 用java7做开发 第一章 初始java7 java7中的新特性 switch支持String 支持100_000_000数值表示法 新的异常处理 | 连接多个异常 final Except ...

  8. 优化体验之使用visual EDM之映射存储过程,datatype to Enum

    stored produce,datatype to Enum,Colored Entity,Multiple Diagrams 一:EDM给我们提供的强大功能 1. 存储过程的映射 直接灌sql到d ...

  9. 记一次艰苦卓绝的Discuz x3 论坛升级过程

    首先吐槽一下discuz 的官方论坛. 你要想下载到正确版本的discuz实在不容易找到. 有兴趣自己去看吧. 就是因为这个原因, 我本来想要安装x2.5版本(那时x3 还是Beta版本), 结果不小 ...

  10. 相当郁闷的问题,TabHost选项卡标签图标始终不出现?

    在学习Android TabHost布局过程中,很多教程告诉我,这样来显示选项卡标签的图标和文字: TapSpec spec1 = tabHost.newTabSpec("tab 1&quo ...