简体   繁体   中英

Qualifier annotation method not finding beans as a Configuration class

The below works fine, the problem is i need this to run before another bean that will use some of the resources created here. When I change @Component to @Configuration I get an error Cannot find bean with qualifier localSNS

@Component
public class ResourceCreation {

    String queueUrl;

    @Qualifier("localSNS")
    @Autowired
    AmazonSNS amazonSNS;

You can annotate class with @DependsOn

FileProcessor specifies its dependencies with @DependsOn. We can also annotate a Component with @DependsOn:

 @Component @DependsOn({"filereader", "fileWriter"})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM