user689842
user689842

Reputation:

Spring @Bean annotation differences (context vs config packages)?

What is the difference between these classes and when should I use each in conjunction with @Configure?

org.springframework.context.annotation.Bean

org.springframework.config.java.annotation.Bean;

Upvotes: 1

Views: 615

Answers (2)

dimitrisli
dimitrisli

Reputation: 21411

The JavaConfig dependency is part of the spring-context as of Spring 3.0. Therefore if you are building your app using Spring > 3.0 use the org.springframework.context.annotation.Bean

Upvotes: 1

Biju Kunjummen
Biju Kunjummen

Reputation: 49935

It looks like you have an obsolete jar file in your classpath - org.springframework.config.java.annotation.Bean is no longer with the latest Spring 3.1.2 jars, it is the org.springframework.context.annotation.Bean annotation that should be used with the @Configuration classes

Upvotes: 4

Related Questions