Recheck for Exam Drill #21 · 12 Oct 2026 · 22 misses from the final review · 45 drills

Recheck #21: the 22 questions you missed on the final review

The final paper came out at 14/24 (58%), short of the 22/24 target. Each miss is below with your pick, the answer and the reason. Before you open the reason, try to say the rule yourself. Then two drill blocks: new wording on the same facts to check you understand them, and the exact 22 again.

14/24
Final paper (12 Oct)
7/13
Weak spots
10/12
Split it (true or false)
10/14
Retry (1 left unanswered)

Five days later, rules you had already fixed slipped

You did the final paper on 12 Oct, five days after the other blocks and without the rules screen open. Six of its ten misses were rules the final review listed as fixed or put on the one-screen list:

This is forgetting, not misreading. The fix is the same rule re-tested after a gap, so do this page today, then do the Check block again in two or three days without looking at the cards.

7 of the 22 were "stopped short"

On seven select-all questions you ticked only true options but left one out: uniform interface, String init(), "hides dependencies", the private method, exclude = X.class, @ImportAutoConfiguration, server.servlet.context-path. Give every option its own yes or no, and don't submit until you've reached the last option.

My drill progress on this page

Order: read the cards and try each "say it first" before opening it → Check: new wording → Retry: the 22. Aim for full marks on both. Then redo Check in 2–3 days.

Drill blockQsLastBestRunsLast done
Loading…

The 22 misses, grouped by rule

FP = final paper, WS = weak spots, SP = split it, RT = retry block.

Lifecycle methods · 3 misses "fixed" rule slipped

Any visibility. void, no parameters, not static. And the order is fixed

FP6 @PreDestroy private void release() on a singleton. What happens when the context closes?
You picked: "Nothing — it must be public" · Answer: release() is called
FP17 Which are invalid @PostConstruct methods?
You picked: static void init(), void init(String s) · Left out: String init()
FP8 InitializingBean + @Bean(initMethod = "warm"). What runs straight after the BPP before-init hooks?
You picked: postProcessAfterInitialization · Answer: afterPropertiesSet()
Say it first: what makes a lifecycle method valid, and what's the init order?

Valid: returns void, takes no parameters, isn't static. Visibility doesn't matter, because Spring calls it by reflection, which can reach private methods. A return value is out, as the JSR-250 spec requires void.

Order: constructor → injection → BPP before-init (where @PostConstruct runs) → afterPropertiesSet() → initMethod → BPP after-init. The two hooks are the bookends: all three init methods sit between them. So "after before-init" is always the next init method, never the other bookend.

Rule: "void, no args, not static, any visibility. Init methods sit between the two BPP bookends: annotation → interface → custom."

Circular dependencies · 4 misses inverted again, as on revision 2

An early reference needs a finished constructor and a singleton cache

FP10 Plain Spring 5. Which cycles start up?
You picked: singletons with constructor injection, prototypes with setter injection (the two that fail) · Answer: singletons with field injection, singletons with setter injection
FP18 Boot 2.7 with defaults. Two singletons inject each other through setters. What happens?
You picked: "Boot injects null into one setter" · Answer: startup fails, reporting a cycle
RT13 Which fixes work for a constructor cycle in Boot 2.7?
You picked: "Nothing — constructor cycles can't be fixed", refactoring · Answer: refactoring, @Lazy on one constructor parameter
RT8 Which statements about fixing cycles are true? (left unanswered)
Answer: @Lazy at an injection point can break a constructor cycle; the property exists only in Boot. Not: the property rescues a constructor cycle; switching a setter cycle to constructors fixes it.
Say it first: why does a setter cycle between singletons start in plain Spring, and a constructor cycle doesn't?

Spring builds A: it calls A's constructor, puts the half-built A in the singleton cache as an early reference, and then injects A's fields. A needs B, so Spring builds B. B needs A, and the cache already holds the early A. Done.

Constructor injection: A's constructor needs B before A exists, and B's constructor needs A. There's no object to cache, so it fails. Prototypes: they're never cached, so there's no early reference either. Fails.

