blob: 5e8720db130e715e08943e38bb745904d96d8056 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
This project illustrates how a Java class can be made to describe the Spring configuration
where the objects returned by methods in the class are made to be the Spring beans.
The class is annotated with @Configuration which indicates that the primary purpose of the
class is to act as a source of bean definitions.
@Bean is used with a method to indicate that the method instantiates, configures, and
initializes a new object to be managed by the Spring IoC container. It plays the same role
as the <bean/> element.
It is not necessary for the classes from which beans are instantiated to have annotations
like @Component or @Autowired since the @Bean annotated methods perform the configuration.
|