Where is the application.properties file in a Spring Boot project?
You can also create the application.properties file manually.
SpringApplication will load properties from application.properties files in the following locations and add them to the Spring Environment:
- A /config subdirectory of the current directory.
- The current directory
- A classpath /config package
- The classpath root
The list is ordered by precedence (properties defined in locations higher in the list override those defined in lower locations). (From the Spring boot features external configuration doc page)
So just go ahead and create it
You will need to add the application.properties
file in your classpath.
If you are using Maven or Gradle, you can just put the file under src/main/resources
.
If you are not using Maven or any other build tools, put that under your src folder and you should be fine.
Then you can just add an entry server.port = xxxx
in the properties file.