Boot 2.6+ sets spring.main.allow-circular-references=false, so even the setter cycle fails at startup with "The dependencies of some of the beans form a cycle". Spring never injects null silently. @Lazy on one injection point injects a proxy instead of the real bean, so neither constructor waits for the other. That fixes any cycle.

Rule: "Plain Spring: singleton setter/field start; constructor and prototype fail. Boot 2.6+: all fail. @Lazy fixes all. The property only brings the setter case back."

@Autowired · 2 misses on the rules screen

One attribute. And the qualifier narrows before @Primary gets a say

FP13 Which compile as written?
You also ticked: @Autowired(name = "x") · Answer: @Autowired @Qualifier("x"), @Autowired(required = false)
FP24 stripe (@Primary) and paypal. Field: @Autowired @Qualifier("paypal") Gateway g;
You picked: stripe — @Primary always wins · Answer: paypal
Say it first: what does Spring do, step by step, to choose a bean for an @Autowired field?

1. Find every bean of the type. 2. If there's a @Qualifier, keep only the matches. 3. If more than one is left, pick the @Primary. 4. Otherwise match the field or parameter name. 5. Otherwise throw NoUniqueBeanDefinitionException.

In FP24 the qualifier left only paypal, so @Primary never came into it. @Primary is a tie-breaker. It doesn't override an explicit choice.

@Autowired has exactly one attribute, required. Naming a bean is @Qualifier's job (or @Resource(name = …), which is a different annotation).

Rule: "Type → Qualifier → Primary → name → fail. @Autowired(required) and nothing else."

Auto-config in tests · 3 misses "fixed" rule slipped

Auto-config only enters through three annotations, wherever they sit

FP1 A @WebMvcTest also needs MetricsClientAutoConfiguration. Best way to add it?
You picked: "Switch to @SpringBootTest" · Answer: @ImportAutoConfiguration(MetricsClientAutoConfiguration.class)
RT3 Which bring auto-configuration into a context?
You picked: @SpringBootApplication, @EnableAutoConfiguration · Left out: @ImportAutoConfiguration
WS6 @ContextConfiguration(classes = MyApp.class), where MyApp has @SpringBootApplication. Is auto-config loaded?
You picked: "No — @ContextConfiguration switches auto-config off" · Answer: Yes, because MyApp's @SpringBootApplication brings it in
Say it first: why is @SpringBootTest the wrong answer for FP1, and why is WS6 a yes?

FP1: "best way" means keep the slice. @SpringBootTest loads the whole application, which gives up the reason for using @WebMvcTest (a small, fast context). @ImportAutoConfiguration adds exactly one auto-config class to the slice. It's the same annotation the slices use internally.

WS6: @ContextConfiguration neither adds nor blocks anything. It loads the classes you give it, and Spring processes their annotations. MyApp carries @SpringBootApplication, which contains @EnableAutoConfiguration, so auto-config comes in. Give it a plain @Configuration class and nothing comes in.

Rule: "Auto-config enters through @EnableAutoConfiguration, @SpringBootApplication, @ImportAutoConfiguration, and only those. Add one to a slice with @ImportAutoConfiguration."

Excluding auto-config · 4 misses exclusions again

Class present → all three switches. Class missing → strings only

WS4 Which is a real difference between exclude and excludeName?
You picked: "None — they're aliases" · Answer: exclude needs the class at compile time; excludeName doesn't
WS12 JacksonAutoConfiguration is on the classpath. Which remove it?
You picked: the property, excludeName · Left out: exclude = JacksonAutoConfiguration.class
SP4 "exclude = DataSourceAutoConfiguration.class works when the class is on the classpath."
You picked: False · Answer: True
WS10 When are auto-config classes processed, relative to your own @Configuration?
You picked: "Before component scanning starts" · Answer: after them, so @ConditionalOnMissingBean can see your beans and back off
Say it first: when does exclude = X.class work, and when doesn't it?

WS12 and SP4 show a new mix-up: you've started to think the .class form doesn't work at all. It works fine, and it's the most common form. The only problem is that a .class literal must compile, so it fails only when the class isn't on the classpath.

