MockCertMockCert
Menu

Test yourself in exam conditions

A full Spring Certified Professional mock exam: 60 questions in 130 minutes, scored against the real exam's pass mark. Your first one is free.

Start a free mock exam
Domain 6 · 3 topics · about 17 minTopics in this domainTopics

Domain 6 · Overview

Overview

Up next: Spring Boot Feature Introduction · 9 steps + check · 5 min

Domain 6 · Topic 1 of 3

Spring Boot Feature Introduction

Step 1 of 9

Think first How does Spring Boot decide which value wins when the same property is set in several places?

Why it matters: Questions describe a configuration setup and ask which property value, profile or file the application ends up using.

Spring Boot reads properties from many sources in a fixed order. Later sources override earlier ones, so the order decides the winning value. Profiles add another layer of override on top.

Step 2 of 9

Term Meaning
PropertySource order The fixed order in which Spring Boot reads property sources; later ones override earlier ones.
Profile A name you list in spring.profiles.active to make it active; its profile-specific files override the non-specific ones.
Default profile The profile named default that Spring Boot enables when no other profile is active.
Property placeholder A ${...} reference to a property that can carry a default value after a colon.

Step 3 of 9

Later property sources override earlier ones. Spring Boot reads its property sources in a set order built for sensible overriding. A value passed on the command line wins over the same key in any configuration file.

Exam trap A value in application.properties does not beat a command line argument. Values from the command line always outrank values from files.

Step 4 of 9

In the same location, .properties beats YAML. YAML works whenever SnakeYAML is on the classpath, and spring-boot-starter brings it in when you use starters. You cannot load YAML files with @PropertySource or @TestPropertySource.

Exam trap Adding a YAML file beside a .properties file with the same key does not change the value. The .properties file wins.

Step 5 of 9

spring.profiles.active sets the active profiles. With nothing active, Spring Boot enables a profile named default, which spring.profiles.default can rename. To add profiles without replacing the active ones, use spring.profiles.include.

The three profile properties compared

Feature spring.profiles.active spring.profiles.default spring.profiles.include
Purpose Names the active profiles Names the fallback profile Adds more active profiles
Used when You choose which profiles run No profile is active You extend the active list instead of replacing it

Step 6 of 9

Profile-specific files override the non-specific ones. They load from the same locations as application.properties. When several profiles are active, the last one wins. Keep spring.profiles.active and spring.profiles.default in non-profile-specific documents.

Exam trap Setting spring.profiles.active inside a profile-specific document is not allowed. It belongs only in non-profile-specific documents.

Step 7 of 9

spring.config.name renames the application file. spring.config.location replaces the default locations instead of adding to them. By default, a named location that does not exist throws ConfigDataLocationNotFoundException, and the application does not start.

Exam trap Pointing spring.config.location at a folder does not add it to the defaults. The locations you set replace the default ones.

Step 8 of 9

A colon in a placeholder sets its default value. Write the property name, then a colon, then the default, as in ${name:default}.

Step 9 of 9

  • Later property sources override earlier ones, and command line properties always beat files.
  • In one location, a .properties file wins over a YAML file.
  • spring.profiles.include adds profiles; it never replaces the ones spring.profiles.active sets.
  • By default, a missing config location stops startup with ConfigDataLocationNotFoundException.

Sources: Externalized Configuration :: Spring Boot (opens in a new tab) · Profiles :: Spring Boot (opens in a new tab)

Check

Check: Spring Boot Feature Introduction

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Spring Boot Properties and Autoconfiguration · 9 steps + check · 5 min

Domain 6 · Topic 2 of 3

Spring Boot Properties and Autoconfiguration

Step 1 of 9

Think first How does Spring Boot decide what to configure for you, and how do you take back control when its choice is wrong?

Why it matters: Questions show a Boot application and ask what auto-configuration applies, how to exclude it, or how your own beans override it.

Auto-configuration looks at the jars on your classpath and configures beans to match. Its classes are standard @Configuration classes. Define your own bean and the default backs away; exclude a class when you do not want it at all.

Step 2 of 9

Term Meaning
Auto-configuration Boot configuring your application from the jar dependencies you have added.
@AutoConfiguration The annotation on auto-configuration classes; it is meta-annotated with @Configuration.
@ConditionalOnMissingBean A condition commonly placed on auto-configuration so you can override its defaults when they do not suit you.
Conditions report A log of which auto-configuration applied and why, printed with --debug.

Step 3 of 9

Add @SpringBootApplication or @EnableAutoConfiguration once. Put one of them on a @Configuration class, ideally your primary one. Add only one such annotation in the whole application.

Exam trap Adding @EnableAutoConfiguration to several configuration classes is not recommended. Use exactly one, preferably on the primary class.

Step 4 of 9

Boot configures beans from the jars you have added. For example, with HSQLDB on the classpath and no connection beans of your own, Boot sets up an in-memory database. A jar lists its candidates, one class name per line, in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports.

Step 5 of 9

Define your own bean and that part of auto-configuration backs away. Add your own DataSource bean, and the embedded database support steps aside. This works because defaults are commonly guarded with @ConditionalOnMissingBean.

Exam trap You do not need to exclude an auto-configuration just to replace one bean. Defining your own bean is enough for the default to back away.

Step 6 of 9

Use the exclude attribute to switch off unwanted classes. When the class is not on the classpath, use excludeName with its fully qualified name. The spring.autoconfigure.exclude property controls the same list from configuration.

Three ways to exclude an auto-configuration class

Option Where you set it When to use it
exclude On @SpringBootApplication The class is on the classpath
excludeName On the annotation, as a fully qualified name The class is not on the classpath
spring.autoconfigure.exclude As a property You prefer to control the list by property

