Reputation: 1878
We are having @Configuration
class, but it doesn't contain any bean definition and as it is a legacy class written by someone i don't want to remove the @Configuration
annotation even while there is no bean definition. Somehow i want to perform logic on shutdown hook of web application but somehow i am not able to get bean from context in the contextDestroyed()
method so i want to use @PreDestroy
on that @Configuration
class.
Does any one specify what is the default scope of the @Configuration
class. As I don't want that if the scope is non-singleton that bean would the @PreDestroy
will be called again and again.
Upvotes: 2
Views: 3230
Reputation: 11870
@Configuration
is meta-annotated with @Component
. This is where its Scope rules are derived from. @Scope
-annotated components that specify no value (and those without a Scope annotation for that matter) default to Singleton Scope as can be looked up in the respective JavaDoc.
Upvotes: 1