[英]Intercept a Spring integration http:inbound-gateway's replyChannel
[英]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.