Configurable to distinguish between different environments

Public java, public configuration file, in which the properties with different environments are configured with placeholders + profile (different properties for different environments, the same xml, java)

java: configure the properties file in the way of bean available in java, available in xml

 

<!-- Properties file replacement -->

<bean id="propertyConfigurer"

  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="order" value="1" />

<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>

<property name="ignoreResourceNotFound" value="true"/>

<property name="ignoreUnresolvablePlaceholders" value="true"/>

<property name="locations">

<list>

<value>classpath:system.properties</value>

<value>classpath:redis.properties</value>

<value>classpath:dubbo.properties</value>

<value>classpath:cas.properties</value>

</list>

</property>

 

xml: Available in configuration xml for role in web.xml

 

<context-param>

<param-name>log4jConfigLocation</param-name>

<param-value>log4j.properties</param-value>

</context-param>

 1.2 Used in configuration files

 

 

<context:property-placeholder location="classpath:db.properties" />

 

This applies to the use of wildcards in the configuration file

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325340583&siteId=291194637