有可能更改异常映射器选择顺序 - https://issues.apache.org/jira/browse/CXF-6568(使默认异常映射器最不具体,以便使用自定义映射器)。 为每次调用特定jaxrs设置此属性的正确方法是什么:服务器? 我试图添加一个部分:
<jaxrs:properties>
<entry key="default.wae.mapper.least.specific" value="true"/>
</jaxrs:properties>
到jaxrs:服务器配置,但这并没有成功。
答案 0 :(得分:0)
对于那些寻找精确配置的人来说,这对我有用:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<cxf:bus>
<cxf:properties>
<!-- https://issues.apache.org/jira/browse/CXF-6568 -->
<entry key="default.wae.mapper.least.specific" value="true" />
</cxf:properties>
</cxf:bus>
</beans>
答案 1 :(得分:0)
或使用Java Spring配置:
@Bean
public JAXRSServerFactoryBean cxfServer(final Bus cxfBus) {
final JAXRSServerFactoryBean serverFactory = new JAXRSServerFactoryBean();
serverFactory.setBus(cxfBus);
serverFactory.getBus().setProperty("default.wae.mapper.least.specific", true);
...
serverFactory.setAddress("/");
serverFactory.create();
return serverFactory;
}