我正在嘗試運行一個spring-boot應用程序,它通過spring-jpa使用hibernate,但是我收到了錯誤我的pom.xml文件是這樣的:<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.1.8.RELEASE</version></parent><dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-taglibs</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> </dependency></dependencies>我的hibernate配置是(方言配置在這個類的最后一個方法中):@Configuration@EnableTransactionManagement@ComponentScan({ "com.spring.app" })public class HibernateConfig { @Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); sessionFactory.setPackagesToScan(new String[] { "com.spring.app.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; }我在這做錯了什么?
3 回答

梵蒂岡之花
TA貢獻1900條經驗 獲得超5個贊
在數據庫服務器啟動時啟動應用程序(使用Spring Boot)時,我遇到了類似的問題。
Hibernate可以確定自動使用的正確方言,但為了做到這一點,它需要與數據庫的實時連接。
添加回答
舉報
0/150
提交
取消