使用弹簧配置文件和gradle

时间:2016-01-31 21:29:21

标签: java spring gradle

我有以下上下文文件

   <?xml version="1.0" encoding="UTF-8"?>
   <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:encryption="http://www.jasypt.org/schema/encryption"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd 
        http://www.jasypt.org/schema/encryption http://www.jasypt.org/schema/encryption/jasypt-spring31-encryption-1.xsd">

    <import resource="dao-context.xml"/>
    <import resource="web-context.xml"/>
    <import resource="messaging-context.xml"/>

    <context:component-scan base-package="uk.co.testcompany.com"/>

    <bean id="bcProvider" class="org.bouncycastle.jce.provider.BouncyCastleProvider" />
    <bean id="saltProvider" class="org.jasypt.salt.RandomSaltGenerator"/>

    <encryption:string-digester 
        algorithm="SHA-256"
        iterations="10000"
        salt-size-bytes="20"
        provider-bean="bcProvider"
        salt-generator-bean="saltProvider"/>


    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="properties/rest_messages"/>
    </bean>

    <task:executor id="simpleExecutor" pool-size="5"  />
    <task:annotation-driven executor="simpleExecutor"/>

    <aop:aspectj-autoproxy />

    <bean id="loggingAspect" class="uk.co.testcompany.com.aspect.RequestLoggingAspect"></bean>

    <beans profile="dev">
        <context:property-placeholder location="classpath:/properties/dev/*.properties"/>
    </beans>

    <beans profile="test">
        <context:property-placeholder location="classpath:/properties/test/*.properties"/>
    </beans>

</beans>

我想在运行集成测试时使用dev配置文件。我有一个抽象的集成测试基类,一切都从。它看起来像这样:

import org.junit.runner.RunWith;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { 
                                    "classpath*:/spring/root-context.xml",
                                    "classpath*:/spring/test-utils-context.xml"
                                  })
@Transactional
@ActiveProfiles("dev")
public abstract class IntegrationTestBase {


}

我的构建过程使用gradle。现在一切都在本地工作正常,我在命令行上运行干净的构建,没有问题。但是,每当我尝试在我的持续集成服务器上运行它时,我都会收到以下错误:

  

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:上下文中只能存在一个AsyncAnnotationBeanPostProcessor。

我有点不知道为什么会这样,因为它在本地工作。在CI服务器上失败但在本地传递可能会出现什么问题?

干杯

0 个答案:

没有答案