gpt4 book ai didi

java - 考虑在您的配置中定义一个名为 'entityManagerFactory' 的 bean。升级到 spring boot 2 后的 mssqlserver

转载 作者:行者123 更新时间:2023-11-29 07:26:34 25 4
gpt4 key购买 nike

我尝试将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 缓存。请帮忙!

最佳答案

我遇到了这个问题。当我检查maven构建日志时,我意识到有一个关于hibernate包的错误

"invalid LOC header (bad signature)".

我通过删除

下的子目录解决了
<user-home>\.m2\repository\org\hibernate\hibernate-core and recompiling my project.

关于java - 考虑在您的配置中定义一个名为 'entityManagerFactory' 的 bean。升级到 spring boot 2 后的 mssqlserver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51509863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com