How can i make this work ? I look at the other questions but i cant figure it out how. Actually i dont know much about jackson. Maybe the "lombok" is cause the problem. thank you in advance.
@Data class A{String b;}
@Data class B<T>{ T c; }
A a1 = new A();
a1.setB("sa");
B<A> s = new B<A>();
s.c = a1;
ObjectMapper objectMapper = new ObjectMapper();
String sj = objectMapper.writeValueAsString(s);
System.out.println(sj); // {"c":{"b":"sa"}}
B<A> ba = objectMapper.readerFor(new TypeReference<B<A>>() {
})
.readValue(sj); // this is not working
Gives this error:
com.fasterxml.jackson.databind.JsonMappingException: Cannot deserialize
EmbeddedTest$1B (of type local/anonymous) as a Bean.