Tuesday, 15 June 2010

dependency injection - Jersey/Jersey-spring @Autowire not working anymore when introducing AspectJ and advice not executed -



dependency injection - Jersey/Jersey-spring @Autowire not working anymore when introducing AspectJ and advice not executed -

has managed bailiwick of jersey working aspectj (from spring) ?

in illustration have bailiwick of jersey class in java/groovy:

@component @path("/resource") class resource{ @autowired resourceaccess resourceaccess @get @produces(mediatype.application_json) public string getresource(@queryparam("name") string name){ def res= resourceaccess.getresource(name) homecoming res } ... }

it works fine, resourceaccess injected spring , /resource?name=test returns me resource name test

but when want introduce aspectj (aop) in game resourceaccess object not injected anymore , advice not executed.

i added in applicationcontext.xml , created aspect:

@aspect @component public class myaspect{ static final logger logger = loggerfactory.getlogger(myaspect.class); @before("execution(* com.test.resource.getresource(..))") public void logbefore(joinpoint joinpoint) { logger.debug("logbefore() running!"); } }

remark: if alter pointcut in advice target else working fine again.

is able help me on issue?

dependency-injection jersey aspectj

No comments:

Post a Comment