I am trying to create schedule event using EJB 3.1 @Schedule annotation. Everything works fine as long as I have the annotation inside my bean. Because I want to be able to change schedule in deploy time without repacking ear I want to add this annotation using AOP. But this does not work.
Here is my sample bean:
@AspectDomain(value = "TimerBeanDomain")
@Singleton
public class TimerBean {
public void timerMethod() {
System.out.println("Timer method activated");
}
}
Here is my aop.xml file (packed outside -ejb.jar):
<?xml version="1.0" encoding="UTF-8"?>
<aop xmlns="urn:jboss:aop-beans:1.0">
<domain name="TimerBeanDomain">
<annotation expr="method(void *->timerMethod(..))">
@javax.ejb.Schedule(second = "*/30", minute = "*", hour = "*")
</annotation>
</domain>
</aop>
Bean is packed inside -ejb.jar and aop file is outside this -ejb.jar.
There are no errors in console. It just does not work.
I tried it with stateless bean as well. But it does not help. In this case aop.xml looked like
<domain name="TimerBeanDomain" extends="Stateless Bean" inheritBindings="true">
I am using Jboss 6.0.1 and 6.1.0. At least is there some way how to debug the AOP process of adding annotation?
Any help will be appreciate.
Regards, Eman