为了账号安全,请及时绑定邮箱和手机立即绑定

考虑在你的配置中定义一个名为'entityManagerFactory'的bean

考虑在你的配置中定义一个名为'entityManagerFactory'的bean

冉冉说 2021-06-08 17:01:16
我正在尝试将spring boot 1.5.9升级到2.0.3,服务启动失败,出现以下错误:***************************APPLICATION FAILED TO START***************************Description:Method mvcConversionService in org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration required a bean named 'entityManagerFactory' that could not be found.Action:Consider defining a bean named 'entityManagerFactory' in your configuration.Process finished with exit code 1该服务在 Spring boot 1.5.9 中正常启动。这里是 yaml 文件:    spring:      application:      name: customer-crud-application      datasource:        url: jdbc:jtds:sqlserver://localhost:1433;databaseName=db-data-dev        username: sa        password: pwd        driverClassName: net.sourceforge.jtds.jdbc.Driver      jpa:        show-sql: true        hibernate:        dialect: org.hibernate.dialect.SQLServer2012Dialect    server:      port: 8080      max-http-header-size: 65536和 gradle.build    dependencies {        compile 'org.springframework.boot:spring-boot-starter-web'        compile versions.lombok        compile('net.sourceforge.jtds:jtds')        compile versions.spring_jdbc        compile versions.spring_boot_starter_data_jpa    }项目使用spring boot 2.0构建成功,我已经清理了c:/Users/{user}/.m2文件夹和intelliJ缓存。请帮忙!
查看完整描述

3 回答

?
杨魅力

TA贡献1811条经验 获得超6个赞

请尝试在yaml文件中进行以下更改,


  spring:

        jpa:    

            show-sql: true

            database: MYSQL

            hibernate:

                ddl-auto: update

                dialect:

                   storage_engine: innodb

        datasource:

            url: jdbc:mysql://localhost:3306/databasename?useSSL=false

            username: user

            password: password

      

    server:

      port: 9999

快乐编码.. :)


查看完整回答
反对 回复 2021-06-10
?
烙印99

TA贡献1829条经验 获得超13个赞

添加以下部门。


<dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-data-jpa</artifactId>

</dependency>


查看完整回答
反对 回复 2021-06-10
  • 3 回答
  • 0 关注
  • 537 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信