Step 7 of 9

Use bean conditions only on auto-configuration classes. Those classes load after user-defined bean definitions, so @ConditionalOnBean and @ConditionalOnMissingBean see your beans. @ConditionalOnProperty checks an Environment property named by prefix and name. Order classes with before and after, or @AutoConfigureBefore and @AutoConfigureAfter.

Step 8 of 9

Start with --debug to log the conditions report. The report shows which auto-configuration is applied and why. If you write a starter with configuration keys, give them a unique namespace, never server, management or spring.

Step 9 of 9

  • Auto-configuration reacts to the jar dependencies on your classpath.
  • Your own bean, such as a DataSource, makes the matching default back away.
  • Exclude classes with exclude, excludeName or spring.autoconfigure.exclude.
  • Run with --debug to see the conditions report.

Sources: Auto-configuration :: Spring Boot (opens in a new tab) · Creating Your Own Auto-configuration :: Spring Boot (opens in a new tab)

Check

Check: Spring Boot Properties and Autoconfiguration

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Spring Boot Actuator · 11 steps + check · 6 min

Domain 6 · Topic 3 of 3

Spring Boot Actuator

Step 1 of 11

Think first How would you decide which Actuator endpoints to expose, who may call them, and what custom data they report?

Why it matters: Questions describe an Actuator setup and ask what is exposed, who can reach it, or how to add custom metrics and health checks.

Out of the box, only health is exposed over HTTP and JMX, and access to every endpoint except shutdown and heapdump is unrestricted. With Spring Security on the classpath and no SecurityFilterChain bean of your own, every actuator except /health is secured. You extend Actuator with your own meters and health indicators.

Step 2 of 11

Term Meaning
Exposure Whether an endpoint is published over HTTP or JMX, set with include and exclude lists.
Base path The URL prefix for management endpoints, /actuator by default.
MeterRegistry The Spring-managed registry you inject to register custom metrics.
HealthIndicator An interface a bean implements to add its own health information.

Step 3 of 11

Only health is exposed by default. This applies over both HTTP and JMX. Over HTTP, the endpoint ID follows the /actuator prefix, so health answers at /actuator/health. Access is a separate setting: every endpoint except shutdown and heapdump is unrestricted by default.

Exam trap Unrestricted access is not the same as exposure. An endpoint can allow access and still not be published over HTTP until you include it.

Step 4 of 11

exclude wins over include. The include list names endpoints to expose, and the exclude list names endpoints to hide. Use * to select every endpoint. If an ID appears in both lists, it stays hidden.

Settings that shape how endpoints are reached

Setting What it does Example use
include Lists endpoint IDs to expose * to expose every endpoint
exclude Lists endpoint IDs to hide; beats include Hide one ID that * selected
management.endpoints.web.base-path Changes the management URL prefix Replace the /actuator prefix
Per-endpoint access property Sets permitted access for that endpoint Limit access to a single endpoint

Exam trap Putting an ID in both lists does not expose it. The exclude list takes precedence.

Step 5 of 11

Set the management port to -1 to stop HTTP exposure. Use this when you want no endpoints reachable over HTTP at all. Changing the base path only moves the endpoints to a new prefix; it does not hide them.

Step 6 of 11

With Spring Security present, every actuator except /health is secured. This holds while no other SecurityFilterChain bean exists. Define your own SecurityFilterChain and auto-configuration backs off, leaving the rules to you. Inside it, EndpointRequest.toAnyEndpoint() matches a request to any endpoint.

Step 7 of 11

POST, PUT and DELETE endpoints get 403 by default. Spring Boot keeps Spring Security's defaults, so CSRF protection is on. That blocks write calls such as shutdown and loggers under the default configuration.

Exam trap A 403 from shutdown under default security is CSRF protection at work. It is not a sign that the endpoint is missing.

Step 8 of 11

With no roles set, any authenticated user is authorized. That is the default for the health endpoint. To restrict who sees it, set management.endpoint.health.roles.

Step 9 of 11

Inject the Spring-managed MeterRegistry to add metrics. Avoid the static methods on Metrics. They use a global registry that Spring does not manage. When your metrics depend on other beans, register them with a MeterBinder instead.

Exam trap Static Metrics methods compile and run, but they register meters in a global registry outside Spring's control.

Step 10 of 11

Register a bean that implements HealthIndicator. Implement its health() method and return a Health response. The response should carry a status and may add extra details for display.

Step 11 of 11

  • Only health is exposed by default, over HTTP and JMX alike.
  • In exposure settings, exclude beats include, and * selects every endpoint.
  • Defining your own SecurityFilterChain makes Spring Boot's actuator security back off.
  • Register meters on the injected MeterRegistry, or use a MeterBinder when they need other beans.

Sources: Endpoints :: Spring Boot (opens in a new tab) · Metrics :: Spring Boot (opens in a new tab) · Monitoring and Management Over HTTP :: Spring Boot (opens in a new tab)

Check

Check: Spring Boot Actuator

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Domain 6 · after the last topic

Domain 6 review

Each topic's Check tested it on its own; this mixes them.

Mixed quiz

Take the Domain 6 quiz

9 questions mixed from every topic in this domain, each answer explained. Mixing topics is harder than one at a time, and it is what the exam does. No account needed; with a free account your answers also build your estimated exam score.

Flashcards

Domain 6 flashcards

6 cards with this domain's key facts. Flip each one and check what you knew. No account needed.

Test yourself in exam conditions

A full Spring Certified Professional mock exam: 60 questions in 130 minutes, scored against the real exam's pass mark. Your first one is free.

Start a free mock exam
All domains studiedTry a timed mock exam

Report a problem

On “”. Tell us what looks wrong; we read every report.

What is the problem?

Optional.