For example, I create a class QueryImpl, as below. ` @Component class QueryImpl implements Query { @Autowired private DatabaseService db; } ` the db is null, spring cannot inject beans into the query.