Spring Boot Strapping
If you need to initialise your application, there are two ways to do this. You can get your initialisation class to implement either:
ApplicationListener<ContextRefreshedEvent>
.@Override
theonApplicationEvent
methodCommandLineRunner
.@Override
the run method.
Boot strapping is typically used to initialise the application database or any other setup activities.
NOTE for Lombok: In IntelliJ, install the Lombok plugin before using the above @Sl4j.
application.properties
ANSI Console
The entry spring.output.ansi.enabled=ALWAYS
placed in the application.properties enables coloured output on the java console to make debugging easier.
Logging Level
The entry logging.level.<package-root>=DEBUG
must be placed in applicaton.properties to enable logging level to DEBUG.
Run from Command Line
To download all maven packages, execute a
mvn clean install
.To run the application, issue
mvn spring-boot:run
.
Windows
To ensure mvn
finds the correct JDK in Windows, edit the mvnw.cmd file and set the JAVA_HOME
environment variable correctly.