Hi all,
I have configured a scheduler in my app xml:
<import resource="classpath:services-context.xml" />
<bean id="drJob" class="org.springframework.scheduling.quartz.JobDe tailBean">
<property name="jobClass">
<value>com.web.DailyReportJob</value>
</property>
</bean>
<bean id="dailyReportJobTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
<property name="jobDetail" ref="drJob"/>
<property name="cronExpression" value="0 0/30 * * * ?"/>
</bean>
<bean id="sch" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
<property name="triggers">
<list>
<ref bean="dailyReportJobTrigger" />
</list>
</property>
</bean>
Now inside my DailyReportJob i am using a bean(servicebean) that was inside the imported file in the first line of the above xml.
Questions:
1. Now my problem is that the service is not getting injected, i have got the getters and setters for that ..how can i get it injected Automatically ?
As a Temp fix currently i was doing like this :
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext .xml");
servicebean= (servicebean) ctx.getBean("servicebean");
how would i get it injected automatically ?
2. Down the code i need to get the path at which this application is depolyed for my business logic to copy some thing in the images folder..i could recall in servlet there is a way to get the realpath is there a way in my scheduler job code to get the real path of the application any way so that ican avoid the hard-coding in the properties.
looking forward for your suggestions and advice..
regards,
vijay


Reply With Quote
