From 367b2a23d5149f26b51fedee04667f07ed7b6c97 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Wed, 13 Sep 2017 16:12:45 +0200 Subject: Rework the datasource access Make a call to Spring datasource instead calling the method directly Change-Id: If9464f8591cd140079d09dc33c83a8b4380bf5ae Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java index fa0ca9615..c00deea66 100644 --- a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java @@ -52,6 +52,7 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.refprop.RefProp; import org.onap.clamp.clds.transform.XslTransformer; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.ApplicationContext; @@ -67,7 +68,7 @@ public class CldsConfiguration { private ApplicationContext context; /** - * Clds Identity databse DataSource configuration + * Clds Identity database DataSource configuration */ @Bean(name = "cldsDataSource") @ConfigurationProperties(prefix = "spring.datasource.cldsdb") @@ -86,9 +87,9 @@ public class CldsConfiguration { } @Bean(name = "cldsDao") - public CldsDao getCldsDao() { + public CldsDao getCldsDao(@Qualifier("cldsDataSource") DataSource dataSource) { CldsDao cldsDao = new CldsDao(); - cldsDao.setDataSource(cldsDataSource()); + cldsDao.setDataSource(dataSource); return cldsDao; } -- cgit 1.2.3-korg