Skip to content

Commit

Permalink
Prepare for release 5.0.5 (#23)
Browse files Browse the repository at this point in the history
- Updated BeanMapper to version 4.1.6
- Added diagnosticsLevel config property, allowing Diagnostics to be enabled globally.
  • Loading branch information
marcus-talbot42 authored May 8, 2024
1 parent 05612bc commit 628f141
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<maven.compiler.target>17</maven.compiler.target>

<spring.boot.version>3.2.1</spring.boot.version>
<beanmapper.spring.version>5.0.4</beanmapper.spring.version>
<beanmapper.spring.version>5.0.5</beanmapper.spring.version>
<maven.release.plugin.version>2.5.3</maven.release.plugin.version>
<maven.scm.provider.gitexe.version>1.13.0</maven.scm.provider.gitexe.version>
</properties>
Expand Down Expand Up @@ -205,7 +205,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.12</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.beanmapper.spring.web.converter.StructuredJsonMessageConverter;
import jakarta.annotation.Nonnull;
import jakarta.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanInstantiationException;
Expand All @@ -28,6 +29,7 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.ClassUtils;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
Expand All @@ -46,6 +48,7 @@
* will be added to the Spring MVC context.
*/
@Configuration
@EnableAspectJAutoProxy
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
@EnableConfigurationProperties(BeanMapperProperties.class)
public class BeanMapperAutoConfig {
Expand All @@ -72,7 +75,7 @@ private void initApplicationScanner() {

/**
* Creates a {@link BeanMapper} bean with spring-data-jpa defaults.
* If a {@link BeanMapperBuilderCustomizer} bean is found, uses this to
* If a {@link BeanMapperBuilderCustomizer} bean is found, uses this to
* customize the builder before the {@link BeanMapper} is build.
* @return BeanMapper
*/
Expand Down Expand Up @@ -110,7 +113,11 @@ public BeanMapper beanMapper() {

setUnproxy(builder);
customize(builder);
return builder.build();
BeanMapper beanMapper = builder.build();
if (props.getDiagnosticsDetailLevel().isEnabled()) {
beanMapper = beanMapper.wrap(props.getDiagnosticsDetailLevel()).build();
}
return beanMapper;
}

private void setSecuredChecks(BeanMapperBuilder builder, String packagePrefix) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.beanmapper.autoconfigure;

import io.beanmapper.utils.diagnostics.DiagnosticsDetailLevel;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
Expand Down Expand Up @@ -29,6 +31,8 @@ public class BeanMapperProperties {

private String strictTargetSuffix = "Result";

private DiagnosticsDetailLevel diagnosticsLevel = DiagnosticsDetailLevel.DISABLED;

public boolean isUseHibernateUnproxy() {
return useHibernateUnproxy;
}
Expand Down Expand Up @@ -76,4 +80,12 @@ public String getStrictTargetSuffix() {
public void setStrictTargetSuffix(String strictTargetSuffix) {
this.strictTargetSuffix = strictTargetSuffix;
}

public DiagnosticsDetailLevel getDiagnosticsDetailLevel() {
return diagnosticsLevel;
}

public void setDiagnosticsDetailLevel(DiagnosticsDetailLevel diagnosticsLevel) {
this.diagnosticsLevel = diagnosticsLevel;
}
}

0 comments on commit 628f141

Please sign in to comment.