View Javadoc

1   /*
2    Spring-Annotation, an easy way to configre Spring-Framework without all that XML.
3    Copyright (C) 2007 Rodrigo Urubatan Ferreira Jardim (http://www.urubatan.com.br)
4   
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9   
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14  
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library; if not, write to the Free Software
17   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18  
19   <a href="http://www.gnu.org/licenses/lgpl.html">http://www.gnu.org/licenses/lgpl.html</a>
20   */
21  package net.sourceforge.sannotations.annotation;
22  
23  import java.lang.annotation.Documented;
24  import java.lang.annotation.ElementType;
25  import java.lang.annotation.Retention;
26  import java.lang.annotation.RetentionPolicy;
27  import java.lang.annotation.Target;
28  import org.springframework.beans.factory.annotation.Autowire;
29  
30  @Retention(RetentionPolicy.RUNTIME)
31  @Target( { ElementType.TYPE, ElementType.PACKAGE })
32  @Documented
33  /*** 
34   * Annotation for registering a bean in the applicationContext
35   */
36  public @interface Bean {
37  	/***
38  	 * The name for the Bean
39  	 */
40  	String name() default "";
41  
42  	/***
43  	 * if it is a singleton or not
44  	 */
45  	boolean singleton() default true;
46  
47  	/***
48  	 * if this bean must be eager or lazy loaded
49  	 */
50  	boolean lazy() default false;
51  
52  	/***
53  	 * the autowire behaior to use, default is autowire by name
54  	 */
55  	Autowire autoWire() default Autowire.BY_NAME;
56  
57  	/***
58  	 * should the bean factory check for all the dependencies before instantiating a bean?
59  	 */
60  	boolean dependencyCheck() default false;
61  
62  	/***
63  	 * the initialization method for this bean.
64  	 */
65  	String initMethod() default "";
66  
67  	/***
68  	 * the destruction method for this bean.
69  	 */
70  	String destroyMethod() default "";
71  
72  	/***
73  	 * if this is a factory bean, this is the method that will return an instance of the bean
74  	 */
75  	String factoryMethod() default "";
76  
77  	/***
78  	 * the scope that will hold instances of this bean, does not use with the singleton property
79  	 */
80  	Scope scope() default Scope.DEFAULT;
81  
82  	/***
83  	 * the scope that will hold instances of this bean, does not use with the singleton property or the scope property
84  	 */
85  	String scopeName() default "";
86  }