Mule ESB 注释不起作用
问题描述:
我尝试在 mule esb 中使用 @Schedule Annotation,但它不起作用.我不知道这有什么问题.我的Java代码:
I try to use @Schedule Annotation in mule esb, but it does not work. I don't know what's wrong with it. My java code :
public class MyCache {
@Schedule(interval=1000)
public void writeStr(){
Log.debug("111112222222223333333334444444444");
System.out.println("111112222222223333333334444444444");
}
}
答
出于一种超乎想象的原因,你不得不在过时的模型/服务容器中使用带有 @Schedule
注释的 Java 组件工作.
For a reason that goes beyond imagination, you have to use @Schedule
annotated Java components in the obsolete model/service container for it to work.
您上面的类(我放在 com.acme
包中)在 Mule 3.4.0 上使用以下内容:
Your above class (that I put in the com.acme
package) works with the following on Mule 3.4.0:
<model>
<service name="myCacheScheduler">
<component>
<singleton-object class="com.acme.MyCache" />
</component>
</service>
</model>