This commit is contained in:
Phillip Webb
2016-06-20 20:13:13 -07:00
parent c136054e69
commit 7446235ff4
27 changed files with 343 additions and 263 deletions

View File

@@ -172,12 +172,15 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
Element returns = this.processingEnv.getTypeUtils()
.asElement(element.getReturnType());
if (returns instanceof TypeElement) {
ItemMetadata group = ItemMetadata.newGroup(prefix, this.typeUtils.getType(returns),
ItemMetadata group = ItemMetadata.newGroup(prefix,
this.typeUtils.getType(returns),
this.typeUtils.getType(element.getEnclosingElement()),
element.toString());
if (this.metadataCollector.hasSimilarGroup(group)) {
this.processingEnv.getMessager().printMessage(Kind.ERROR,
"Duplicate `@ConfigurationProperties` definition for prefix '" + prefix + "'", element);
"Duplicate `@ConfigurationProperties` definition for prefix '"
+ prefix + "'",
element);
}
else {
this.metadataCollector.add(group);

View File

@@ -19,8 +19,7 @@ package org.springframework.boot.configurationsample.specific;
import org.springframework.boot.configurationsample.ConfigurationProperties;
/**
* Test that the same type can be registered several times if the prefix is
* different.
* Test that the same type can be registered several times if the prefix is different.
*
* @author Stephane Nicoll
*/