mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:25:49 +00:00
Setup Java configuration into the web.xml
This commit is contained in:
parent
a04d789db9
commit
521155c3a6
3 changed files with 38 additions and 9 deletions
|
@ -0,0 +1,10 @@
|
|||
package org.springframework.samples.petclinic.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
@Configuration
|
||||
@ImportResource("classpath:spring/mvc-core-config.xml")
|
||||
public class MvcCoreConfig {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.springframework.samples.petclinic.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
@Configuration
|
||||
@ImportResource({"classpath:spring/business-config.xml", "classpath:spring/tools-config.xml"})
|
||||
public class RootApplicationContextConfig {
|
||||
|
||||
}
|
|
@ -28,13 +28,18 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
|||
-->
|
||||
|
||||
<!--
|
||||
- Location of the XML file that defines the root application context.
|
||||
- Location of the Java configuration that defines the root application context.
|
||||
- Applied by ContextLoaderListener.
|
||||
-->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring/business-config.xml, classpath:spring/tools-config.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>contextClass</param-name>
|
||||
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>org.springframework.samples.petclinic.config.RootApplicationContextConfig</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
|
@ -46,10 +51,14 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
|||
<servlet>
|
||||
<servlet-name>petclinic</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:spring/mvc-core-config.xml</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>contextClass</param-name>
|
||||
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>org.springframework.samples.petclinic.config.MvcCoreConfig</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
|
|
Loading…
Reference in a new issue