Spring Boot Reference Guide
Total Page:16
File Type:pdf, Size:1020Kb
Spring Boot Reference Guide Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, Andy Wilkinson, Marcel Overdijk, Christian Dupuis, Sébastien Deleuze Table of Contents Spring Boot Documentation . 1 1. About the documentation . 2 2. Getting help. 3 3. First steps . 4 4. Working with Spring Boot . 5 5. Learning about Spring Boot features . 6 6. Moving to production . 7 7. Advanced topics . 8 Getting started. 8 8. Introducing Spring Boot . 9 9. System Requirements . 10 9.1. Servlet containers . 10 10. Installing Spring Boot. 11 10.1. Installation instructions for the Java developer . 11 10.1.1. Maven installation. 11 10.1.2. Gradle installation . 13 10.2. Installing the Spring Boot CLI. 14 10.2.1. Manual installation . 14 10.2.2. Installation with SDKMAN! . 15 10.2.3. OSX Homebrew installation . 15 10.2.4. MacPorts installation . 16 10.2.5. Command-line completion . 16 10.2.6. Quick start Spring CLI example . 16 10.3. Upgrading from an earlier version of Spring Boot . 17 11. Developing your first Spring Boot application. 18 11.1. Creating the POM. 18 11.2. Adding classpath dependencies . 20 11.3. Writing the code . 20 11.3.1. The @RestController and @RequestMapping annotations . 21 11.3.2. The @EnableAutoConfiguration annotation . 21 11.3.3. The “main” method . 22 11.4. Running the example . 22 11.5. Creating an executable jar . 22 12. What to read next . 25 Using Spring Boot. 25 13. Build systems . 26 13.1. Dependency management. 26 13.2. Maven. 26 13.2.1. Inheriting the starter parent. 26 13.2.2. Using Spring Boot without the parent POM . 27 13.2.3. Changing the Java version . 28 13.2.4. Using the Spring Boot Maven plugin. 28 13.3. Gradle . 29 13.4. Ant . 30 13.5. Starters . 31 14. Structuring your code . 36 14.1. Using the “default” package . 36 14.2. Locating the main application class . 36 15. Configuration classes . 38 15.1. Importing additional configuration classes . 38 15.2. Importing XML configuration . 38 16. Auto-configuration . 39 16.1. Gradually replacing auto-configuration . 39 16.2. Disabling specific auto-configuration. 39 17. Spring Beans and dependency injection . 40 18. Using the @SpringBootApplication annotation . 41 19. Running your application . ..