Mapper.getConfiguration().setMatchingStrategy(STRICT);

This commit is contained in:
Michael Hoennig 2024-09-25 11:30:54 +02:00
parent fdbe46311a
commit 4acd8a7d65

View File

@ -1,8 +1,6 @@
package net.hostsharing.hsadminng.mapper; package net.hostsharing.hsadminng.mapper;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.modelmapper.spi.MatchingStrategy;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
@ -10,8 +8,6 @@ import jakarta.persistence.ManyToOne;
import jakarta.persistence.PersistenceContext; import jakarta.persistence.PersistenceContext;
import jakarta.validation.ValidationException; import jakarta.validation.ValidationException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -30,9 +26,7 @@ public class Mapper extends ModelMapper {
EntityManager em; EntityManager em;
public Mapper() { public Mapper() {
getConfiguration().setAmbiguityIgnored(true); getConfiguration().setMatchingStrategy(STRICT);
// getConfiguration().setMatchingStrategy(STRICT);
// getConfiguration().setDeepCopyEnabled(true);
} }
public <S, T> List<T> mapList(final List<S> source, final Class<T> targetClass) { public <S, T> List<T> mapList(final List<S> source, final Class<T> targetClass) {