在其他应用程序(Struts2)中使用 spring boot jar 作为依赖项

时间:2021-03-04 12:41:41

标签: spring-boot struts2

我在 spring boot 中有一个项目,它在其他 struts2 应用程序中用作 jar 依赖项。我正在使用 Maven 程序集插件创建具有 Spring Boot 应用程序所有依赖项的 jar。

当我在其他应用程序(Struts 应用程序)中使用该 jar 作为依赖项时。代码编译成功。

但是当我运行它时,由于注释不能正常工作,我得到空指针异常。

例如:我在控制器中有自动装配的服务,但没有创建服务对象,并且它为空。

任何建议将不胜感激。

注意 - 生成的 Jar 中包含所有必需的 spring 依赖项。

Please find below explanation, code snippet and error present in images:
    [Explanation][1]-https://i.stack.imgur.com/D2zCc.png
    [TestAction.java][2]-https://i.stack.imgur.com/TpuRA.png
    [AuthController.java][3]-https://i.stack.imgur.com/FUnFx.png
    [AuthService.java][4]- https://i.stack.imgur.com/XfZ8N.png

0 个答案:

没有答案