Компонент DataSource - OK
PlatformTransactionManager / JpaTransactionManager - не завершено :
@Bean
public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory);
return transactionManager;
}
LocalContainerEntityManagerFactoryBean - не завершено
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean();
entityManager.setDataSource(dataSource());
entityManager.setPackagesToScan("some package(s)");
entityManager.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
entityManager.setJpaProperties(hibernateProperties);
return entityManager;
}
И я не использую аннотации следующего класса:
@ComponentScan(" ... ") //you use scan in entityManagerFactory
@PropertySource(" ... ") //you use env.getProperty
@EnableJpaRepositories(" ... ")
Я использую следующие пакеты, касающиеся Jpa/ Hibernate:
compile group: 'org.springframework', name: 'spring-webmvc', version: SPRING_VERSION
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: SPRING_DATA_VERSION
compile group: 'org.springframework', name: 'spring-orm', version: SPRING_VERSION
compile group: 'mysql', name: 'mysql-connector-java', version: MYSQL_CONNECTOR_VERSION
compile group: 'org.hibernate', name: 'hibernate-core', version: HIBERNATE_VERSION
compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: HIBERNATE_VERSION