我在配置中有这个豆
@Bean
public LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean(
DataSource dataSource ) {
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
bean.setPackagesToScan("com.x");
bean.setPersistenceUnitName("default");
bean.setDataSource(dataSource);
Properties hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "update");
hibernateProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL94Dialect");
bean.setJpaProperties(hibernateProperties);
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
bean.setJpaVendorAdapter(vendorAdapter);
return bean;
}
这是春季靴子
@EnableJpaRepositories(basePackages = {"com.x"})
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class,
HibernateJpaAutoConfiguration.class})
如何解决该问题?
非常感谢!
答案 0 :(得分:0)
您应在@EnableJpaRepositories批注中提供以下内容
@EnableJpaRepositories(entityManagerFactoryRef = "defaultEntityManager", transactionManagerRef = "defaultTransactionManager",
basePackages = {"<complete package to dao package>"})