Spring:Basic
lastmod 2025-02-14created 2015-04-1716 edits
A summary of Spring basics.
Order of operation
SpringMVC-DispatcherServlet.png
Related classes:
Files
A description of the files shown when a project is first created.
web.xml
- See web.xml.
Note that you can apply the encoding setting here instead of Tomcat's uriencoding.
<!-- ENCODING -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
root-context.xml
servlet-context.xml
-
annotation-driven - Declares the use of annotations.
-
resources - HTML resource mapping.
- Sample code is as follows. <resources mapping="/resources/**" location="/resources/" />
- <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- ViewResolver setting that maps JSPs to NAMEs.
- <context:component-scan base-package="com.my.domain" />
- Scans all subpackages defined in base-package for annotations and registers them as Beans.
See also
Favorite site
- Spring, second XML configuration
- [Recommended] Getting started with Spring 3.0 - How Hello World works
- [Recommended] Spring MVC Framework (Model View Controller Framework)
Pages that link here