Working example of jackson pojo serialization
This commit is contained in:
@@ -2,6 +2,7 @@ package com.release11.klaus.controller;
|
||||
|
||||
|
||||
import com.release11.klaus.model.MockedMessageDto;
|
||||
import com.release11.klaus.model.TestModel;
|
||||
import com.release11.klaus.service.KlausService;
|
||||
import com.release11.klaus.utilis.BusinessKey;
|
||||
import com.release11.klaus.utilis.TrackingClient;
|
||||
@@ -12,15 +13,9 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,6 +29,21 @@ import java.util.UUID;
|
||||
public class KlausController {
|
||||
|
||||
private final KlausService klausService;
|
||||
// MockedMessageDto msg = MockedMessageDto.builder()
|
||||
// .clientUUID(UUID.randomUUID())
|
||||
// .httpStatus(200)
|
||||
// .mediaType("text/xml")
|
||||
// .messageBody("Hello world")
|
||||
// .mockedResponseId(1)
|
||||
// .httpHeaders(new HashMap<>())
|
||||
// .build();
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = "klaus/v1/get/test")
|
||||
public TestModel getTestMessage(){
|
||||
TestModel testModel = new TestModel();
|
||||
return testModel;
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "klaus/v1/delete/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity<String> deleteMockedResponse(@PathVariable UUID clientUUID,
|
||||
|
||||
27
src/main/java/com/release11/klaus/model/TestModel.java
Normal file
27
src/main/java/com/release11/klaus/model/TestModel.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.release11.klaus.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonPropertyOrder({ "name", "lastname" })
|
||||
public class TestModel implements Serializable {
|
||||
private String name = "Jason";
|
||||
private String lastname = "Born";
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLastname() {
|
||||
return lastname;
|
||||
}
|
||||
|
||||
public void setLastname(String lastname) {
|
||||
this.lastname = lastname;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user