kyussfia / springdemo

MIT License
0 stars 0 forks source link

Spring Demo

A basic web page with login and permission handling written in Java with Spring Framework. Spring Security does the job with the security layer, session functionality is provided by Spring Session, the controllers are supported by Spring Boot and the View is written with Thymeleaf.

Requirements

This MVC application require a MySQL database for its persistence layer. The default configured database is springdemo, that can be changed in the application.properties file. (The query to create the database is in the schema.sql file under resources) The main requirement for this project is a java jre installed on the target computer.

Installation

No complex installation is needed, only a java is what u need to package the source into a .jar file and run it with:

java -jar demo-application.jar

A "external" application.properties file next to the jar file is override the whole application.properties compiled into the jar, so you can change it for your needs.

First run

The default configuration is about to create the whole schema under the empty springdemo database, and fill it with startup data. So there is no more action to be executed.

Other runs

But if you want to run it more, you have to override a parameter to avoid your SQL database's constraint fails. The property to modify is the spring.datasource.initialization-mode. It is always by default, but that means, it wants to create the whole schema and insert the test data on every startup. The problem comes up with the data re-insertion, because there are unique key in your schema, which can't be overriden. So to acoid that after the First run, you have to change it to:

spring.datasource.initialization-mode = never

Test Data

Username - password - granted roles:

Guides

The following guides illustrate how to use some features concretely: