Hello Im trying to add vavr to my projet, right now Im struggling with proper serializaition of Vavr.List objects. Below is my controller:
import io.vavr.collection.List;
@GetMapping(value = "/xxx")
public List<EntityDeleted> getFile() {
return List.of(new EntityDeleted(true),new EntityDeleted(true),new EntityDeleted(true),new EntityDeleted(true));
}
EntityDeleted is my custom object, List is Vavr collection as shown in import statement. The response Im getting in Postman is:
{
"empty": false,
"lazy": false,
"async": false,
"traversableAgain": true,
"sequential": true,
"singleValued": false,
"distinct": false,
"ordered": false,
"orNull": {
"deleted": true
},
"memoized": false
}
where I expect JSON list of my objects. Below is my config:
@SpringBootApplication
public class PlomberApplication {
public static void main(String[] args) {
SpringApplication.run(PlomberApplication.class, args);
}
@Bean
public ObjectMapper jacksonBuilder() {
ObjectMapper mapper = new ObjectMapper();
return mapper.registerModule(new VavrModule());
}
}
and bit of pom.xml
<dependency>
<groupId>io.vavr</groupId>
<artifactId>vavr</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>io.vavr</groupId>
<artifactId>vavr-jackson</artifactId>
<version>0.9.0</version>
</dependency>