We defined the DAO layer bean in the spring configuration file when we did not write the spring configuration file with annotations.
So we write the Setdao method in the service layer, we can call the DAO layer directly through the interface,
After using the annotation notation, the DAO layer bean is not written in the configuration file.
Only need to include in the DAO implementation class
@Repository
Public Class Testdaoimpl () {}
Private Testdao Testdao;
Join at service level
@service
Public Class Testservice () {}
Write directly in this action
@Autowired
Private Testservice Testservice;
In the action layer join
@Controller
Public Class testaction () {}
You do not need to define an action bean in the configuration file
@requestMapping is the spring-mvc thing,
Before we used struts2, we needed a configuration file to define the name of the action,
To write xxx.do in the browser to access the action method
After using SRPING-MVC, in the action method, add the
@controller
public class Testaction () {
@requestMapping ("Xxx.do")
Public String FindAll () {
.................
}
}
In this way, you do not need struts, directly in the browser input xxx.do can access the FindAll method
Popular explanations of annotations in spring