내 봄 mvc 프로젝트에서 비 정렬 및 XML 요청의 유효성을 검사하고 마샬링하고 XML 응답의 유효성을 검사합니다. 이제 내 스프링 구성 파일에 내가했던 : 내 컨트롤러에 jaxMarshaller를 주입하고, 비 정렬 화 메서드를 호출 할 때스프링 mvc에서 jax2bMarshaller를 사용하여 자동 정렬/비 정렬 유효성 검사
이@Bean
public MarshallingHttpMessageConverter marshallingMessageConverter() throws Exception {
MarshallingHttpMessageConverter marshallingHttpMessageConverter = new MarshallingHttpMessageConverter();
marshallingHttpMessageConverter.setMarshaller(jaxb2Marshaller());
marshallingHttpMessageConverter.setUnmarshaller(jaxb2Marshaller());
return marshallingHttpMessageConverter;
}
@Bean
public Jaxb2Marshaller jaxb2Marshaller() throws Exception {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setClassesToBeBound(BillDataRequest.class);
marshaller.setSchema(new ClassPathResource("file.xsd"));
marshaller.setValidationEventHandler(new MyValidationEventHandler());
marshaller.afterPropertiesSet();
return marshaller;
}
, 모든 작품. Spring에 요청을 자동으로 언 마샬하고 유효성을 검사하도록 지시하는 방법이 있습니까? 고맙습니다.
답장을 보내 주셔서 감사합니다. 나는 인터셉터가 들어오는 요청에 좋다고 생각하지만, outcoming 메시지에 대해서는 수동으로 응답을 마샬링해야한다. 난 괜찮아? – R3DLINE