diff options
3 files changed, 8 insertions, 8 deletions
diff --git a/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java b/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java index 150ced69..535755c2 100644 --- a/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java +++ b/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java @@ -2,10 +2,7 @@ package com.juick.configuration; import com.juick.service.search.SearchService; import org.apache.commons.dbcp2.BasicDataSource; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -55,6 +52,7 @@ public class DataConfiguration implements TransactionManagementConfigurer { } @Bean + @DependsOn("dataSource") public JdbcTemplate jdbcTemplate() { return new JdbcTemplate(dataSource()); } diff --git a/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java b/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java index 1cf5c1a1..5f04ea4e 100644 --- a/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java +++ b/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java @@ -5,6 +5,7 @@ import com.juick.service.search.SphinxSearchServiceImpl; import org.apache.commons.dbcp2.BasicDataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; @@ -34,6 +35,7 @@ public class SearchConfiguration { } @Bean + @DependsOn("searchDataSource") public SearchService searchService() { return new SphinxSearchServiceImpl(searchDataSource()); } diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java index 96cf8909..5a19270b 100644 --- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java +++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java @@ -5,10 +5,9 @@ package com.juick.components.configuration; */ import com.juick.components.XMPPServer; -import com.juick.configuration.DataConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; @@ -23,11 +22,12 @@ public class XmppAppConfiguration { @Inject private Environment env; @Inject - private JdbcTemplate jdbc; + private JdbcTemplate jdbcTemplate; @Bean + @DependsOn("jdbcTemplate") public XMPPServer xmpp() { - return new XMPPServer(env, service(), jdbc); + return new XMPPServer(env, service(), jdbcTemplate); } @Bean |