在控制器和Spring集成配置中配置相同的端点
我们有一个rest控制器,其基本路径为/diagnosis,其diff路径配置为diff方法,如下所示在控制器和Spring集成配置中配置相同的端点,spring,spring-integration,Spring,Spring Integration,我们有一个rest控制器,其基本路径为/diagnosis,其diff路径配置为diff方法,如下所示 后/诊断 获取:/diagnosis/{diagnosissid} 放置/诊断 删除:/diagnosis/{diagnosissid} 两个不同的系统正在使用这些端点。现在,我们计划实现两个spring集成,这样我们就可以使用路由器和转换器对两个系统产生两种类型的响应。现在,我正在编写SI配置,并希望在SI中为Post方法/诊断设置相同的端点,并删除控制器中的方法级配置以进行Post。当
- 后/诊断
- 获取:/diagnosis/{diagnosissid}
- 放置/诊断
- 删除:/diagnosis/{diagnosissid}
@RestController
@RequestMapping("/diagnosissurvey")
public class DiagnosisSurveyServiceController {
public ResponseForSfdcAndHybris saveDiagnosis(@RequestBody SurveyLevel submitRequest) {
//some code here
}
@RequestMapping(value = "/questions/{categoryId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseObject getQuestions(@PathVariable String categoryId) throws JsonProcessingException {
//some code here
}
}
SI XML文件:
<int-http:inbound-gateway id="hybrisDiagnosisInboundGateway"
path="/diagnosissurvey"
supported-methods="POST"
request-channel="hybrisDiagnosisInbound"
reply-channel="diagnosisOutBoundToRouter"
request-payload-type="com.cardinalhealth.chh.model.SurveyLevel" >
</int-http:inbound-gateway>
<int:service-activator ref="diagnosisSurveyServiceController" method="saveDiagnosis" input-channel="hybrisDiagnosisInbound" output-channel="diagnosisOutBoundToRouter"/>
*更新了你能发布引发异常的代码吗?@javaguy我已经更新了代码和XML配置。请给我建议解决方案。谢谢你的问题令人困惑;控制器有一个带有子路径的GET方法;您的SI XML在根路径上只有一个POST方法。确切地说,你点击的是哪个URL,使用哪种方法?我点击的是SI和Post方法中的diagnosissurvey