开发者

Weld injection failing when calling a method from an super/abstract class with Wicket

开发者 https://www.devze.com 2023-01-10 06:50 出处:网络
I am having a problem with weld-wicket. When @Inject-ing an EJB that inherits from an abstract class, if I attempt to call a method from the abstract clas开发者_如何学Pythons I get an ejb-ref error.

I am having a problem with weld-wicket. When @Inject-ing an EJB that inherits from an abstract class, if I attempt to call a method from the abstract clas开发者_如何学Pythons I get an ejb-ref error. However if I call a method from the concrete class it works perfectly. I can override methods and call them, and I can delegate an overridden method to the abstract class (having the overridden method call super.method()) and that works. Is there some sort of configuration I have to do to the abstract class?

Thanks.


This is a guess based on my experience with Seam. Weld injects a proxy that wraps your bean. The proxy only intercepts public methods and delegates those to the underlying bean (EJB in your case). When you call a protected method on the proxy or a package-private method from a class in the same package that method is not intercepted and is invoked directly on the proxy which causes your error. To make the story short, only call public methods or back all your dependencies by an interface and inject that.

0

精彩评论

暂无评论...
验证码 换一张
取 消