(i) Read the properties configuration information through @value in the Controller
1, Springmvc-servlet.xml in the configuration:
<bean id= "configproperties" class= "Org.springframework.beans.factory.config.PropertiesFactoryBean" >
<property name= "Locations" >
<list>
<value>classpath:basicmanagement.properties</ value>
</list>
</property>
</bean>
<bean id= "Propertyconfigurer" class= " Org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer ">
<property name=" Properties "ref=" Configproperties "/>
</bean>
2. Configuration parameters in Basicmanagement.properties
Sessiontimeout = 60
3. Controller Acquisition method
@Value ("#{configproperties[' Sessiontimeout '}")
private int sessiontimeout;
(ii) Read the properties configuration information through the @value Service
1, applicationcontext.xml in the configuration
<bean id= "Propertyconfigurer" class= "Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
<property name= "Location" value= "Classpath:basicmanagement.properties"/>
</bean>
2. Service Acquisition method
@Value ("${sessiontimeout}")
private int sessiontimeout;