This is the same as
Andy Ma's excellent
Struts2 Hibernate example
listed on this site. The same database setup and build.
The differences lie in the XML for the web application and Struts configuration and Java components.
PicoContainer pioneered Constructor Injection, and true to that EmployeeAction now uses
constructor args to receive its dependencies:
public class EmployeeAction extends ActionSupport {
// fields ..
public EmployeeAction(DepartmentService deptService, EmployeeService empService) {
this.deptService = deptService;
this.empService = empService;
}
}
Other components within the web app are similarly changed, and former singleton accessors have been removed.