1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 }