@Repository represents the warehouse. General annotations on the DAO implementation class, when others look at the code, they know that the class is a class that is related to the data store.
@Service represent the business. General annotations are on the service implementation class. The @Controller represents the controller. General annotations are on the controller class. If your class is not of the above type (data storage class, business class, Controller), you can use @component in general
Spring things are controlled by declarative things and programmed things
The declared thing is configured with XML configuration and annotation two configuration methods.
Annotation configuration
<BeanID= "TransactionManager"class= "Org.springframework.orm.hibernate3.HibernateTransactionManager">
< Propertyname= "Sessionfactory"ref= "Sessionfactory" />
</Bean>
<Context:annotation-config/>
< tx:annotation-driven transaction-manager = "TransactionManager" />
XML Configuration
< Bean class = "Org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >
< Propertyname= "Beannames">
<List>
<value>*service</value>
<value>*dao</value>
</List>
</ Property>
< Propertyname= "Interceptornames">
<List>
<value>Transactioninterceptor</value>
</List>
</ Property>
</Bean>
<BeanID= "Transactioninterceptor"
Class= "Org.springframework.transaction.interceptor.TransactionInterceptor"Autowire= "Default">
< Propertyname= "TransactionManager"ref= "TransactionManager" />
< Propertyname= "Transactionattributes">
<Props>
<propKey="*">Propagation_required</prop>
</Props>
</ Property>
</Bean>
<BeanID= "TransactionManager"
Class= "Org.springframework.orm.hibernate4.HibernateTransactionManager">
< Propertyname= "Sessionfactory"ref= "Sessionfactory" />
</Bean>
Annotations in Spring