Closed
Description
Michal Kytýr opened SPR-13239 and commented
We are using the spring-vaadin
library in our project, which has its own annotation @VaadinView
:
@Target({java.lang.annotation.ElementType.TYPE})
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@Documented
@VaadinComponent
@VaadinViewScope
public @interface VaadinView {
/**
* The name of the view. This is the name that is to be passed to the
* {@link com.vaadin.navigator.Navigator} when navigating to the view. There can be multiple views
* with the same name as long as they belong to separate UI subclasses.
*
* @see #ui()
*/
String name();
/**
* By default, the view will be available for all UI subclasses in the application. This attribute can be used
* to explicitly specify which subclass (or subclasses) that the view belongs to.
*/
Class<? extends UI>[] ui() default {};
}
Library also defines its own scope "vaadin-view", which has a "shortcut" annotation @VaadinViewScope
defined like:
@Scope("vaadin-view")
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface VaadinViewScope {
}
I tried our project with 4.2.0.RC2 (RC1 worked fine) and suddenly there is an exception when scanning scope of classes with @VaadinView
annotation:
Caused by: org.springframework.core.annotation.AnnotationConfigurationException: In annotation [org.springframework.context.annotation.Scope] declared on [file [D:\...\AdminViewImpl.class]], attribute [value] and its alias [name] are present with values of [vaadin-view] and [admin], but only one is permitted.
at org.springframework.core.annotation.AnnotationAttributes.getRequiredAttributeWithAlias(AnnotationAttributes.java:434)
at org.springframework.core.annotation.AnnotationAttributes.getAliasedString(AnnotationAttributes.java:149)
at org.springframework.context.annotation.AnnotationScopeMetadataResolver.resolveScopeMetadata(AnnotationScopeMetadataResolver.java:82)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:250)
at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:137)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:267)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:231)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:198)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167)
... 18 more
I think it has something to do with #16020, parameters "name" and "value" of different annotations are mixed together.
Affects: 4.2 RC2
Issue Links:
- Introduce aliases for 'value' annotation attributes [SPR-11393] #16020 Introduce aliases for 'value' annotation attributes
Referenced from: commits 9f15f34