1. pom.xml定义属性
2. pom.xml配置,使用变量替换
3. spring的applicationContext.xml使用变量
<properties>
<project.version>0.1.1</project.version>
</properties>2. pom.xml配置,使用变量替换
<resources>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>3. spring的applicationContext.xml使用变量
<bean id="ProjectUtil" class="com.pandy.framework.base.utils.ProjectUtil">
<property name="projectVersion">
<value>${project.version}</value>
</property>
</bean>
本文介绍了如何在pom.xml中定义项目版本属性,并通过资源过滤的方式将此属性值注入到Spring的applicationContext.xml文件中,实现配置文件的动态变量替换。
732

被折叠的 条评论
为什么被折叠?



