This project is my attempt to develop a simple web application with a "backend service" using Spring 5, JUnit 5, Java 9, RestTemplate, Gradle, SLF4J and Tomcat.
- Use 'tomcatRun' or 'tomcatRunWar' gradle task to start a tomcat instance, and deploy to it.
- Either run http://localhost:8080/application from the browser, or run 'ClientTest' from your IDE.
- Improve unit testing using MockMvc.
- Replace hard-coded values with dependency injection.
- Modularize services.
- Upgrade to Spring Boot.
- Add an in-memory database, like H2.
- Standard Spring MVC project structure seems to be that the view directory is under the WEB-INF directory. This enforces good habits (like MVC), but it prevents you from accessing the page directly.
- I wanted my default home page to be an html file (index.html), but I kept getting 404 errors. Either no mapping could be found, or I was unable to get the ViewResolver to ignore the html files.
- The application must be running (tomcatRun) before the "unit tests" can be started. Otherwise, you will get a "connection refused" message. This also throws off the test coverage metrics.
Gradle Tomcat Plugin
Spring4 Restful Example
Spring4 Annotation Configuration
Spring Validation Example
Slf4J Example
JUnit 5 with Gradle