<!-- 保存变量到application范围 -->
<bean class="org.springframework.web.context.support.ServletContextAttributeExporter">
<property name="attributes">
<map>
<entry key="appServer" value="${appServer}"/>
<entry key="staticServer" value="${staticServer}"/>
<entry key="cookieDomain" value="${cookieDomain}"/>
</map>
</property>
</bean>
${}可替换为任何你想存放的值
如何对静态变量进行注入?
private static String path;
@Value("${path}")
private void setPath(String path){
Class.path = path;
}