From cb5eccb5c1c369d8e66d20fae64b13835dfcf265 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 13 Jul 2015 13:45:23 +0200 Subject: [PATCH] Add missing handle-as meta-data Liquibase has a `changeLog` property that is definitely used as a `Resource` but cannot be defined as such as the original String value should be kept against an API we don't control. Update the tests also to make it more clear that if hints are added against a property that is detected automatically, said property still keeps all its auto-discovered capabilities. Closes gh-3457 --- ...additional-spring-configuration-metadata.json | 11 +++++++++++ .../appendix-configuration-metadata.adoc | 16 ++++++++-------- ...gurationMetadataAnnotationProcessorTests.java | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) 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 801aaf4786..e1f01ca942 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 @@ -165,6 +165,17 @@ "deprecated": true } ],"hints": [ + { + "name": "liquibase.change-log", + "providers": [ + { + "name": "handle-as", + "parameters": { + "target": "org.springframework.core.io.Resource" + } + } + ] + }, { "name": "server.jsp-servlet.class-name", "providers": [ diff --git a/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc b/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc index c41c6c0655..0c95fb128d 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc @@ -487,17 +487,17 @@ property that defines the `SQLDialect` class name to use: ---- {"hints": [ { - "name": "spring.jooq.sql-dialect", + "name": "liquibase.change-log", "providers": [ - { - "name": "handle-as", - "parameters": { - "target": "org.jooq.SQLDialect" + { + "name": "handle-as", + "parameters": { + "target": "org.springframework.core.io.Resource" + } } - } ] - }, - ]} + } + ]} ---- diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index 5730836f6b..d2b6663181 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -366,6 +366,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint( "boot", "Bla bla"), new ItemHint.ValueHint("spring", null))); ConfigurationMetadata metadata = compile(SimpleProperties.class); + assertThat(metadata, + containsProperty("simple.the-name", String.class) + .fromSource(SimpleProperties.class) + .withDescription("The name of this simple properties.") + .withDefaultValue(is("boot")).withDeprecated()); assertThat(metadata, containsHint("simple.the-name").withValue(0, "boot", "Bla bla") .withValue(1, "spring", null)); @@ -376,6 +381,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { writeAdditionalHints(ItemHint.newHint("simple.theName", new ItemHint.ValueHint( "boot", "Bla bla"))); ConfigurationMetadata metadata = compile(SimpleProperties.class); + assertThat(metadata, + containsProperty("simple.the-name", String.class) + .fromSource(SimpleProperties.class) + .withDescription("The name of this simple properties.") + .withDefaultValue(is("boot")).withDeprecated()); assertThat(metadata, containsHint("simple.the-name").withValue(0, "boot", "Bla bla")); } @@ -388,6 +398,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { . singletonMap("target", "org.foo")), new ItemHint.ValueProvider("second", null)))); ConfigurationMetadata metadata = compile(SimpleProperties.class); + assertThat(metadata, + containsProperty("simple.the-name", String.class) + .fromSource(SimpleProperties.class) + .withDescription("The name of this simple properties.") + .withDefaultValue(is("boot")).withDeprecated()); assertThat(metadata, containsHint("simple.the-name") .withProvider("first", "target", "org.foo")