我在Tomcat 8中部署了Spring Boot应用程序。我想在春季启动应用程序启动时启动后台线程。这是我当前的实现
@SpringBootApplication
public class JmsTopicListApplication {
public static void main(String[] args) {
SpringApplication.run(JmsTopicListApplication.class, args);
JMSListener jmsListener = new JMSListener("192.168.16.56",
"jms/topic/ORD_CLINT_PUSH","org.jboss.naming.remote.client.InitialContextFactory",
"http-remoting://192.168.16.56:4545","jms/RemoteConnectionFactorySTP",
"ishara","ishara@007");
jmsListener.start();
}
有没有最好的方法呢?