What are the pros and cons of using @Autowired in a class that will be wired up by Spring?
Just to clarify, I\'m talking specifically about the
There has been very little discussion about switching environments. Most projects I've worked on it was a real issue to inject dependencies depending on the environment we are working on. With xml config it's pretty straightforward with Spring EL, and I am not aware of any nice solution with annotations. I've just figured out one:
@Value("#{${env} == "production" ? realService : dummyService}")
private SomeService service;
It should be working, but not a nice solution imho.