I have a problem. I wanna create a Job but not when application is started. I wanna invoke method from pingServcie but is null.

This is my code:

Job class

class MyJob implements Job {

def pingService

@Override
void execute(JobExecutionContext context) throws JobExecutionException {
pingService.checkPing()
}
}
I read somewhere that I need bean with my Service class, because Spring Autowire doesn't work in this case, so I create it (I never work with bean so I don't if this is correct). I create resources.xml instead of resources.groovy

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean name="pingService" class="inzynierka.PingService" />
</beans>
But this doesn't work.

Has anyone knows what's is wrong or how it should be done? Thanks