So they aren't aliases: exclude is Class<?>[] and excludeName is String[]. They do the same job when the class is present, but only the string survives a missing jar.

Timing: Boot imports auto-config with a deferred import selector, so it's processed after all your configuration. That's the whole point: @ConditionalOnMissingBean can see that you defined a DataSource and back off.

Rule: "Is the class missing? No → exclude, excludeName, property all work. Yes → strings only. Auto-config runs last so it can back off."

server.* properties · 2 misses

server.servlet.context-path is real

SP3 "server.servlet.context-path is a real Spring Boot property."
You picked: False · Answer: True
RT4 Real Boot 2.5 properties?
You picked: server.tomcat.connection-timeout, server.port · Left out: server.servlet.context-path
Say it first: what does server.servlet.context-path do?

It sets the URL prefix for the whole app: server.servlet.context-path=/shop serves /orders at http://host:8080/shop/orders. It sits under server.servlet. because the context path is a servlet concept (servlet stacks only; WebFlux uses spring.webflux.base-path). You got it right on weak spots Q2 and then doubted it twice. Trust it.

Rule: "Embedded-server settings live under server.: server.port, server.servlet.context-path, server.<tomcat|jetty>.…."

BPP / BFPP · 1 miss

"Before Instantiation" still gets a class, not definitions

WS13 Which hook receives bean definitions?
You picked: postProcessBeforeInstantiation · Answer: postProcessBeanFactory
Say it first: what does each hook receive?

postProcessBeanFactory(ConfigurableListableBeanFactory): the factory, which holds all the definitions. It runs before any bean is created.

postProcessBeforeInstantiation(Class<?>, String) (on InstantiationAwareBeanPostProcessor): one bean's class, just before its constructor runs. postProcessBefore/AfterInitialization(Object, String): a built bean.

Last time "Before" tricked you, and this time it was "Instantiation". Don't go by those words. Look for BeanFactory in the name.

Rule: "Definitions = the one with BeanFactory in its name. Every BPP method gets a single bean (or its class)."

Silent proxy cases · 1 miss

F-P-S: three letters, check all three

WS11 A CGLIB-proxied @Service. Which @Transactional calls silently run without a transaction?
You picked: this.save(), the final method · Left out: the private method
Say it first: why does each of F, P and S slip past the proxy?

Final: CGLIB can't override it, so the call goes straight to the original code. Private: it isn't visible to a subclass, so it can't be overridden either. Self-call: this is the real object, not the proxy. All three start up fine, and the advice just doesn't run.

Rule: "Silent = Final, Private, Self-call. Count to three before you submit."

Field injection, REST · 2 misses

Two lists you stopped one item short on

FP11 Genuine reasons to avoid field injection?
You picked: harder to unit-test, bypasses encapsulation · Left out: it hides the class's dependencies
FP16 Which are REST architectural constraints?
You picked: Cacheable, Stateless · Left out: Uniform interface
Say it first: the three costs of field injection, and the six REST constraints

Field injection: there's no constructor listing what the class needs, so its dependencies are hidden. Spring sets private fields by reflection, which bypasses encapsulation. And you can't just call new in a unit test, so it's harder to test. Its one advantage is that it's short and easy to read.

REST ("Cool Students Can Use Lazy Code"): Client-server, Stateless, Cacheable, Uniform interface, Layered system, Code on demand (optional). Uniform interface = URIs + representations + self-descriptive messages + HATEOAS.

Rule: "Field injection: hidden, unencapsulated, hard to test. REST: C-S-C-U-L-C."

Check: same facts, new wording

One or two questions for each miss, none worded the way you've seen. If you understand the rule and haven't just memorised the answer, these should all be right. Do this block again in 2–3 days.

Retry: the 22, exact wording

The 22 questions you missed on the final review, reshuffled. Give every option a yes or no before you submit.

After this page

Full marks on both blocks means the 22 are understood. Redo Check: new wording in 2–3 days without reading the cards. If it's still full marks then, the rules have stuck, and the next step is a fresh practice exam. Paste this page if anything slips, and I'll target what's left.

← Dashboard ← Final review Revision 3 Review #21