I have an abstract class "Command" with an @Autowired dependency and classes extending the abstract class. The dependency is not being injected. The abstract and concrete classes are annotated with @Component and are being scanned. It seems that the base(abstract) class is not spring managed. What needs to be done for it to be? Is there an annotation to define it as abstract? I don't want to define the bean in XML.
public abstract class Command {
@Autowired
private SecurityUtils securityUtils;
....
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
@Component
public class NoteCommand extends Command {
...
}
My mistake I apologize. The command classes are injected in my controllers and one of them (NoteCommand) out many was instantiated manually via "new". All is good.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…