Skip to content
Sharp

Spring Core · interview question

Why might you choose to use an interface-based proxy over a CGLIB-based proxy in Spring?

Multiple choiceMediumchapter-9-curatedpremiumspring-coretransactions-and-proxies
Choose one answer
Answer and explanation

Correct answer

D. To avoid needing a default constructor

Why

CGLIB proxies require a default constructor as they subclass the class. Interface-based proxies do not need this and can be used when the default constructor is unavailable or undesirable.

Test yourself on Spring Core

A free test with instant, explained results. No account needed.

Start free test
All Spring Core questions →