Spring Boot is a Spring ecosystem project that helps create applications faster by providing ready-to-use configuration and tools. It follows convention over configuration: use common defaults, then change the settings your application needs to handle differently. section 7.0 section 7.2.3
A web application needs a servlet container and configuration to route requests. Spring Boot reduces that setup so you can focus on application behavior rather than writing every configuration yourself. section 7.2
Three features make that possible:
- Project initialization creates an empty but configured application skeleton. section 7.2
- Dependency starters group compatible dependencies for a particular capability, so you do not have to select each dependency and version separately. section 7.2
- Autoconfiguration supplies defaults based on the dependencies in the project. You can change defaults that do not fit your needs. section 7.2
Starting a web application
Add the web dependency and start the application. Spring Boot configures a Tomcat servlet container by convention; in this example, it starts on port 8080. Spring Boot also configures Spring MVC components that handle HTTP requests. section 7.2.3 section 7.5
Configuring a data source
To use MySQL instead of H2, change the database dependency and add connection properties in application.properties. Spring Boot uses the spring.datasource properties to create a DataSource bean. Set spring.sql.init.mode to always to run schema.sql for MySQL; H2 runs it by default when the file exists. Do not store production passwords in the properties file. section 12.3.1
Listing 12.12 The connection properties
spring.datasource.url=jdbc:mysql://localhost/spring_start_here? useLegacyDatetimeCode=false&serverTimezone=UTC #A spring.datasource.username=<dbms username> #B spring.datasource.password=<dbms password> #B spring.sql.init.mode=always #C
These properties specify the database location, credentials, and schema initialization setting for the MySQL example. section 12.3.1








