Spring Boot & Java 8 Cheat Sheet
Spring Boot - Core Concepts
@SpringBootApplication: Combines @Configuration, @EnableAutoConfiguration, and
@ComponentScan.
@RestController: Marks class as a controller where every method returns a domain object instead of
a view.
@Service / @Repository / @Component: Used for marking business logic, data access, and
general-purpose beans.
@Autowired: Injects dependencies automatically.
[Link]: Stores configuration like DB credentials, server port etc.
Spring Boot Starters: Preconfigured dependencies like spring-boot-starter-web, -data-jpa etc.
Embedded Servers: Spring Boot uses Tomcat, Jetty or Undertow internally.
Spring Boot Actuator: Provides production-ready endpoints like /actuator/health.
Java 8 - Key Features
Lambda Expressions: Syntax: (params) -> expression. Used for functional programming.
Functional Interfaces: Interfaces with a single abstract method. Eg: Runnable, Function, Predicate.
Streams API: Used to process collections with operations like map, filter, collect.
Optional: Avoids NullPointerException. Eg: [Link](value).
Method References: Shortcut for lambda: Class::method or object::method.
Default Methods: Interfaces can have method implementations with 'default' keyword.
Static Methods: Interfaces can include static methods.
Date/Time API: New classes like LocalDate, LocalTime, Period in [Link] package.