kieker-monitoring / kieker

Kieker's main repository
Apache License 2.0
70 stars 41 forks source link

[KIEKER-899] Spring-Based Instrumentation and @Autowired #1007

Open rju opened 6 days ago

rju commented 6 days ago

JIRA Issue: KIEKER-899 Spring-Based Instrumentation and @Autowired Original Reporter: Nils Christian Ehmke


There is currently a problem when using Spring's @Autowired annotation together with Kieker's Spring Based Instrumentation.

The @Autowired annotation is, for example, responsible for injecting certain dependencies directly into the fields based on matching data types.

The in the user guide suggested (and in the JPetStore example used) method to use Kieker with Spring is as follows.

 <bean id="opEMII" 
          class="kieker.monitoring.probe.spring.executions.OperationExecutionMethodInvocationInterceptor" /> 
    <aop:config>
        <aop:advisor advice-ref="opEMII" 
                 pointcut="execution(public * org.mybatis.jpetstore..*.*(..))"/>
    </aop:config>

When using this configuration (of course with modified pointcut) it seems like the beans, which should get the additional advice, are subclassed (as Spring doesn't allow final modifiers for the beans in question). This results in the incapability of Spring to autowire those beans, as the types are no longer matching.

Checklist:

rju commented 2 days ago

author nils-christian -- Tue, 2 Apr 2013 10:11:02 +0200

Seems like this is not a problem with Kieker, but rather a configuration problem. I solved this (for my configuration) by adding

<aop:aspectj-autoproxy proxy-target-class="true"/>

Guess this should be documented in the user guide though.

rju commented 2 days ago

author nils-christian -- Tue, 2 Apr 2013 18:03:14 +0200

Added a simple note in 56f4d6f662670466df6c5572d2a2189709254bf6.