Browse Source

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
pull/3473/head
Stephane Nicoll 11 years ago
parent
commit
cb5eccb5c1
  1. 11
      spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
  2. 16
      spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc
  3. 15
      spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java

11
spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -165,6 +165,17 @@ @@ -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": [

16
spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc

@ -487,17 +487,17 @@ property that defines the `SQLDialect` class name to use: @@ -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"
}
}
}
]
},
]}
}
]}
----

15
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java

@ -366,6 +366,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { @@ -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 { @@ -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 { @@ -388,6 +398,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
.<String, Object> 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")

Loading…
Cancel
Save