
Spring Boot Reference Guide 2.0.10.BUILD-SNAPSHOT Phillip Webb , Dave Syer , Josh Long , Stéphane Nicoll , Rob Winch , Andy Wilkinson , Marcel Overdijk , Christian Dupuis , Sébastien Deleuze , Michael Simons , Vedran Pavi# , Jay Bryant , Madhura Bhave Copyright © 2012-2018 Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. Spring Boot Reference Guide Table of Contents I. 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 II. Getting Started ....................................................................................................................... 9 8. Introducing Spring Boot ................................................................................................. 10 9. System Requirements ................................................................................................... 11 9.1. Servlet Containers .............................................................................................. 11 10. Installing Spring Boot .................................................................................................. 12 10.1. Installation Instructions for the Java Developer .................................................. 12 Maven Installation ............................................................................................. 12 Gradle Installation ............................................................................................. 13 10.2. Installing the Spring Boot CLI ........................................................................... 14 Manual Installation ............................................................................................ 14 Installation with SDKMAN! ................................................................................. 14 OSX Homebrew Installation ............................................................................... 15 MacPorts Installation ......................................................................................... 15 Command-line Completion ................................................................................ 15 Windows Scoop Installation ............................................................................... 15 Quick-start Spring CLI Example ......................................................................... 16 10.3. Upgrading from an Earlier Version of Spring Boot .............................................. 16 11. Developing Your First Spring Boot Application .............................................................. 18 11.1. Creating the POM ............................................................................................ 18 11.2. Adding Classpath Dependencies ....................................................................... 19 11.3. Writing the Code .............................................................................................. 20 The @RestController and @RequestMapping Annotations .................................. 20 The @EnableAutoConfiguration Annotation ........................................................ 20 The “main” Method ........................................................................................... 21 11.4. Running the Example ....................................................................................... 21 11.5. Creating an Executable Jar ............................................................................... 21 12. What to Read Next ..................................................................................................... 23 III. Using Spring Boot ................................................................................................................ 24 13. Build Systems ............................................................................................................. 25 13.1. Dependency Management ................................................................................ 25 13.2. Maven ............................................................................................................. 25 Inheriting the Starter Parent .............................................................................. 26 Using Spring Boot without the Parent POM ........................................................ 26 Using the Spring Boot Maven Plugin ................................................................. 27 13.3. Gradle ............................................................................................................. 27 13.4. Ant .................................................................................................................. 27 13.5. Starters ............................................................................................................ 28 14. Structuring Your Code ................................................................................................. 34 14.1. Using the “default” Package .............................................................................. 34 2.0.10.BUILD-SNAPSHOT Spring Boot ii Spring Boot Reference Guide 14.2. Locating the Main Application Class .................................................................. 34 15. Configuration Classes ................................................................................................. 36 15.1. Importing Additional Configuration Classes ........................................................ 36 15.2. Importing XML Configuration ............................................................................. 36 16. Auto-configuration ....................................................................................................... 37 16.1. Gradually Replacing Auto-configuration ............................................................. 37 16.2. Disabling Specific Auto-configuration Classes .................................................... 37 17. Spring Beans and Dependency Injection ...................................................................... 38 18. Using the @SpringBootApplication Annotation .............................................................. 39 19. Running Your Application ............................................................................................ 41 19.1. Running from an IDE ....................................................................................... 41 19.2. Running as a Packaged Application .................................................................. 41 19.3. Using the Maven Plugin ................................................................................... 41 19.4. Using the Gradle Plugin ................................................................................... 42 19.5. Hot Swapping .................................................................................................. 42 20. Developer Tools .......................................................................................................... 43 20.1. Property Defaults ............................................................................................. 43 20.2. Automatic Restart ............................................................................................. 44 Logging changes in condition evaluation ............................................................ 45 Excluding Resources ......................................................................................... 45 Watching Additional Paths ................................................................................. 45 Disabling Restart .............................................................................................. 45 Using a Trigger File .......................................................................................... 46 Customizing the Restart Classloader ................................................................. 46 Known Limitations ............................................................................................. 47 20.3. LiveReload ....................................................................................................... 47 20.4. Global Settings ................................................................................................. 47 20.5. Remote Applications ......................................................................................... 47 Running the Remote Client Application .............................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages421 Page
-
File Size-