티스토리 뷰
728x90
jaxb 사용해서 xml을 http body로 떨구어줄 때
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
해당 태그를 없애는 방법
Jaxb2RootElementHttpMessageConverter의 하위 클래스를 직접 생성하고 마샬러를 사용자 정의한다.
@Configuration
class XmlConfiguration {
@Bean
Jaxb2RootElementHttpMessageConverter jaxb2RootElementHttpMessageConverter() {
return new Jaxb2RootElementHttpMessageConverter() {
@Override
@SneakyThrows
protected void customizeMarshaller(Marshaller marshaller) {
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
}
};
}
}
참고
https://stackoverflow.com/questions/18050314/how-to-remove-xml-header-for-spring-mvc-responsebody
728x90
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 북리뷰
- LocalDate
- Spring
- Kotlin
- input
- Spring Security
- mybatis
- config-location
- Github Status
- springboot
- oracle
- JavaScript
- elasticsearch
- jQuery
- 오라클
- Linux
- docker
- svn
- maven
- LocalDateTime
- Bash tab
- 베리 심플
- window
- intellij
- Mac
- 프로페셔널 스튜던트
- Java
- localtime
- rocky
- mybatis config
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함