I am trying to do the following:
public static List<String> skills;
@Autowired
private static ISkillsDao skillsDao; // ISKillsDao is a crudrepository (Interface)
static{
updateSkills();
}
public static void updateSkills(){
skills = skillsDao.getSkills(); //This will return all the skills from db
}
@Autowired //as the object is static
public void setSkillsDao(ISkillsDao skillsDao){
ClassName.skillsDao = skillsDao;
}
Basically I want to load all the skills from db in a static list. But my static "Interface Crudrepository" object (skillsDao) is not getting autowired. The same works for a class but not for an interface. Also, if there is any better way to do this then kindly letme know.