How to run a Spring Boot application

In order to run a Spring Boot application, first of all, make sure you have included the Maven plugin in your pom.xml: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> Next, make sure you build your application with: mvn install  Now you are ready to run your Spring Boot application! Run the Spring Boot application … Read more

Hello World Spring Boot

The Spring framework was launched as an alternative framework to the Java Enterprise Edition. Instead of using components such as Enterprise JavaBeans with a complex protocol structure, Spring proposed a simpler approach focusing on dependency injection and aspect-oriented programming (AOP) to get Enterprise functionality of Java EE components but using simple Java objects (POJO ).
The downside is that even though Spring is an easily extensible framework, starting from a minimal core, it is rather complex in terms of configuration.

Read more

How to set JVM settings in a Spring Boot application

The simplest way to set JVM settings in a Spring Boot application is to execute the jar file and passing the JVM settings as in the following example: $ java -Xmx32m -Xss256k -jar target/demo-app-SNAPSHOT.jar Another option is to set JVM arguments in the spring-boot-maven-plugin: For example, the following configuration suspend the process until a debugger … Read more

How to execute a Java class at Spring Boot startup

In order to execute method or classes when a Spring Boot application is started you can implement the CommandLineRunner interface, which basically provides just one method: public void run(String… args) that will get called by Spring Boot only once after the application has started. Example: package com.example; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.boot.CommandLineRunner; public class … Read more

Exit mobile version