Application Project Structure
In this section, you will:
Learn about the project structure of an Across application.
Learn the difference between the Application Descriptor and the Application Module.
Create a simple web controller in the sample application.
File and folder layout
If you created the sample application as described in creating an application you should have the following project layout:
pom.xml src ├── main │ ├── java │ │ └── com │ │ └── example │ │ └── demo │ │ ├── application (1) │ │ └── DemoApplication.java (2) │ └── resources │ │ └── messages │ │ └── demo │ │ └── default.properties (3) │ ├── application.yml (4) │ ├── application-dev.yml (4) │ └── application-prod.yml (4) └── test └── java └── com │ └── example │ └── demo │ └── application (5) └── it └── ITDemoApplication.java (6)
1 | The application package represents the Application Module.
It is currently empty but is the location where you will store Spring components encapsulating your application specific business logic. |
2 | This is the Application Descriptor. |
3 | The default.properties file contains sample message codes used for localisation. |
4 | The different application-*.yml files are YAML files containing configuration settings for your application.
The dev and prod filename segments determine when those settings apply.
The section Application configuration explains these files in more detail. |
5 | Under this package you can place your unit tests. |
6 | The it package is the location to store your integration tests.
The package is outside the application’s package, to avoid scanning of beans that are defined inside the integration tests. |
A more complete project structure example can be found in the Cheat Sheet.