JBuilder class文件的 Module引用
2008-01-05 18:16:44 来源:WEB开发网今天写了个Factory Class,用来把interface和实现的class进行组合……以便在业务逻辑中调用……类似这样:
<managers>
<manager id="DbConnectionManager">
<service>tutorial.db.IDbConnectionManager< SPAN>service>
<service-impl>tutorial.db.impl.DbConnectionManagerImpl< SPAN>service-impl>
< SPAN>manager>
<manager id="EmployeeService">
<service>tutorial.service.iface.IEmployeeService< SPAN>service>
<service-impl>tutorial.service.impl.EmployeeServiceImpl< SPAN>service-impl>
< SPAN>manager>
< SPAN>mamagers>
在业务逻辑中,类似下面的调用:
BizFactory bizFactory = new BizFactory();
Employee employee = new Employee();
employee.setEmpNumber("9527");
//...省略...
IEmployeeService empService
= (IEmployeeService) bizFactory.create("EmployeeService");
empService.update(employee);
但是在JBuilder运行的时候,却报告EmployeeServiceImpl.class找不到……郁闷……一看才发现,JBuilder 2005在Make的时候,在${PRoject_Home}/classes中生成了EmployeeServiceImpl.class文件,却并没有把这个文件部署到${Project_Home}/${WebModule_Home}/WEB-INF/classes下面!
分析了半天,难道是IEmployeeService有被显示调用,而EmployeeServiceImpl没有代码显示调用,是通过Factory Class读取config xml来创建的,难道……这就是要害???
翻了半天JBuilder 2005的配置选项,终于让我发现了……见下图,去掉那个默认的选项即可!
更多精彩
赞助商链接