8. Introducing Spring Boot
Goals of Spring Boot:
- Provide a radically faster and widely accessible getting started experience for all Spring development.
- Be opinionated out of the box, but get out of the the-quickly as requirements start to diverge from the defaults.
- Provide a range of non-functional features that is common to large classes of projects (e.g. embedded servers, security, Metrics, health checks, externalized configuration).
- Absolutely no code generation and no requirement for XML configuration.
9. System Requirements
Spring boot integrates web containers for servlet 3.0+ such as Tomcat, Jetty, and so on.
Ten. Installing Spring Boot
Various installation methods for spring boot and Spring boot CLI
Developing your first Spring Boot application
1.
The spring-boot-starter-parent is a special starter that provides useful Maven defaults. It also provides a dependency-management sections so, can omit version tags for "blessed" dependencies.
Spring-boot-starter-parent provides the required dependencies, and can omit dependent versions.
Spring-boot-starter-web can be used to generate web programs, with Tomcat and so on.
2. Code:
1Import org.springframework.boot.*;2Import org.springframework.boot.autoconfigure.*;3Import org.springframework.stereotype.*;4Import org.springframework.web.bind.annotation.*;5 6@RestController//Rest controller that renders the string directly and returns it to the caller7@EnableAutoConfiguration//Automatic Configuration8 Public classExample {9@RequestMapping ("/")//RoutingTen String Home () { One return "Hello world!"; A } - Public Static voidMain (string[] args) throws Exception { -Springapplication.run (Example.class, args); the } -}
Start with the following command
MVN Spring-boot:run
[Spring Boot Reference Guide] reading notes one Getting Started