首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring与Spring的集成作为战争运行

Spring与Spring的集成作为战争运行
EN

Stack Overflow用户
提问于 2016-07-19 16:39:54
回答 1查看 932关注 0票数 0

我正在尝试运行我的,在tomcat中使用Spring (所以我将它打包为war)。

我能够成功地部署war,但它没有监听给定队列上的消息。当我将它作为IDE中的应用程序启动时,一切都很好。有人能指出我在下面的代码中遗漏了什么,或者应该以另一种方式部署吗?

代码语言:javascript
复制
@Configuration
@SpringBootApplication
@IntegrationComponentScan
@EnableAutoConfiguration
@EnableIntegration
public class SpringIntegrationApplication {

public static void main(String[] args) {
    SpringApplication.run(SpringIntegrationApplication .class, args);
}

@Autowired
private ActiveMQConnectionFactory activeMQConnectionFactory;

@Bean
public IntegrationFlow jmsInboundFlow() {
    return IntegrationFlows.from(
                                Jms.inboundAdapter(this.activeMQConnectionFactory)
                                                    .configureJmsTemplate(t -> t.deliveryPersistent(true)/*.jmsMessageConverter(myMessageConverter())*/)
                                                    .destination("testQueue"), // name of the queue
                                e -> e.poller( Pollers.fixedDelay(10000).maxMessagesPerPoll(20) )
                             )
                             .enrich(e -> e
                                    .requestPayload(Message::getPayload)
                                    .shouldClonePayload(false)                                                                               
                                    .<Map<String, String>>headerFunction("originalMessage", m -> m.getPayload(), true)
                             )
                             .channel("entrypoint")
                             .get();
}

@Router(inputChannel="entrypoint")
public String route(@SuppressWarnings("rawtypes") Message message) {

    if (isErrorMessage) {
        return "done.input";
    }

}

这个等级(build.gradle)封装了它:

代码语言:javascript
复制
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'maven-publish'

version = '1.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
 mavenCentral()
}


dependencies {

compile(
    [group: 'org.springframework.integration', name: 'spring-integration-feed', version: springframeworkVersion],
    'org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE',
    'org.springframework.integration:spring-integration-core:4.2.5.RELEASE',
    'org.springframework.integration:spring-integration-flow:1.0.0.RELEASE',
    'org.springframework.integration:spring-integration-java-dsl:1.1.2.RELEASE',
    'org.springframework.integration:spring-integration-http:4.2.5.RELEASE',
    'org.springframework.integration:spring-integration-jms:4.2.5.RELEASE', 
    'org.springframework.integration:spring-integration-jdbc:4.2.5.RELEASE',
    [group: 'log4j', name: 'log4j', version: '1.2.17'],
    [group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.5'],
    [group: 'javax.servlet', name: 'jstl', version: '1.2'],         
    [group: 'org.apache.activemq', name: 'activemq-amqp', version: '5.13.3'],
    'javax:javaee-api:7.0'
)

//If more required then 
//http://mvnrepository.com/artifact/org.springframework.integration

testCompile (
    [group: 'junit', name: 'junit', version: '4.11'],
    [group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.3.5.RELEASE'] 
)

}

任何投入都非常感谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-19 17:15:33

我想知道您的应用程序中是否有SpringBootServletInitializerhttp://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file

否则,请在Tomcat中启动应用程序后,共享org.springframework的调试日志。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38464122

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档