Hi,
I am trying to bind an apect to an object in wirebox, like this:
mapAspect("sdkSessionInjector").to("aop.WebAPISessionInjector")
.initArg(name="sessionStorageKey", value="SDKSession")
.asSingleton();
bindAspect(
classes = match().instanceOf('model.service.SDKService'),
methods =
match().annotatedWith('mobidm:required_arg','webAPISession'),
aspects = "sdkSessionInjector"
);
An example of an object to be wired like this is:
map("entityService").to("model.service.SDKService")
.initArg(name="entityType", value="model.bean.Entity")
.initArg(name="queryBuilder", ref="queryBuilder")
.initArg(name='serviceProvider', ref='serviceProvider')
.asEagerInit()
.asSingleton();
In my case, it seems that the entityService object does nog get wired
with the aspect. When I remove the .asEagerInit() call from the
entityService mapping, I see two properties appear when I dump the
object:
- $WBAOPTARGETS
- $WBAOPMIXED
and the aspect works as expected
When I re-add the asEagerInit() call, the two properties mentioned
above are not present when I dump the object, and the aspect appears
to be ignored.
Is there any way to bind AOP aspects to eager-inited objects, and if
yes, what am I doing wrong?
Best regards,
Martijn van der Woud