packagejava.lang.annotation;/** * Indicates how long annotations with the annotated type are to * be retained. If no Retention annotation is present on * an annotation type declaration, the retention policy defaults to * {@code RetentionPolicy.CLASS}. * * <p>A Retention meta-annotation has effect only if the * meta-annotated type is used directly for annotation. It has no * effect if the meta-annotated type is used as a member type in * another annotation type. * * @author Joshua Bloch * @since 1.5 * @jls 9.6.4.2 @Retention */@Documented@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.ANNOTATION_TYPE)public @interfaceRetention {/** * Returns the retention policy. * @return the retention policy */RetentionPolicyvalue();}
packageorg.springframework.stereotype;importjava.lang.annotation.Documented;importjava.lang.annotation.ElementType;importjava.lang.annotation.Retention;importjava.lang.annotation.RetentionPolicy;importjava.lang.annotation.Target;importorg.springframework.core.annotation.AliasFor;/** * Indicates that an annotated class is a "Service", originally defined by Domain-Driven * Design (Evans, 2003) as "an operation offered as an interface that stands alone in the * model, with no encapsulated state." * * <p>May also indicate that a class is a "Business Service Facade" (in the Core J2EE * patterns sense), or something similar. This annotation is a general-purpose stereotype * and individual teams may narrow their semantics and use as appropriate. * * <p>This annotation serves as a specialization of {@link Component @Component}, * allowing for implementation classes to be autodetected through classpath scanning. * * @author Juergen Hoeller * @since 2.5 * @see Component * @see Repository */@Target({ElementType.TYPE})@Retention(RetentionPolicy.RUNTIME)@Documented@Componentpublic @interfaceService {/** * The value may indicate a suggestion for a logical component name, * to be turned into a Spring bean in case of an autodetected component. * @return the suggested component name, if any (or empty String otherwise) */ @AliasFor(annotation =Component.class)Stringvalue()default"";}