return type xml sample add

dev
Lim Jonguk 3 years ago
parent 2fa68151d0
commit e93548c493

@ -76,7 +76,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
// yaml lib
implementation 'net.rakugakibox.util:yaml-resource-bundle:1.1'
implementation 'net.rakugakibox.util:yaml-resource-bundle:1.2'
// spring-boot 2.3 - spring-boot-starter-web
// hibernate-validator:5.2.4.Final
@ -116,23 +116,23 @@ dependencies {
//compileOnly 'com.querydsl:querydsl-apt'
// JPA mapstruct : lombok - lombok
implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
implementation 'org.projectlombok:lombok'
implementation 'org.mapstruct:mapstruct:1.4.2.Final'
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
// implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
// implementation 'org.projectlombok:lombok'
// implementation 'org.mapstruct:mapstruct:1.4.2.Final'
// annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
// annotationProcessor 'org.projectlombok:lombok'
// annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
// JPA mapstruct : lombok - mapstruct
// target class @Builder + setter Mapper Generation
// @NoArgsConstructor, @Setter
// but, Setter mapstruct @Builder Generation
// implementation 'org.mapstruct:mapstruct:1.4.2.Final'
// implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
// implementation 'org.projectlombok:lombok'
// annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
// annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
// annotationProcessor 'org.projectlombok:lombok'
implementation 'org.mapstruct:mapstruct:1.4.2.Final'
implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
implementation 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
annotationProcessor 'org.projectlombok:lombok'
//-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------//
@ -212,6 +212,7 @@ dependencies {
implementation 'com.fasterxml.jackson.module:jackson-module-afterburner:2.13.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.13.1'
implementation 'javax.xml.bind:jaxb-api:2.3.1'
//implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5'
//-----------------------------------------------------------------------------------//

@ -11,19 +11,12 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.*;
import static java.util.stream.Collectors.toMap;
@Schema(name = "RestError", description = "Restful API 에러", implementation = IRestResponse.class)
@JacksonXmlRootElement(localName = "result")
@XmlRootElement(name = "result")
@Slf4j
@Getter
@Builder

@ -14,7 +14,6 @@ import org.springframework.data.domain.Page;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
@ -23,7 +22,6 @@ import java.util.Map;
@Schema(name = "RestResult", description = "Restful API 결과", implementation = IRestResponse.class)
@Getter @Setter
@JacksonXmlRootElement(localName = "result")
@XmlRootElement(name = "result")
@SuppressWarnings("rawtypes")
public class RestResponse<T> implements IRestResponse, Serializable {
private static final long SerialVersionUID = 1L;

@ -17,6 +17,7 @@ import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.mapstruct.factory.Mappers;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -38,11 +39,16 @@ public class UserController {
private CmmUserMapstruct mapstruct = Mappers.getMapper(CmmUserMapstruct.class);
@Operation(summary = "회원 가입" , description = "신규 회원 등록")
@PostMapping("/signup") // @Valid
@PostMapping(value = "/signup", consumes = MediaType.APPLICATION_JSON_VALUE) // @Valid
public ResponseEntity<? extends IRestResponse> signup(@RequestBody @Valid final CmmUserDto cmmUserDto) {
return RestResponse.of(userService.signup(mapstruct.toEntity(cmmUserDto)));
}
@Operation(summary = "회원 가입" , description = "신규 회원 등록- result xml return")
@PostMapping(value = "/signupXml", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = MediaType.APPLICATION_XML_VALUE) // @Valid
public ResponseEntity<? extends IRestResponse> signupXml(@RequestBody @Valid final CmmUserDto cmmUserDto) {
return RestResponse.of(userService.signup(mapstruct.toEntity(cmmUserDto)));
}
@GetMapping
public ResponseEntity<? extends IRestResponse> getUser(HttpServletRequest request) {

Loading…
Cancel
Save