【问题标题】:Setting spring config in Ant target在 Ant 目标中设置 spring 配置
【发布时间】:2015-03-10 10:27:54
【问题描述】:

我是 Ant 和 Spring 框架的新手。是否可以定义 spring-config 文件以供 Ant 目标中的各种 Java 类使用?我问是因为我想创建两个采用不同 bean 的单独目标。

【问题讨论】:

    标签: java spring ant javabeans target


    【解决方案1】:

    你可以有多个web.xml文件,并在每个web.xml文件中对应配置spring-confic文件。在每个目标的 ant build.xml 中,您可以指定不同的 web.xml 文件。

    在 web.xml 中

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/app-ontrollers.xml
            /WEB-INF/app-service.xml
            /WEB-INF/app-data.xml
            /WEB-INF/app-security.xml
        </param-value>
    </context-param>
    


    在 build.xml 中

    <property name="web.xml" value="src/main/webapp/WEB-INF/web.xml" />
    
    <target name="release" depends="compile">
        <war warfile="${dist}/${web.app.name}" webxml="${web.xml}">
            ...
        </war>
            ...
    </target>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-02
      • 2018-11-14
      • 1970-01-01
      • 2011-06-23
      • 2014-09-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-18
      相关资源
      最近更新 更多