I find @RequestMapping is very usable in the controller class. This annotation based controller maps a url to a method instead to a class. Also I dont need to bloat the spring-servlet.xml for handler mapping.
But with this it looks like only @Autowired or @Resource is possible for the dependency injection. Is there any other way?
And how bad its to use @Resource in the production code?
It is not bad at all. Using
@Autowired/@Resource/@Injectis a perfectly normal way of specifying injection points.One drawback of
@Resource(that has nothing to do with production vs development) is the it relies on strings, which are not checked at compile-time. Instead you can use@Qualifierif you need to specify a concrete implementation for injection, rather than an interface.