Non-maven springboot configure multiple profile environment

Recently I worked on an old project, did not use maven, springboot, pure springmvc project. Need to manually configure every handover, good trouble, then it will use up Profile.

Join in the applicationContext.xml

    <!--profile 区分开-->
	<beans profile="dev">
		<util:properties id="config" location="classpath:dev.properties"/>
	</beans>

	<beans profile="pro">
		<util:properties id="config" location="classpath:pro.properties"/>
	</beans>

Join the default configuration in web.xml to pro

    <!--默认profile为pro, 可以通过启动加参数修改-Dspring.profiles.active=dev-->
	<context-param>
		<param-name>spring.profiles.default</param-name>
		<param-value>pro</param-value>
	</context-param>

Development time course using a dev, plus -Dspring.profiles.active = dev parameter to vm in

Guess you like

Origin blog.csdn.net/favormm/article/details/95306492