Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 通过web.xml中的ContextLoaderListener初始化SpringBean配置文件_Java_Spring_Web.xml_Servlet Listeners_Spring Bean - Fatal编程技术网

Java 通过web.xml中的ContextLoaderListener初始化SpringBean配置文件

Java 通过web.xml中的ContextLoaderListener初始化SpringBean配置文件,java,spring,web.xml,servlet-listeners,spring-bean,Java,Spring,Web.xml,Servlet Listeners,Spring Bean,在我的web.xml中,我声明了一个ContextLoaderListener以如下方式配置spring应用程序: <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 您可以在ContextLoaderListener级别配置web.xml,方法是: <

在我的
web.xml
中,我声明了一个
ContextLoaderListener
以如下方式配置spring应用程序:

<listener>    
   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>    
</listener>

您可以在
ContextLoaderListener
级别配置
web.xml
,方法是:

<context-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>profileName</param-value>
</context-param>
<init-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>profileName</param-value>
</init-param>
参考:

<context-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>profileName</param-value>
</context-param>
<init-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>profileName</param-value>
</init-param>