com.alon.spring.crud.api.configuration.ModelMapperConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crud-api-base Show documentation
Show all versions of crud-api-base Show documentation
Fornece implementação básica e expansível para criação API's CRUD com Spring Boot e Spring Data JPA.
package com.alon.spring.crud.api.configuration;
import org.modelmapper.ModelMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static org.hibernate.Hibernate.isInitialized;
@Configuration
public class ModelMapperConfiguration {
@Bean
public ModelMapper lazyIgnoreModelMapper() {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration()
.setPropertyCondition(context -> isInitialized(context.getSource()));
return modelMapper;
}
}