Skip to content

Regression: AnnotationScopeMetadataResolver fails to resolve VaadinView [SPR-13239] #17830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jul 16, 2015 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 16, 2015

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:

Referenced from: commits 9f15f34

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This an an unfortunate side effect: VaadinView's name attribute by convention overrides the newly introduced name attribute on @Scope now, which of course it doesn't intend to. We either need to remove/rename that new attribute on @Scope, or find some rules for how a common name attribute does not automatically override here.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've renamed @Scope's new attribute to scopeName, avoiding the immediate conflict with innocent name attributes on composed annotations.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants