[英]Reuse a Spring-boot submodule in another non Spring project
I'm working on a multi module spring-boot project to build a REST API. 我正在开发一个多模块spring-boot项目,以构建REST API。 Here is my project structure: 这是我的项目结构:
Everything is working in this project :) 一切都在这个项目中工作:)
In another non Spring project I would like to reuse a service of restControllerB. 在另一个非Spring项目中,我想重用restControllerB的服务。 This service return the result of the request body validation. 该服务返回请求主体验证的结果。 First I try to add the restControllerB.jar as a dependency to this new project... But this jar does not contain its depedencies (who are in the fatJAR "core.jar"). 首先,我尝试将restControllerB.jar添加为对该新项目的依赖项...但是,此jar不包含其依赖项(谁在fatJAR“ core.jar”中)。 When I run the project, I get a lot of ClassNotFoundException. 当我运行项目时,我得到了很多ClassNotFoundException。
How can I manage to reuse this service as a dependency ? 我如何设法重用此服务作为依赖项? I thought to create a validator module which implements the validatorService interface, but I'm not sure if it is the best solution. 我以为要创建一个实现validatorService接口的验证器模块,但是我不确定这是否是最佳解决方案。
After few hours googling, It seems that creating an external librairy is the right choice. 经过几个小时的谷歌搜索,似乎建立外部库房是正确的选择。 I create an external module and add it as a dependecy to restControllerB. 我创建一个外部模块,并将其作为依赖添加到restControllerB中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.