'@Component and @Scope annotation is not allowed with ANNOTATION

Getting compilation error during running mt project and have not idea why this error happanes. Please check compilation error below:

 @ line 19, column 1.
   @Component
   ^

/Users/akhmadsadaiev/Exabeam/exa-ngsc-auto/src/main/groovy/com/exabeam/ngsc/annotations/ScenarioScope.groovy: 20: Annotation @org.springframework.context.annotation.Scope is not allowed on element ANNOTATION
 @ line 20, column 1.
   @Scope("cucumber-glue")
   ^

2 errors

Here is the class where the error happened:

import org.springframework.context.annotation.Scope
import org.springframework.core.annotation.AliasFor
import org.springframework.stereotype.Component

import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target

/**
 * This annotation simply combines Spring's @Component stereotype
 * and Cucumber's 'cucumber-glue' scope
 * (lifecycle is limited by scenario execution time)
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Component
@Scope("cucumber-glue")
@interface ScenarioScope {

    @AliasFor(annotation = Component.class, attribute = "value")
    String value() default ""

}

Can't get a reason, as everything working in a different project.

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source