Spring Boot 2 Cheat Sheet
Spring Boot 2 Cheat Sheet
• : **/application*.yml or
**/application*.yaml
• : **/application*.properties
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-
parent</artifactId> • Enabled by @SpringBootApplication or
<version>2.1.0.RELEASE</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency> java -jar myapp.jar --debug
</dependencies>
Disabling an auto-con�guration class with Java conf
@SpringBootApplication
public class MyApp { @EnableAutoConfiguration(exclude=
{DataSourceAutoConfiguration.class})
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args); Disabling an auto-con�guration class with properties
}
spring.autoconfigure.exclude= \
}
org.springframework.boot.autoconfigure.XXXX
SPRING BOOT 2 CHEAT SHEET
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</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 'org.springframework.boot' version
'2.1.0.RELEASE' 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>org.springframework.boot</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
Maven
• https://spring.io/guides
mvn spring-boot:run • https://spring.io/projects/spring-framework
• Spring Boot documentation
Gradle • Spring Core cheat sheet
gradle bootRun