1. Introduction
In this short article, we will present how to log all system properties on Spring Boot startup.
2. The org.springframework.core.env.Environment
interface
In Spring Boot applications the Environment
is an interface representing the environment in which the current application is running.
We can use that interface to get active profiles and properties of the application environment.
The following code will print all properties from the environment:
Note that the Environment
object could be autowired in Spring Boot components just like other Spring beans.
The following code prints several environment properties on startup:
3. Conclusion
In this short article, we presented how to print all the important environment information on Spring Boot startup.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}