0

In struts2 i almost did not use any xml configs and used much of annotations for MVC. I build a small application in that way using struts2. Now i want to develop same project using spring 3.2. Now i want to use annotation to create beans and request mapping (this i used). I want a clear example of using bean annotations and is it possible to set properties using annotations. I am getting confused because the documentation is too large, and many annotations. providing a simple list of annotations and their usage with simple example will be a great help.

bytecode77
  • 14,163
  • 30
  • 110
  • 141
Aadam
  • 1,521
  • 9
  • 30
  • 60

1 Answers1

1

Iam doing sample project on Spring 3.1. I have used some annotations to create beans.Below are the annotations i have used. @Component - Annotation used to create a bean given by Spring @Resource,@Bean JSR Annotations: @Controller,@Repository, @Service

If you are annotating your class with above annotations Spring Container will create beans for you.

Your properties will be set with help of @Autowired annotation.

asyard
  • 1,743
  • 5
  • 21
  • 43
Renukeswar
  • 567
  • 1
  • 6
  • 14
  • thanks for your answer. I would like to know if, spring creates singletons automatically for @Bean annotated classes or we have to register those classes some where? – Aadam May 08 '13 at 14:48