有关于spirngmvc架构在处理给静态变量赋值的方法
- 1若有profile的情况下:在profile中自定义自己的属性
- 2创建类以及类中的静态方法
@Component
public class Utils {
public static String param;
public static void setValue(String value1){
param = value1;
}
}
- 3在xml中配置对应的bean
<bean id="setValue" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="com.*.*.*.*.Utils.setValue"/>
<property name="arguments">
<list>
<value>value1</value>
</list>
</property>
</bean>