Spring Quetions Set - 3
Spring Quetions Set - 3
Using the ApplicationContext object in Spring Boot, we can retrieve a list of all the
beans in our application.
The ApplicationContext is responsible for managing the beans and their dependencies.
32. Can we check the environment properties in your Spring boot application
explain how?
Yes, we can check the environment properties in our Spring Boot Application. The
Environment object in a Spring Boot application can be used to check the
environment’s properties.
Configuration settings for the application, includes:
property files
command-line arguments
environment variables
We can get the Environment instance by calling the getEnvironment() method.
33. How to enable debugging log in the spring boot application?
To enable debugging log in Spring Boot Application, follow the below steps:
Add the logging level property to application.properties.
Configure the log pattern to include useful information.
Run the Spring Boot application.
Using the actuator endpoint, the log level can also be changed at runtime.
Curl -X POST \http://localhost:8080/actuator/loggers/<logger-name>
\ -H 'content-type: application/json' \-d '{"configuredLevel": "DEBUG"}'