From 78845fe63a75b01f1e4a7166a356834c0884f8d5 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 4 Apr 2017 17:27:00 +0300 Subject: [PATCH] Switch default value of spring.aop.proxy-target-class This commit ensures that the default proxying value matches the opinion we have applied for `@EnableTransactionManagement` Closes gh-8786 --- .../boot/autoconfigure/aop/AopAutoConfiguration.java | 6 +++--- .../META-INF/additional-spring-configuration-metadata.json | 2 +- .../boot/autoconfigure/aop/AopAutoConfigurationTests.java | 2 +- .../src/main/asciidoc/appendix-application-properties.adoc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/aop/AopAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/aop/AopAutoConfiguration.java index a0ea1fc10d..d2615e781b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/aop/AopAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/aop/AopAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,14 +45,14 @@ public class AopAutoConfiguration { @Configuration @EnableAspectJAutoProxy(proxyTargetClass = false) - @ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "false", matchIfMissing = true) + @ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "false", matchIfMissing = false) public static class JdkDynamicAutoProxyConfiguration { } @Configuration @EnableAspectJAutoProxy(proxyTargetClass = true) - @ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true", matchIfMissing = false) + @ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true", matchIfMissing = true) public static class CglibAutoProxyConfiguration { } diff --git a/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 20dd0ed54f..2363227335 100644 --- a/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -43,7 +43,7 @@ "name": "spring.aop.proxy-target-class", "type": "java.lang.Boolean", "description": "Whether subclass-based (CGLIB) proxies are to be created (true) as opposed to standard Java interface-based proxies (false).", - "defaultValue": false + "defaultValue": true }, { "name": "spring.application.admin.enabled", diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java index c90dbe08b4..b15d378bea 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/aop/AopAutoConfigurationTests.java @@ -60,7 +60,7 @@ public class AopAutoConfigurationTests { @Test public void aopWithDefaultSettings() { load(TestConfiguration.class); - testProxyTargetClassDisabled(); + testProxyTargetClassEnabled(); } @Test diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 2b0643c8ea..622ff0d955 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -50,7 +50,7 @@ content into your application; rather pick only the properties that you need. # AOP spring.aop.auto=true # Add @EnableAspectJAutoProxy. - spring.aop.proxy-target-class=false # Whether subclass-based (CGLIB) proxies are to be created (true) as opposed to standard Java interface-based proxies (false). + spring.aop.proxy-target-class=true # Whether subclass-based (CGLIB) proxies are to be created (true) as opposed to standard Java interface-based proxies (false). # IDENTITY ({sc-spring-boot}/context/ContextIdApplicationContextInitializer.{sc-ext}[ContextIdApplicationContextInitializer]) spring.application.index= # Application index.