Browse Source

Polish Javadoc for @Scope

pull/816/head
Sam Brannen 11 years ago
parent
commit
0db948e72d
  1. 40
      spring-context/src/main/java/org/springframework/context/annotation/Scope.java

40
spring-context/src/main/java/org/springframework/context/annotation/Scope.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,30 +23,33 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.stereotype.Component;
/** /**
* When used as a type-level annotation in conjunction with the {@link Component} * When used as a type-level annotation in conjunction with
* annotation, indicates the name of a scope to use for instances of the annotated * {@link org.springframework.stereotype.Component @Component},
* type. * {@code @Scope} indicates the name of a scope to use for instances of
* the annotated type.
* *
* <p>When used as a method-level annotation in conjunction with the * <p>When used as a method-level annotation in conjunction with
* {@link Bean} annotation, indicates the name of a scope to use for * {@link Bean @Bean}, {@code @Scope} indicates the name of a scope to use
* the instance returned from the method. * for the instance returned from the method.
* *
* <p>In this context, scope means the lifecycle of an instance, such as * <p>In this context, <em>scope</em> means the lifecycle of an instance,
* {@code singleton}, {@code prototype}, and so forth. Scopes provided out of the box in * such as {@code singleton}, {@code prototype}, and so forth. Scopes
* Spring may be referred to using the {@code SCOPE_*} constants available in * provided out of the box in Spring may be referred to using the
* via {@link ConfigurableBeanFactory} and {@code WebApplicationContext} interfaces. * {@code SCOPE_*} constants available in the {@link ConfigurableBeanFactory}
* and {@code WebApplicationContext} interfaces.
* *
* <p>To register additional custom scopes, see * <p>To register additional custom scopes, see
* {@link org.springframework.beans.factory.config.CustomScopeConfigurer CustomScopeConfigurer}. * {@link org.springframework.beans.factory.config.CustomScopeConfigurer
* CustomScopeConfigurer}.
* *
* @author Mark Fisher * @author Mark Fisher
* @author Chris Beams * @author Chris Beams
* @author Sam Brannen
* @since 2.5 * @since 2.5
* @see Component * @see org.springframework.stereotype.Component
* @see Bean * @see org.springframework.context.annotation.Bean
*/ */
@Target({ElementType.TYPE, ElementType.METHOD}) @Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@ -55,6 +58,7 @@ public @interface Scope {
/** /**
* Specifies the scope to use for the annotated component/bean. * Specifies the scope to use for the annotated component/bean.
* <p>Defaults to {@link ConfigurableBeanFactory#SCOPE_SINGLETON SCOPE_SINGLETON}.
* @see ConfigurableBeanFactory#SCOPE_SINGLETON * @see ConfigurableBeanFactory#SCOPE_SINGLETON
* @see ConfigurableBeanFactory#SCOPE_PROTOTYPE * @see ConfigurableBeanFactory#SCOPE_PROTOTYPE
* @see org.springframework.web.context.WebApplicationContext#SCOPE_REQUEST * @see org.springframework.web.context.WebApplicationContext#SCOPE_REQUEST
@ -65,9 +69,11 @@ public @interface Scope {
/** /**
* Specifies whether a component should be configured as a scoped proxy * Specifies whether a component should be configured as a scoped proxy
* and if so, whether the proxy should be interface-based or subclass-based. * and if so, whether the proxy should be interface-based or subclass-based.
* <p>Defaults to {@link ScopedProxyMode#NO}, indicating that no scoped * <p>Defaults to {@link ScopedProxyMode#DEFAULT}, which typically indicates
* proxy should be created. * that no scoped proxy should be created unless a different default
* has been configured at the component-scan instruction level.
* <p>Analogous to {@code <aop:scoped-proxy/>} support in Spring XML. * <p>Analogous to {@code <aop:scoped-proxy/>} support in Spring XML.
* @see ScopedProxyMode
*/ */
ScopedProxyMode proxyMode() default ScopedProxyMode.DEFAULT; ScopedProxyMode proxyMode() default ScopedProxyMode.DEFAULT;

Loading…
Cancel
Save