Improve @PropertyMapping error message

Improve the message thrown when a @PropertyMapping is used in
combination with a @Component to include the actual annotations that
are causing the problem.

Fixes gh-5897
This commit is contained in:
Phillip Webb
2016-05-13 20:00:48 -07:00
parent 66b69f4346
commit cd365bcae1
2 changed files with 47 additions and 10 deletions

View File

@@ -107,8 +107,9 @@ public class PropertyMappingContextCustomizerFactoryTests {
context.register(ConfigMapping.class);
customizer.customizeContext(context, null);
this.thrown.expect(BeanCreationException.class);
this.thrown.expectMessage(
"@PropertyMapping annotations can only be used on test classes");
this.thrown.expectMessage("The @PropertyMapping annotation "
+ "@PropertyMappingContextCustomizerFactoryTests.TypeMappingAnnotation "
+ "cannot be used in combination with the @Component annotation @Configuration");
context.refresh();
}