When annotating a class with @Component, does this mean it is a Spring Bean and Singleton?

前端 未结 2 1623
既然无缘
既然无缘 2020-12-04 12:08

Being fairly new to Spring I have a question about annotating a class. When annotating a class with @Component does this mean this class will be a Spring Bean a

2条回答
  •  囚心锁ツ
    2020-12-04 12:19

    By default - Yes.

    However, you can override this behavior using the @Scope annotation. For example: @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

提交回复
热议问题