SPRING BOOT 2 CHEAT SHEET
Spring Boot - Date :
Don't use the **default** package. Prefer using
the Java convention *[Link]*
• Built on top of a lot of Spring Projects
([Link]
• Opinionated con�guration
• Wide ecosystem com
• Start a project faster with no con�guration + example
| + project
| | - [Link]
| | |
| | + player
• Bootstrap class SpringApplication | | | - [Link]
• Default logger (@see spring-jcl) | | | - [Link]
• FailureAnalyzers : friendly failure report
• Application Events on Listeners
• Choose the right ApplicationContext
• Accessing application arguments Properties �les in folder src/main/resources/ are loaded
• Control application exit code automatically
• : **/application*.yml or
**/application*.yaml
• : **/application*.properties
<parent>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-
parent</artifactId> • Enabled by @SpringBootApplication or
<version>[Link]</version> @EnableAutoConfiguration
</parent>
• Spring Boot scans all libs on the classpath and auto-
<dependencies> con�gures them ( )
<dependency>
Display Spring Boot Autocon�gure report
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency> java -jar [Link] --debug
</dependencies>
Disabling an auto-con�guration class with Java conf
@SpringBootApplication
public class MyApp { @EnableAutoConfiguration(exclude=
{[Link]})
public static void main(String[] args) {
[Link]([Link], args); Disabling an auto-con�guration class with properties
}
[Link]= \
}
[Link]
[Link]/cheat-sheets [Link] [Link]
SPRING BOOT 2 CHEAT SHEET
Maven O�cial starters : spring-boot-starter-*
<build>
<plugins>
<plugin>
<groupId>[Link]</groupId> Web applications using Spring
<artifactId>spring-boot-maven- MVC (Tomcat embedded)
plugin</artifactId>
</plugin> Spring test using JUnit, Hamcrest
</plugins> and Mockito
</build>
Secured services with Spring
Gradle Security
WebFlux applications using Spring
plugins { Framework’s Reactive Web
id '[Link]' version
'[Link]' WebSocket applications using
} Spring Framework’s WebSocket
Con�gured resources to use
Spring Data JDBC
Production ready features threw HTTP or JMX Con�gured resources to use
Spring Data JPA with Hibernate
<dependency>
<groupId>[Link]</groupId> Web applications using Spring
<artifactId>spring-boot-starter- Data repositories over REST
actuator</artifactId>
Production ready features using
</dependency>
Spring's Actuator (monitor and
manage)
Standalone
java -jar target/[Link] Using Jetty over the default Tomcat
Using Log4j2 for logging over the
Standalone with remote debug
default Logback
java -Xdebug \ Using Undertow over the default
-Xrunjdwp:server=y,transport=dt_socket\ Tomcat
,address=8000,suspend=n -jar target/myapplication-
[Link]
Maven
• [Link]
mvn spring-boot:run • [Link]
• Spring Boot documentation
Gradle • Spring Core cheat sheet
gradle bootRun
[Link]/cheat-sheets [Link] [Link]