The Properties file in Spring Boot

Spring Boot manages a properties file to carry general application settings.

Where is the application.properties file located?

The properties file is located in the src/main/resources folder of our application.

Property File

This file allows us to configure Spring and define our own configurations for our application.

There are a large number of properties that can be set, we can see a list here. Note that there are sixteen categories that classify the properties, ranging from Sprint core, through data configurations to testing. through data configurations to testing.

An example of our properties file might look like this:

Property File

In this application.properties file we are using the properties already defined by Spring to give a name to our application, change the port it runs on and give it database settings. give a name to our application, change the port on which it runs and indicate database configurations.

The use of a property file in YAML format

YAML is a syntax format that also serves to store properties in a hierarchical format.

For example, if we take the above properties to a YAML format, our application.yml file would look like this:

Property File YML

Conclusion

A properties file in Spring Boot allows us to configure aspects of the application and set its own parameters. and set its own parameters. We have two formats of properties, the flat .properties and the .yml that give a hierarchical format.

If you wish to send me any corrections or suggestions, please contact me.
Thanks for your feedback :)

See also