I have a DTO as below:
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import reactor.core.publisher.Flux;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class InternetPackageDto {
    private String id;
    private String name;
    private String termsAndConditions;
    private String price;
    private Flux<String> packageAttributes;
    private Flux<String> extras;
}
And a Database Object as below:
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import reactor.core.publisher.Flux;
@Document("internet_packages")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class InternetPackage {
    @Id
    private String id;
    private String name;
    private String termsAndConditions;
    private String price;
    private Flux<StoreableAttribute> attributes;
    private Flux<StoreableAttribute> extras;
}
The StorableAttribute Database Model like so:
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document("package_attributes")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StoreableAttribute {
    @Id
    private String id;
    private String name;
    private String description;
}
On the Data Object the fields: Flux<StoreableAttribute> attributes and Flux<StoreableAttribute> extras are stored in a separate collection alongside the Package Object. And is handled by the mapper as below:
 public InternetPackage fromDto(InternetPackageDto dto) {
        var internetPackage = new InternetPackage();
        internetPackage.setName(dto.getName());
        internetPackage.setPrice(dto.getPrice());
        internetPackage.setId(dto.getId());
        internetPackage.setExtras(this.resolePackageExtras(dto));
        internetPackage.setAttributes(this.resolePackageAttributes(dto));
        return internetPackage;
    }
  private Flux<StoreableAttribute> resolePackageExtras(InternetPackageDto dto) {
        return this.storeableAttributeService.resolveAttributes(dto.getExtras());
    }
for the extra and similarly for the attributes also.
And a simple controller method as below:
    @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes =  MediaType.APPLICATION_JSON_VALUE)
    public Mono<InternetPackageDto> update(@RequestBody InternetPackageDto incomingPackageDto) {
        return this.packageService
                .updatePackage(this.dtoMapper.fromDto(incomingPackageDto))
                .map(this.dtoMapper::toDto);
    }
And when I make a post request I get an error stating
org.springframework.core.codec.CodecException: Type definition error: [simple type, class reactor.core.publisher.Flux]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `reactor.core.publisher.Flux` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 2, column: 13] (through reference chain: com.example.api.dto.InternetPackageDto["extras"])
Some more information:
- I am using the class 
InternetPackageDtoas a request object as well as a response object. - I am using 
Flux<String>and notList<String>since I wasn't sure if doing blocking resolution to list was a good idea. - The attributes are stored and managed separately.
 - And during the time of updating or inserting the package those; if a new extra or attribute is included the attributes collection in db will be updated with the insertion of new incoming extras and attributes.
 
It seems like I might have made a stupid mistake because I cannot find much information about this problem, or I am doing it completely wrong.
Any help would be greatly appreciated.
                        
I think you should do smth like this