Interview Focused : 10 Spring Annotations to Remember

1) @Bean : Annotates java methods to represents bean defintions.
2) @Configurations : Spring will look into the class which is annotated with this for bean defintions.
3) @Autowired : Marks a constructor, field, setter method or config method as to be autowired by Spring’s dependency injection facilities.
4) @PreDestroy: The PreDestroy annotation is used on methods as a callback notification to signal that the instance is in the process of being removed by the container. The method annotated with PreDestroy is typically used to release resources that it has been holding. This annotation MUST be supported by all container managed objects that support PostConstruct except the application client container in Java EE 5.
10 Spring Annotations to Remember
10 Spring Annotations to Remember
5) @PostConstruct :The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization. This method MUST be invoked before the class is put into service. This annotation MUST be supported on all classes that support dependency injection. The method annotated with PostConstruct MUST be invoked even if the class does not request any resources to be injected. Only one method can be annotated with this annotation.
6) @Qualifier : This annotation may be used on a field or parameter as a qualifier for candidate beans when autowiring. It may also be used to annotate other custom annotations that can then in turn be used as qualifiers.
7) @Component : Indicates that an annotated class is a “component”. Such classes are considered as candidates for auto-detection when using annotation-based configuration and classpath scanning.
8) @Repository : Indicates that an annotated class is a “Repository”,may also apply to stereotype DAO classes.
9) @Service : Indicates that an annotated class is a “Service”,May also indicate that a class is a “Business Service Facade”.
10) @Controller : Indicates that an annotated class is a “Controller” (e.g. a web controller).

Comments

Popular posts from this blog

Java Interview : Threads

Spring Framework Interview Notes : Part Two Wiring

Card Dealer In Java in Less than 5 minutes