I'm having a problem right now, Is it possible to use anotated @Service class from another Maven Spring MVC project? I've already done this step: Build Path -> Configure Path -> Add Project
Now, I'm trying to use some annotated service method from added project.
the following code is my controller class and i want to use CustomerService class method from another project which I already added in configure path.
//this class is from another project
private CustomerService customerService;
public ModelAndView searchCustomer(@RequestParam String lastname) {
CustomerService customerService = this.customerService.findByLastName(lastname);
}
Or is there any alternate way to use annotated Service class from another project?
Thanks in advance..
如果执行此操作,则可以:1.将源Java文件复制到我的新项目中。2.将另一个项目导出到jar中,然后导入到我的新项目中。
Consider breaking your application into web, service and DAL layer into different maven modules like below:-
Above structure gives you enough flexibility to plug out Services (as jar) and include it in any other application
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.