Avoid creating a nested group for an Enum

Previously, an Enum that is defined as an inner class of a
@ConfigurationProperties pojo was wrongly detected as an nested group.

This case is now handled explicitly and covered by a test.

Fixes gh-1971
This commit is contained in:
Stephane Nicoll
2014-11-21 17:20:35 +01:00
parent 5f673c9e84
commit 32efff3f30
3 changed files with 20 additions and 1 deletions

View File

@@ -243,6 +243,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat(metadata, containsGroup("config.third").ofType(SimplePojo.class)
.fromSource(InnerClassProperties.class));
assertThat(metadata, containsProperty("config.third.value"));
assertThat(metadata, containsProperty("config.fourth").ofType(InnerClassProperties.Fourth.class));
assertThat(metadata, not(containsGroup("config.fourth")));
}
@Test

View File

@@ -34,6 +34,8 @@ public class InnerClassProperties {
@NestedConfigurationProperty
private final SimplePojo third = new SimplePojo();
private Fourth fourth;
public Foo getFirst() {
return this.first;
}
@@ -50,6 +52,14 @@ public class InnerClassProperties {
return this.third;
}
public Fourth getFourth() {
return fourth;
}
public void setFourth(Fourth fourth) {
this.fourth = fourth;
}
public static class Foo {
private String name;
@@ -83,4 +93,9 @@ public class InnerClassProperties {
}
public static enum Fourth {
YES,
NO
}
}