Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

@ComponentScan

Shaghin answered on January 26, 2021 Popularity 4/10 Helpfulness 2/10

Contents


More Related Answers

  • where will @componentScan look

  • @ComponentScan

    0
    Popularity 4/10 Helpfulness 2/10 Language whatever
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Jan 26 2021
    Shaghin
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    0

    The @ComponentScan annotation allows the autoscanning of beans. It takes a few arguments, such as base packages and their classes. The Spring container then looks into all the classes inside the base package and looks for beans. It scans all classes annotated with @Component or other annotations that are meta-annotated with @Component, such as @Configuration, @Controller, and so on.

    By default, Spring Boot takes the default base package from the class, which has the @ComponentClass annotation. You can use the basePackageClasses attribute to identify which packages should be scanned.

    Another way to scan more than two packages is by using the basePackages attribute. It allows you to scan more than one package.

    If you want to use more than one @ComponentScan, then you can wrap them inside the @ComponentScans annotation as shown:

    https://www.baeldung.com/spring-component-scanning

    Popularity 1/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: java
    Link to this answer
    Share Copy Link
    Contributed on Feb 18 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.