01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.stereotype;
18:
19: import java.lang.annotation.Documented;
20: import java.lang.annotation.ElementType;
21: import java.lang.annotation.Retention;
22: import java.lang.annotation.RetentionPolicy;
23: import java.lang.annotation.Target;
24:
25: /**
26: * Indicates that an annotated class is a "Repository" (or "DAO").
27: *
28: * <p>A class thus annotated is eligible for Spring
29: * {@link org.springframework.dao.DataAccessException} translation. The
30: * annotated class is also clarified as to its role in the overall
31: * application architecture for the purpose of tools, aspects, etc.
32: *
33: * <p>As of Spring 2.5, this annotation also serves as a specialization
34: * of {@link Component @Component}, allowing for implementation classes
35: * to be autodetected through classpath scanning.
36: *
37: * @author Rod Johnson
38: * @author Juergen Hoeller
39: * @since 2.0
40: * @see Component
41: * @see org.springframework.context.annotation.ClassPathBeanDefinitionScanner
42: */
43: @Target({ElementType.TYPE})
44: @Retention(RetentionPolicy.RUNTIME)
45: @Documented
46: @Component
47: public @interface Repository {
48:
49: /**
50: * The value may indicate a suggestion for a logical component name,
51: * to be turned into a Spring bean in case of an autodetected component.
52: * @return the suggested component name, if any
53: */
54: String value() default "";
55:
56: }
|