Convert JSON payload to xml with SpringBoot

I have a controller action written using SpringBoot that handles POST requests for /greeting and returns a String response. My intention is to convert the json payload to xml and eventually hit another webservice with an xml payload. I tried the foll...
more »

2017-04-20 21:04 (3) Answers

Parse Json Java

I have a very weird json response in the following format (with many more attributes): { "foo": [ { "key": "name", "value": "Hans" }, { "key": "lastName", "value": "Peter" ...
more »

2017-04-19 18:04 (1) Answers

Search with Spring Data JPA

I have a domain object Item: Item fields: a, b, c It has a lot more fields in reality. I know I can create methods like: findByAAndB(...) Use @Query(SELECT ... WHERE ...) on my custom find method But I still wonder if there is a better solution:...
more »

2017-04-18 19:04 (2) Answers

Valid XML document must have a root tag

I find stackoverflow with it, and find a post in Android, but I don't think this is fit me. Selector for button error "Valid XML document must have a root tag" My snapshot is below: And my code in spring_datasource.xml: <?xml versi...
more »

2017-04-16 11:04 (1) Answers

Rules due to Annotations with JSON and Spring

I have following JSON object {"type":"success","value":{"id":5,"quote":"Spring Boot solves this problem. It gets rid of XML and wires up common components for me, so I don't have to spend hours scratching my head just to figure out how it's all piec...
more »

2017-04-15 11:04 (0) Answers

EhCache Spring XML integration namespace

I'd like to use EhCache with Spring. I've followed a tutorial which said to add this line to my spring.xml: <ehcache:annotation-driven cache-manager="ehCacheManager" /> The problem is that the ehcache namespace is not present in the tutorial...
more »

2017-04-14 14:04 (1) Answers

Spring Boot Jackson and Data serialization

In my Spring Boot application I use a following DTO with @RestController: public abstract class ComparableQuery extends BaseQuery { private final Object value; ... } Everything works fine but when I use Spring RestTemplate and pass java.uti...
more »

2017-04-13 15:04 (1) Answers

Spring rest json post null values

I have a Spring rest endpoint doing a simple hello app. It should accept a {"name":"something"} and return "Hello, something". My controller is: @RestController public class GreetingController { private static final String template = "Hello, ...
more »

2017-04-12 17:04 (2) Answers

Jackson + Autovalue Builder bean validation

I have a the following Event DTO class: @AutoValue @JsonDeserialize(builder = AutoValue_Event.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class Event { public static Event.Builder builder() { return new Au...
more »

2017-04-12 10:04 (0) Answers

Read Console input on spring boot with tomcat

Is it possible to read console input just before the embedded tomcat on the spring boot starts? The supposedly application flow is, request username and password from the user, and that will be used to be able to start the application. It works when ...
more »

2017-04-10 07:04 (4) Answers

Custom Jackson serialization in library

I'm writing a Spring boot application that uses RestController to expose one resource. The only resource, MainResource, is something like this: String id; String title; List<String> tags; ComplexGraphObject gObject; To make this work I wrote ...
more »

2017-04-09 04:04 (1) Answers

Map json field from child object

Here is the description of issue to convert Json string to json. Address{ private long id; private String city; } Employee{ private long id; private String name; private Address address; } Client will send a request with JSON ...
more »

2017-04-07 13:04 (2) Answers

Spring profile default behaviour

I have a spring profile "DEV" and thats the only profile I have and I do NOT want to create a "production" profile. So only when profile is "DEV" I would like a certain type of bean for spring security is initiated (which is an in memory guest user a...
more »

2017-04-06 12:04 (2) Answers

Spring Boot Controller - Enum parameter as Value

I have a spring boot controller, one of my parameters is an Enum. The enum has a string value. I want to pass as the parameter the value of the enum and the controller to give me the Enum. Can this be done? @RequestMapping(value = "/") public MyRes...
more »

2017-04-06 11:04 (2) Answers

Spring Jackson array instead of List

In my Spring Boot application I have a following @RestController method: @PreAuthorize("isAuthenticated()") @RequestMapping(value = "/{decisionId}/decisions/{childDecisionId}/characteristics/{characteristicId}/values", method = RequestMethod.POST) p...
more »

2017-04-02 13:04 (1) Answers