簡體   English   中英

澤西島資源配置和Spring集成http:inbound-gateway

[英]Jersey resource config and Spring integration http:inbound-gateway

我目前正在使用帶有Spring Integration流的Spring Boot項目。 我有以下Spring Integration xml:

<!-- CHANNELS -->
<int:channel id="channelInput"/>
<int:channel id="channelOutput"/>

<int-http:inbound-gateway id="http-inbound-gateway"
                          request-channel="channelInput"
                          reply-channel="channelOutput"
                          supported-methods="GET"
                          path="/urlTest"
                          >
    <int-http:request-mapping consumes="application/json"
                              produces="application/json"/>

</int-http:inbound-gateway>


<int:service-activator input-channel="channelInput"
                       ref="serviceClassImpl"
                       method="testMethod"
                       output-channel="channelOutput">
</int:service-activator>

當我嘗試對localhost:8080 / urlTest進行卷曲時,它給了我404。

后來我注意到我們有一個Jersey資源配置類,在其中我們必須注冊所有@Path注釋定義的路徑,因此我認為404錯誤是因為我沒有在Jersey中注冊該路徑。 但是我不確定,因為我以前從未在澤西島工作過。

@Component
public class ApplicationJerseyConfig extends ResourceConfig {
  public ApplicationJerseyConfig() {
    property(ServletProperties.FILTER_STATIC_CONTENT_REGEX,"/(info|browser/.*|api/(swagger.json|info)?|.*/api-docs.?|console/.*|configuration/.*|.*.html|.*.jpg|.*.gif|.*.png|.*.map|.*.js|.*.css|.*.ttf)?");
    register(TestRest.class);
    }
}

如何在Jersey Resource Config中注冊在網關“ / urlTest”中定義的路徑?

先感謝您。

終於工作了,我只需要將路徑添加到ResourceConfig的ServletProperties.FILTER_STATIC_CONTENT_REGEX中即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM