【发布时间】:2012-12-20 11:22:37
【问题描述】:
我们有一个 Spring 3.1 Web 应用程序,它使用带有 cglib 库的 spring-aop。 spring.xml:
<context:annotation-config/>
<aop:aspectj-autoproxy proxy-target-class="true"/>
这意味着将使用 cglib 为每个 bean 创建一个代理。
现在我们需要使用带有 com.mchange.v2.c3p0.ComboPooledDataSource 的数据库连接池 bean:
<bean id="connectionPool" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<!-- here are some properties -->
</bean>
问题是 ComboPooledDataSource 类被标记为 final。而且 cglib 不能代理 final 类。
如何标记“connectionPool” bean 不被代理?
【问题讨论】:
-
你的切入点定义是什么?为什么Spring认为数据源需要代理?
标签: spring aop spring-aop cglib