You can't @Autowired
a static field. But there is a tricky skill to deal with this:
public class Foo {
private static IAuditLogRepository iAuditLogRepository;
@Autowired
private IAuditLogRepository iaRepos;
@PostConstruct
public void someFunction () {
iAuditLogRepository = iaRepos;
}
public static int saveLog(LogFile logFile){
iAuditLogRepository.saveLog(logFile);
}
}
In one word, @Autowired
a instance field, and assign the value to the static filed when your object is constructed.