jboss spring applicationContext 在 web.xml 开始时加载
jboss spring applicationContext load on start in web.xml
我正在使用 wildfly 8.2.0。我想在开始时加载 spring-config.xml
然而,它并不成功。我做错了什么?
这是我的web.xml。
<?xml version="1.0" encoding="UTF-8"?>
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
版本="3.1">
<display-name>BQP</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>src/main/resources/spring-config*.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.bionic.rest.ApplicationConfiguration</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
对于 spring MVC,您可以加载配置 xml 形式 web.xml,如下所示
它将在应用程序启动时加载
<!-- Spring MVC -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/app-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
我正在使用 wildfly 8.2.0。我想在开始时加载 spring-config.xml 然而,它并不成功。我做错了什么?
这是我的web.xml。
<?xml version="1.0" encoding="UTF-8"?>
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 版本="3.1">
<display-name>BQP</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>src/main/resources/spring-config*.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.bionic.rest.ApplicationConfiguration</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
对于 spring MVC,您可以加载配置 xml 形式 web.xml,如下所示 它将在应用程序启动时加载
<!-- Spring MVC -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/app-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>