Spring Initializr at https://start.spring.io/ generates a Spring Boot project archive from project metadata and selected dependencies. Set the group, artifact, and description, select the dependencies, then click Generate and open the downloaded project. The skeleton includes an application class, a test class, an initially empty application.properties file, and a Maven pom.xml. section 4.2
Choose dependencies for the application being built; Initializr records them in pom.xml:
- For Spring Data JPA with MySQL, select Spring Data JPA and MySQL Driver. The generated Maven file includes spring-boot-starter-data-jpa and mysql-connector-java. section 4.2
- For Spring Data JDBC with MySQL, select Spring Data JDBC instead of JPA, alongside MySQL Driver. The starter becomes spring-boot-starter-data-jdbc. section 15.1
- For a Spring Data REST application, select Spring Web, Spring Data JPA, REST Repositories, and MySQL Driver. section 16.2
Generation is a starting point, not finished database configuration. Fill in application.properties for the target database and application behavior, and prepare the required SQL scripts. For example, the Spring Data JDBC setup uses spring.sql.init.mode=always so its classpath initialization scripts run with MySQL rather than only with an embedded database. section 15.1 section 16.2
Listing 16.1 The pom.xml Maven file
Path: Ch16/spring-data-rest/pom.xml
<dependency> #1
<groupId>org.springframework.boot</groupId> #1
<artifactId>spring-boot-starter-web</artifactId> #1
</dependency> #1
<dependency> #2
<groupId>org.springframework.boot</groupId> #2
<artifactId>spring-boot-starter-data-jpa</artifactId> #2
</dependency> #2
<dependency> #3
<groupId>org.springframework.boot</groupId> #3
<artifactId>spring-boot-starter-data-rest</artifactId> #3
</dependency> #3
<dependency> #4
<groupId>mysql</groupId> #4
<artifactId>mysql-connector-java</artifactId> #4
<scope>runtime</scope> #4
</dependency> #4
Inspect the generated REST project's pom.xml dependencies to see how the Web, JPA, and REST Repositories selections become Maven starters. section 16.2


