Spring 4.x MVC and RESTful service Demo

岁酱吖の 提交于 2019-12-06 18:35:04

This project will demo the techniques that would be used in our project. This version 1 will be just a general-purpose website (I call it bare version), it has a front-end and a back-end, the backend requires login. The documentation is in another project, it's just my personal learning notes.

login page

Todo

  1. Web services security(done)
  2. Asked one question on stackoverflow (replied)
  3. RESTful CRUD (@RestController in Spring4.x)(done)
  4. Slf4j + Log4j(done)
  5. Error handling(ongoing)
  6. what's the difference between ctx-annotation-config and mvc-annotation-driven(reading)
  7. i18n: MessageSourceAware
  8. A simple Android native client consuming RESTful service.(reading a book)
  9. A hybrid mobile client consuming RESTful service(learning).

How to setup

  1. Get the code git clone https://github.com/uniquejava/spring4_rest.git

  2. Open project in eclipse, the maven plugin should automatically download the required jars.

    Also you can open this project in IDEA but ensure you right click on the pom.xml and mark this project as a Maven project.

  3. Run script doc/sql/mysql.sql

  4. Deploy to Tomcat

  5. Open in browser: http://localhost:8080/rest/

Notes on Eclipse

When you run this project in Eclipse, you may encounter below exceptions.

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

The solution is very simple, you just need to add the "Maven Dependency" in the Deployement Assembly

right click on your project and choose properties.
click on Deployement Assembly.
click add
click on "Java Build Path Entries"
select Maven Dependencies"
click Finish.

That's it!! rebuild and deploy again

Components

  1. spring 4.1.4
  2. jackson 2.5
  3. bootstrap-3.3.2
  4. jquery-1.11.2

Roadmap

Bare version will be proactive and will demo/use the latest techniques if i am happy.

General version would be done if i have time.

Corporation version is for internal use and close source.

Bare:

  • i18n
  • cluster
  • excel, odf, pdf
  • jpa
  • cache

General

  • bootstrap3.3.2
  • kindeditor

Corporation:

  • V18 integeration

Environment

Here is the environment I am working on.

  1. Ubuntu12.04.5 LTS
  2. Eclipse JEE 4.3
  3. Tomcat 7.0.57
  4. JDK1.6.0_45

However, this project is fully tested on Win7 + WAS8.5


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!