cometta
cometta

Reputation: 35669

spring3 @autowired and @inject

i'm spring2.5, i normally use @autowired for DI. If i not wrong, in spring3, we can use @Inject for similar feature right? please comment. I tried to add @Inject instead of @autowired but doesnt work. need extra library?

Upvotes: 0

Views: 1732

Answers (1)

axtavt
axtavt

Reputation: 242686

If by "doesn't work" you mean that the annotation can't be resolved, then yes, you need a JSR-330 API library. You can download it here.

Or if you use maven:

<dependency>
  <groupId>javax.inject</groupId>
  <artifactId>javax.inject</artifactId>
  <version>1</version>
</dependency>

Upvotes: 1

Related Questions