일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 웹앱
- reactive
- Spring Batch
- ipTIME
- Spring Framework
- reactor
- 웹 스터디
- spring reactive
- 서버운영
- 공유기 서버
- reactor core
- 웹 커리큘럼
- Today
- Total
Hello World
[펌]Getting started with annotation based Spring MVC web application 본문
[펌]Getting started with annotation based Spring MVC web application
EnterKey 2016. 1. 10. 12:22Here is a minimal way to get a Spring 3 MVC project started with Maven.
First create
Now create the Servlet 3 web initializer and the Spring annotation config for the MVC parts in
The
class extends Spring’s built in Servlet3 web initializer code. It allows Servlet3 container such as Tomcat7 to auto detect this web application without the need of configuration setup. Because of we do not use , we need this class to allow Spring to hook into the Servlet container to bootstrap their dispatcher servlet. Also instead of typical Spring beans xml file configuration, we now can use all annotation based using .Noticed that I have combined the
as inner class, but you can easily move it out as top level class in a full scale application. This is the Spring annotation version of container configuration. You can easily customize the application by adding new here.Note: Do not forget to overwrite
method with , or else your URL request will not direct to the Spring dispatcher for processing! A step that can easily forgotten and you might find your self chasing why Spring controllers are not working.Above are really the minmal setup you need to start a war project. Next you want to add at least one controller to have some output to verify. Create this controller file
And now you would need the JSP view
Now cd into
and execute . You should see your Spring application starts and able to browse URL.There are lot of cool stuff you can do with Spring MVC. Checkout their awesome docs for more details.
출처: http://www.javacodegeeks.com/2013/10/getting-started-with-annotation-based-spring-mvc-web-application.html?utm_content=bufferce4af&utm_medium=social&utm_source=facebook.com&utm_campaign=buffer
'Spring > 3.x' 카테고리의 다른 글
[펌]Spring MVC 시작하기 (0) | 2016.01.14 |
---|---|
[펌]JSP 와 Servlet, 왜 같이 쓸까? (0) | 2016.01.14 |
[펌]파일 업로드 & 다운로드 (3/3) (0) | 2016.01.10 |
[펌]파일 업로드 & 다운로드 (2/3) (0) | 2016.01.10 |
[펌]파일 업로드 & 다운로드 (1/3) (0) | 2016.01.10 |