我正在嘗試將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
快樂編碼.. :)

烙印99
TA貢獻1829條經驗 獲得超13個贊
添加以下部門。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
添加回答
舉報
0/150
提交
取消