diff options
Diffstat (limited to 'asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java')
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java index 953c517702..3494945020 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java @@ -39,41 +39,31 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement -@EnableJpaRepositories( - entityManagerFactoryRef = "entityManagerFactory", - basePackages = {"org.onap.so.db.catalog.data.repository"} - ) +@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory", + basePackages = {"org.onap.so.db.catalog.data.repository"}) @Profile({"!test"}) public class CatalogDBConfig { - - @Primary - @Bean(name = "dataSource") - @ConfigurationProperties(prefix = "spring.datasource") - public DataSource dataSource() { - return DataSourceBuilder.create().build(); - } - @Primary - @Bean(name = "entityManagerFactory") - public LocalContainerEntityManagerFactoryBean - entityManagerFactory( - EntityManagerFactoryBuilder builder, - @Qualifier("dataSource") DataSource dataSource - ) { - return builder - .dataSource(dataSource) - .packages("org.onap.so.db.catalog.beans") - .persistenceUnit("catalogDB") - .build(); - } + @Primary + @Bean(name = "dataSource") + @ConfigurationProperties(prefix = "spring.datasource") + public DataSource dataSource() { + return DataSourceBuilder.create().build(); + } - @Primary - @Bean(name = "transactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("entityManagerFactory") EntityManagerFactory - entityManagerFactory - ) { - return new JpaTransactionManager(entityManagerFactory); - } + @Primary + @Bean(name = "entityManagerFactory") + public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, + @Qualifier("dataSource") DataSource dataSource) { + return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB") + .build(); + } + + @Primary + @Bean(name = "transactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory); + } } |