A starter Java web application based on Spring. It leverages Spring Web MVC, Spring Data JPA with a Hibernate implementation, and Spring Security. :octocat: Live Site: http://java-web-starter.herokuapp.com
This is meant to be a starter. It is configured with User and Role data models which are used to implement best-practice authentication schemes. The application comes set up with two users pre-configured:
- Admin (username: admin, password: admin) with two roles ('ROLE_ADMIN' and 'ROLE_USER')
- Test (username: test, password: test) with one role ('ROLE_USER')
- Login and Register users
- Verification of user emails after registration to control spam accounts
- Forgotten password logic
- User roles are implemented to allow for administration by a central entity
- Clean. Simple. Minimal.
- Spring Framework provides the core functionality in this application such as Web MVC.
- Spring Security provides authentication and other related security features.
- Spring Data JPA uses a convention over configuration specification for abstracting away the Data Access Layer.
- Apache Tiles is used for the layout templating allowing a very dynamic approach to setting out the views.
- Hibernate is an ORM (Object-Relational Model) that implements the JPA specification.
- Hypersonic Database is an in-memory Java database that allows for faster development when a relational database is required.
- PostgreSQL is a robust, reliable and powerful relational database that uses SQL.
- DBCP lets you create a pool of open database connections to be shared by clients.
- BSON Types provides the ObjectId type which is used as a primary key in the database.
- SendGrid is a transactional and marketing email service.
- Twitter Bootstrap is a frontend framework that simplifies the creation of decent user interfaces for web applications.
To run this application in development using an embedded Tomcat 7 server:
mvn tomcat7:run -Dspring.profiles.active=dev
This will start the embedded Tomcat server on port 8080 and you can access the application here: http://localhost:8080/java-web-starter
The dev
profile uses an embedded HSQL database which is persistent only when the application is running.
You will also need to set up the your own copy of the SendGrid credentials system environment variables.
Run the following commands in the application root directory:
mvn clean package
java -jar target/dependency/webapp-runner.jar target/*.war
WARNING: Running production-style will require you have PostgreSQL installed and the database credentials stored in the DATABASE_URL
environment variable.
The application is currently deployed on Heroku. The following steps will deploy the WAR file produced in the previous section by running this heroku plugin command:
heroku deploy:war --war target/*.war --app <appname>
- Implement Rememeber Me feature to persist user sessions beyond each browser session.