Search code examples
javaspringspring-cloudspring-cloud-aws

What does @enablesns @enablesqs annotations do (spring cloud aws)?


I have been trying to find documentation of @enablesns @enablesqs annotations but can't find them.

They seem to be required for the sqs and sns integration to work. But I'd just like to have a better understanding, and be sure I'm not using them wrong.

Any description would be of great help.


Solution

  • Looking at the source code for those two annotations:

    @Import({SnsConfiguration.class, SnsWebConfiguration.class})
    public @interface EnableSns
    

    Where @Import does the following:

    @interface Import: Indicates one or more @Configuration classes to import.

    Long story short: Those annotations only combine multiple @Configuration classes into one single annotation.

    E.g. @EnableSns does the same as adding @SnsConfiguration and @SnsWebConfiguration which provide you with AmazonSNS, RegionProvider and AWSCredentialsProvider beans.