I have one Base Abstract Class say A, which is being extended by another abstract class B and finally one concrete class C extending B.
Here in Class C trying to get the dataSource autowired in Base Abract Class A. But @Autowired
is not Working in Abstract Class and even getting null
in sop(dataSource)
If i autowire dataSource
in concrete Class C, its working.
Please any one help me on this.. I want to use a common base class for getting dataSource. But @Autowired
is not working in it.
Will be of great help if someone give a solution with example.
Thanks in Advance..
Sample Code:
abstract Class A
{
@Autowired DataSource dataSource;
setConnection(){ sop(dataSource); }
}
abstract Class B extends A
{ -- Method conn()
{ setConnection();}
}
Class C extends B
{
Invoke conn();
}