aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-12 01:34:07 +0700
committerGravatar Vitaly Takmazov2016-11-12 11:14:56 +0300
commit194a9a763c6b11d207e682b2f93de94475c473b4 (patch)
tree196317662017b716066eadfa413ecbdc7532c52d /juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
parent7d86347a351aa5263c19cd03aa0bda4650c8bfca (diff)
extracted application configuration from Mvc configuration with application specific beans;
extracted bean initialization from constructor; force using properties;
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java38
1 files changed, 38 insertions, 0 deletions
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
new file mode 100644
index 00000000..eb3dd726
--- /dev/null
+++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
@@ -0,0 +1,38 @@
+package com.juick.components.configuration;
+
+/**
+ * Created by aalexeev on 11/12/16.
+ */
+
+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.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import javax.inject.Inject;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Configuration
+@PropertySource("classpath:juick.conf")
+@Import(DataConfiguration.class)
+public class XmppAppConfiguration {
+ @Inject
+ private Environment env;
+ @Inject
+ private JdbcTemplate jdbc;
+
+ @Bean
+ public XMPPServer xmpp() {
+ return new XMPPServer(env, service(), jdbc);
+ }
+
+ @Bean
+ public ExecutorService service() {
+ return Executors.newCachedThreadPool();
+ }
+}