Spring boot starter/autoconfig project for Beanmapper
- For more information about BeanMapper: http://beanmapper.io
- The BeanMapper-Spring project: https://github.com/42BV/beanmapper-spring
Auto-configures a BeamMapper
instance and adds it as a spring bean to the ApplicationContext
.
All custom implementations of BeanConverter
found in the application's packages are instantiated and added to the BeanMapper
.
A MergedFormMethodArgumentResolver
is instantiated and added to the already configured Spring MVC argument resolvers.
Add this maven dependency to your project and you can start wiring the BeanMapper
instance:
<dependency>
<groupId>io.beanmapper</groupId>
<artifactId>beanmapper-spring-boot-starter</artifactId>
<version>4.1.1</version>
</dependency>
- By default, the package of the
@SpringBootApplication
annotated class will be used as root whereBeanMapper
will look for classes to convert and where it will search for implementors ofBeanConverter
to instantiate and configure. If you want to override this package, add thebeanmapper.package-prefix=<custom-root-package>
property to the application environment. - If you do not want to make use of the
HibernateAwareUnproxy
feature, addbeanmapper.use-hibernate-unproxy=false
to the application environment. - If you want full control over the
BeanMapper
configuration, add a bean of typeBeanMapperBuilderCustomizer
to the application context:
@Bean
public BeanMapperBuilderCustomizer beanMapperCustomizer() {
return builder -> {
// After the autoconfiguration is done with the BeanMapperBuilder,
// control over this builder is passed to this callback just before build()
// is called to create the BeanMapper.
};
}