Complete the code to define a singleton scoped bean using @Scope.
@Component @Scope([1]) public class MyService {}
The default and most common bean scope is singleton, which means one instance per Spring container.
Complete the code to define a prototype scoped bean using @Scope.
@Component @Scope([1]) public class TaskProcessor {}
The prototype scope creates a new bean instance every time it is requested.
Fix the error in the code to set the bean scope to session.
@Component @Scope([1]) public class UserSession {}
The scope value must be a string literal with quotes, like "session".
Fill both blanks to define a request scoped bean with proxy mode.
@Component @Scope(value = [1], proxyMode = [2]) public class RequestBean {}
Request scope is specified with "request". Proxy mode ScopedProxyMode.TARGET_CLASS creates a class-based proxy to handle the scope properly.
Fill all three blanks to define a session scoped bean with proxy mode and a custom bean name.
@Component("[1]") @Scope(value = [2], proxyMode = [3]) public class SessionBean {}
The bean is named customSessionBean, scoped to "session", with proxy mode ScopedProxyMode.TARGET_CLASS for proper session handling.