Broadcom conceptsSpring Professional DevelopSpring Boot
2V0-72.22 Spring Boot: what the Spring exam tests
What the Spring Professional Develop exam asks about Spring Boot: auto-configuration and exclusions, property precedence, profiles and Actuator defaults.
3 min read
By default, only the health endpoint is exposed over HTTP and JMX. And command line properties always take precedence over file-based property sources.
01 What does the Spring Professional Develop exam test about Spring Boot?
You use Boot every day, yet a mock question asks which setting wins, and you hesitate. Sort what you know into three areas: auto-configuration, externalized configuration and Actuator.
Three areas of the Spring Boot domain and what to know in each
- Auto-configurationWhat turns it on, what makes it back away, how to exclude it.
- Externalized configurationWhich property source, file or profile wins.
- ActuatorWhich endpoints are exposed and secured by default.
You opt in to auto-configuration with @EnableAutoConfiguration or @SpringBootApplication.
02 How does auto-configuration decide what to set up?
Start with what Boot does for you. Auto-configuration sets up your app from the jar dependencies you add, and your own beans replace parts of it: add a DataSource bean and the embedded database support backs away.
Unwanted classes can be turned off with the exclude attribute of @SpringBootApplication or the spring.autoconfigure.exclude property. Start the app with --debug to log a conditions report of what was applied and why.
Auto-configuration commonly uses @ConditionalOnMissingBean, so your own bean can override its defaults.
03 Which property value wins?
Next, the settings those beans read. Later property sources override earlier ones, and command line properties always beat file-based sources.
Which property source wins, from weakest to strongest
- Non-specific fileapplication.properties
- Profile-specific fileOverrides the non-specific one
- Command line propertyBeats file-based sources
In one location, a .properties file takes precedence over YAML, and with several active profiles the last one wins. If no profile is active, a profile named default is enabled.
Profile-specific files always override non-specific ones.
04 What does Actuator expose and secure by default?
Finally, watch the running app. The health endpoint maps to /actuator/health, and it is the only endpoint exposed over HTTP and JMX by default.
With Spring Security on the classpath and no other SecurityFilterChain bean, auto-configuration secures every actuator other than /health. In exposure settings, exclude takes precedence over include.
Out of the box only health is exposed, so expose other endpoints on purpose.
Summary
- Your own beans, such as a DataSource, make auto-configuration back away.
- Command line properties beat file-based property sources.
- Only the health endpoint is exposed by default.