@ -5177,19 +5177,26 @@ the `@RestController` annotation from Spring MVC is __composed__ of `@Controller
@@ -5177,19 +5177,26 @@ the `@RestController` annotation from Spring MVC is __composed__ of `@Controller
In addition, composed annotations may optionally redeclare attributes from
meta-annotations to allow user customization. This can be particularly useful when you
want to only expose a subset of the meta-annotation's attributes. For example, the
following is a custom `@Scope` annotation that hardcodes the scope name to `session` but
still allows customization of the `proxyMode`.
want to only expose a subset of the meta-annotation's attributes. For example, Spring's
`@SessionScope` annotation hardcodes the scope name to `session` but still allows
@ -5200,7 +5207,7 @@ still allows customization of the `proxyMode`.
@@ -5200,7 +5207,7 @@ still allows customization of the `proxyMode`.
----
@Service
**@SessionScope**
public class SessionScopedUserService implements UserService {
public class SessionScopedService {
// ...
}
----
@ -5211,8 +5218,8 @@ Or with an overridden value for the `proxyMode` as follows:
@@ -5211,8 +5218,8 @@ Or with an overridden value for the `proxyMode` as follows:
@ -5610,8 +5616,8 @@ auto-generated names are adequate whenever the container is responsible for wiri
@@ -5610,8 +5616,8 @@ auto-generated names are adequate whenever the container is responsible for wiri
=== Providing a scope for autodetected components
As with Spring-managed components in general, the default and most common scope for
autodetected components is singleton. However, sometimes you need other scopes, which
Spring 2.5 provides with a new `@Scope` annotation. Simply provide the name of the scope
autodetected components is `singleton`. However, sometimes you need a different scope
which can be specified via the `@Scope` annotation. Simply provide the name of the scope
within the annotation:
[source,java,indent=0]
@ -5624,6 +5630,9 @@ within the annotation:
@@ -5624,6 +5630,9 @@ within the annotation:
}
----
For details on web-specific scopes, see <<beans-factory-scopes-other>>.
[NOTE]
====
To provide a custom strategy for scope resolution rather than relying on the
@ -6456,7 +6465,7 @@ link) to our `@Bean` using Java, it would look like the following:
@@ -6456,7 +6465,7 @@ link) to our `@Bean` using Java, it would look like the following: