ModelMapper: matches multiple source property hierarchies

后端 未结 4 967
孤城傲影
孤城傲影 2021-02-18 16:06

I cannot resolve modelMapper error. Do you have any ideas where is the issue?

NB: In view java.sql.Time doesn\'t have non-argument constructor I didn\'t find the better

4条回答
  •  旧时难觅i
    2021-02-18 16:48

    You need to customize ModelMapper configuration during Bean initialization with the help of a PropertyMap: http://modelmapper.org/user-manual/property-mapping/

    @Bean
    public ModelMapper modelMapper(){
        ModelMapper mm = new ModelMapper();
    
        PropertyMap propertyMap = new PropertyMap (){
            protected void configure() {
                map(source.getId()).setId(null);
            }
        }
    
        mm.addMappings(propertyMap);
        return mm;
    }
    

提交回复
热议问题