我想开发一个web服务春季配置PayloadValidatingInterceptor并遵循本教程https://spring.io/guides/gs/producing-web-service/如何使用注释
项目结构(与配置类的名字),如提及教程相同。 我想要做所有可能的配置使用注释,并希望避免所有基于xml的配置。到目前为止,我甚至通过使用java配置来避免applicationContext.xml和web.xml。不过,现在我要介绍的XSD验证如本教程:
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<ref bean="validatingInterceptor"/>
</list>
</property>
</bean>
<bean id="validatingInterceptor" class="com.test.ValidationInterceptor ">
<property name="schema" value="/jaxb/test.xsd"/>
</bean>
:
http://stack-over-flow.blogspot.com/2012/03/spring-ws-schema-validation-using.html通过扩展在本教学中PayloadValidatingInterceptor class.As即该自定义验证拦截器则需要使用下面的xml配置注册
但是,我不是起诉如何使用注释来完成上述配置。即将XSD文件设置为拦截器。我尝试覆盖WsConfigurerAdaptor类的“addInterceptor”来注册拦截器。请让我知道我是否需要这样做,或者使用注释做整个事情的正确方法是什么。