弹簧休息控制器作为罐

时间:2018-09-26 15:50:56

标签: spring rest

我有Spring Rest控制器[HomeController],它可以作为个人战争正常工作。我将此Rest控制器[HomeController]转换为Jar,并添加到lib文件夹下的另一个Web项目[TestWeb]中。我正在尝试从Web项目[TestWeb]调用我的Rest控制器[HomeController]。但是它找不到请求映射并抛出404。在我的TestWeb项目中,      "eventNotification": { "envelopeEvents": [ { "envelopeEventStatusCode": "Completed", "includeDocuments": "true" }, { "envelopeEventStatusCode": "Declined", "includeDocuments": "false" }, { "envelopeEventStatusCode": "Delivered", "includeDocuments": "false" }, { "envelopeEventStatusCode": "Sent", "includeDocuments": "false" }, { "envelopeEventStatusCode": "Voided", "includeDocuments": "false" } ], "recipientEvents": [ { "includeDocuments": "false", "recipientEventStatusCode": "AuthenticationFailed" }, { "includeDocuments": "false", "recipientEventStatusCode": "AutoResponded" }, { "includeDocuments": "false", "recipientEventStatusCode": "Completed" }, { "includeDocuments": "false", "recipientEventStatusCode": "Declined" }, { "includeDocuments": "false", "recipientEventStatusCode": "Delivered" }, { "includeDocuments": "false", "recipientEventStatusCode": "Sent" } ], "url": "{url_here}" } 而且我尝试使用下面的代码直接映射,但得到相同的错误 <context:component-scan base-package="com.test.home.controller" />

如果我错过了任何事情,可以帮我吗?。

谢谢 萨拉瓦南

1 个答案:

答案 0 :(得分:0)

您需要在您的TestWeb配置中导入jar配置。基本上,Test Web容器对控制器一无所知,因为它的spring上下文不同于TestWeb上下文。

有关详细信息,请参见How to import spring-config.xml of one project into spring-config.xml of another project?