我正在尝试运行一个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
提交
取消