Spring Initializr: Difference between revisions
Line 26: | Line 26: | ||
For both Maven and Gradle-based projects, the source code is placed under: | For both Maven and Gradle-based projects, the source code is placed under: | ||
src/main/java | src/main/java | ||
The Spring Boot main class, which bootstraps the project, lives under this directory. | |||
The test code is placed under: | The test code is placed under: |
Revision as of 05:42, 10 October 2018
External
- Spring Initializr Reference Guide https://docs.spring.io/initializr/docs/current-SNAPSHOT/reference/htmlsingle/
- Spring Initializr GitHub https://github.com/spring-io/initializr/
- https://start.spring.io/
Internal
Overview
Spring Initializr is a REST API that generates a skeleton Spring project structure, allowing you to customize the build system (Maven or Gradle), the project coordinates, the language and version, the packaging and the dependencies to add to the project. The API can be exposed as a service, and the publicly available default instance for the service, run by Pivotal, is available at https://start.spring.io/.
The API can be used standalone or embedded in other tools:
- With a browser by going to http://start.spring.io
- From command-line with curl
- From command-line using Spring Boot CLI
- From IntelliJ IDEA, with IntelliJ IDEA Plugin for Spring Boot
- From Spring Tool Suite
- From NetBeans
All these tools work by invoking into http://start.spring.io and downloading the project ZIP, which is subsequently expanded in the local workspace.
Spring Project Structure
For both Maven and Gradle-based projects, the source code is placed under:
src/main/java
The Spring Boot main class, which bootstraps the project, lives under this directory.
The test code is placed under:
src/test/java
The non-Java project resources are placed under:
src/main/resources
An empty application.properties file is created and placed under resources. If the application has web dependencies, the resources/static and resources/templates subdirectories are also created. Maven (mvnw, mvnw.cmd) or Gradle (gradlew, gradlew.bat) wrapper scripts are also created, they can be used to build the project even if Maven or Gradle is not installed in the local development environment. More details about Graddle wrapper scripts. For Maven-based project, Spring Initializr generates the Maven build specification pom.xml. For Gradle-based project, Spring Initializr generates the Gradle build specification as a pair of two files:
These contain the dependencies specified on execution, plus a few default ones, like testing support.