Avoid component scan

Pragya Keshap answered on February 22, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • What is a component scan?

  • Avoid component scan

    0

    The Spring @ComponentScan annotation can receive a package and automatically scans all of the classes in the package for Spring-related configuration, resources, and beans. While this comes very handy during development, when classes are changing frequently, it forces the Spring framework to perform the notoriously heavy operation of discovering all of the necessary classes at is starts. Before deploying your application to AWS Lambda, you should consider switching from the @ComponentScan annotation to direct @Import of your classes.

    Starting the SpringLambdaContainerHandler with the PetStoreAppConfig class above, allows Spring to introspect only the classes you declared in your @Import statement - which are also already loaded by the JVM - thus avoiding the heavy task of scanning an entire package.

    Popularity 1/10 Helpfulness 1/10 Language java
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 22 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.