package com.juick.components.configuration; /** * Created by aalexeev on 11/12/16. */ import com.juick.components.XMPPServer; 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; 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") public class XmppAppConfiguration { @Inject private Environment env; @Inject private JdbcTemplate jdbcTemplate; @Bean @DependsOn("jdbcTemplate") public XMPPServer xmpp() { return new XMPPServer(env, service(), jdbcTemplate); } @Bean public ExecutorService service() { return Executors.newCachedThreadPool(); } }