HTTPS SSH

An example app for managing your TODOs.

Intro

If you're looking for a pure Spring web app example (but not Spring Boot), this is the place. It is a practical example, in the form of a TODO application.

The user is able to add a TODO, to mark a TODO as completed, to DELETE a todo, to view all TODOs the user created - or to search for one by some word.

Things covered:

  • Full Java-based configuration (no Spring xml stuff)
  • Multi-module Maven project (a.k.a. n-tier architecture) (domain, service, and web sub-modules)
  • Use of Spring profiles
  • Use of Spring Data JPA (with HikariCP and HSQLDB)
  • Use of Spring MVC
  • Use of Thymeleaf for templating (with Bootstrap)
  • Use of Spring Security (with pure Java-based configuration)
  • User Registration, Login and logout
  • Password encoding (with BCrypt)
  • Custom exceptions and error handling (example when the user is already registered)
  • Form validation and use of Bean Validation (example when submitting a new TODO)

In progress:

To do next:

  • User 'remember me' on login
  • Social Login (use of Spring Social)
  • Pagination in the table showing the TODOs
  • Use of Thymeleaf fragments in the templates
  • 2nd level cache for todos

Commands

To build and run the application Maven is used. Before running the commands, have the newest Java 8 and Maven 3 versions installed.

  • To build the application: mvn clean install (in the root directory)
  • To start the application: mvn jetty:run (in the web sub-directory)
  • To stop the application: mvn jetty:stop (in the web sub-directory)

When started, the app will be available at: http://localhost:8080/app/. You will be redirected to the login page, in order to login, first click the register button on the same page and fill in the data.

Screenshots

img

img

img

img

img

img

img

Important References

Persistence:

Persistence with Spring Data:

Transactions:

Loading of properties:

Property profiles:

Web templating/Thyemeleaf and form submission:

Validation:

CSS:

Integration and Unit testing:

Security:

Social log-in:

RESTful API:

Cache:

License

The MIT License (MIT)

Copyright (c) 2015 Martin Spasovski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.