cleanup work
This commit is contained in:
parent
54c49c7f81
commit
7b531f0ce6
|
@ -29,8 +29,10 @@ public class ProductConfig {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "productEntityManager")
|
//
|
||||||
public LocalContainerEntityManagerFactoryBean productEntityManagerFactory() {
|
|
||||||
|
@Bean
|
||||||
|
public LocalContainerEntityManagerFactoryBean productEntityManager() {
|
||||||
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
||||||
em.setDataSource(productDataSource());
|
em.setDataSource(productDataSource());
|
||||||
em.setPackagesToScan(new String[] { "org.baeldung.persistence.multiple.model.product" });
|
em.setPackagesToScan(new String[] { "org.baeldung.persistence.multiple.model.product" });
|
||||||
|
@ -56,10 +58,10 @@ public class ProductConfig {
|
||||||
return dataSource;
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "productTransactionManager")
|
@Bean
|
||||||
public PlatformTransactionManager transactionManager() {
|
public PlatformTransactionManager productTransactionManager() {
|
||||||
final JpaTransactionManager transactionManager = new JpaTransactionManager();
|
final JpaTransactionManager transactionManager = new JpaTransactionManager();
|
||||||
transactionManager.setEntityManagerFactory(productEntityManagerFactory().getObject());
|
transactionManager.setEntityManagerFactory(productEntityManager().getObject());
|
||||||
return transactionManager;
|
return transactionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,11 @@ public class UserConfig {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "userEntityManager")
|
//
|
||||||
public LocalContainerEntityManagerFactoryBean userEntityManagerFactory() {
|
|
||||||
|
@Primary
|
||||||
|
@Bean
|
||||||
|
public LocalContainerEntityManagerFactoryBean userEntityManager() {
|
||||||
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
||||||
em.setDataSource(userDataSource());
|
em.setDataSource(userDataSource());
|
||||||
em.setPackagesToScan(new String[] { "org.baeldung.persistence.multiple.model.user" });
|
em.setPackagesToScan(new String[] { "org.baeldung.persistence.multiple.model.user" });
|
||||||
|
@ -46,6 +49,7 @@ public class UserConfig {
|
||||||
return em;
|
return em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public DataSource userDataSource() {
|
public DataSource userDataSource() {
|
||||||
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
||||||
|
@ -58,10 +62,10 @@ public class UserConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Primary
|
@Primary
|
||||||
@Bean(name = "userTransactionManager")
|
@Bean
|
||||||
public PlatformTransactionManager transactionManager() {
|
public PlatformTransactionManager userTransactionManager() {
|
||||||
final JpaTransactionManager transactionManager = new JpaTransactionManager();
|
final JpaTransactionManager transactionManager = new JpaTransactionManager();
|
||||||
transactionManager.setEntityManagerFactory(userEntityManagerFactory().getObject());
|
transactionManager.setEntityManagerFactory(userEntityManager().getObject());
|
||||||
return transactionManager;
|
return transactionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue