Skip to content

Bernardo-MG/spring-mvc-react-maven-archetype-example

Repository files navigation

Spring MVC Project

This is a Spring MVC project using React templates for the frontend, created with the use of the Spring MVC with React Maven Archetype. It will ease the development of new Spring MVC projects, setting it up for CI through the use of three free services: Github, Github Workflow and Bintray.

Before beginning with the new project there are a few things which should be edited:

  • This readme's description has to be adapted to the new project.
  • Project info on the POM should be checked.
  • The various links on the readme, POM and Maven site (for repositories, issues, etc) should be verified.
  • The documentation on the project's Maven Site has to be written.
  • The license, if not using the MIT one, should be changed. Remember that this is referenced on the POM, readme and LICENSE files.

Note that the Maven site is using the Docs Maven Skin, which will have a few configuration requirements of its own.

Maven Central Bintray

Release docs Development docs

Release javadocs Development javadocs

Features

The project by default comes with a useful series of features:

  • Preconfigured POM to begin developing a new Spring MVC project with [Spring Boot}(https://spring.io/projects/spring-boot).
  • Initial sample project including working persistence and exception handling
  • Integration with Thymeleaf for the view templates.
  • Using React for the UI.
  • Using Liquibase for database versioning.
  • Integration with iText for generating PDFs.
  • Prepared for Github Workflow, including configuration files and deployment scripts. Check the Archetype documentation to find out more.
  • Unit and integration tests suites ready to be run with JUnit just by using the Maven test and verify commands.
  • A Maven site, using the Docs Maven Skin, to contain the documentation, the Javadocs and several reports.
  • A bunch of useful files, such as readme, gitignore and gitattributes.

Documentation

Documentation is always generated for the latest release, kept in the 'master' branch:

Documentation is also generated from the latest snapshot, taken from the 'develop' branch:

The documentation site is actually a Maven site, and its sources are included in the project. If required it can be generated by using the following Maven command:

mvn verify site -P h2,development -Dspring.profiles.active=test,h2

The verify phase is required, otherwise some of the reports won't be generated.

Usage

The application is coded in Java, using Maven to manage the project.

Profiles

Maven profiles are included for setting up the database.

Spring profiles are also included for the databases. Matching the same name.

Profile Database
h2 H2 in-memory database
mysql MySQL database
postgres PostgreSQL database
Profile Server
development Development settings
production Production settings

Installing

The project can be installed by creating the war file and deploying it into a server.

Running

To run the project locally use the following Maven command:

mvn spring-boot:run -P h2,development -Dspring.profiles.active=h2

It will be accessible at http://localhost:8080/.

Running the tests

The project requires a database and a server for being able to run the integration tests.

Just like running the project, an embedded server with an in-memory database can be used:

mvn verify -P h2,development -Dspring.profiles.active=test,h2

Packaging the WAR

When creating the WAR file the database connection credentials should be read from the environment:

mvn package -P production,mysql

Check the documentation for more information.

Collaborate

Any kind of help with the project will be well received, and there are two main ways to give such help:

  • Reporting errors and asking for extensions through the issues management
  • or forking the repository and extending the project

Issues management

Issues are managed at the GitHub project issues tracker, where any Github user may report bugs or ask for new features.

Getting the code

If you wish to fork or modify the code, visit the GitHub project page, where the latest versions are always kept. Check the 'master' branch for the latest release, and the 'develop' for the current, and stable, development version.

License

The project has been released under the MIT License.

About

Example project created with the Spring MVC with React Maven Archetype

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages