use*_*190 2 spring spring-data spring-data-jpa
我以前使用过hibernate,并成功添加了一个拦截保存的过滤器,实现某个接口的实体会记录一些东西.
是否有可能在新的Spring Data中做类似的事情,我刚刚开始使用它.
是的,您始终可以使用弹簧数据添加过滤器/拦截器
以下是一个例子:
<bean id="customizableTraceInterceptor" class="
org.springframework.aop.interceptor.CustomizableTraceInterceptor">
<property name="enterMessage" value="Entering $[methodName]($[arguments])"/>
<property name="exitMessage" value="Leaving $[methodName](): $[returnValue]"/>
</bean>
<aop:config>
<aop:advisor advice-ref="customizableTraceInterceptor"
pointcut="execution(public * org.springframework.data.jpa.repository.JpaRepository+.*(..))"/>
</aop:config>
Run Code Online (Sandbox Code Playgroud)
参考:http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/
| 归档时间: |
|
| 查看次数: |
3648 次 |
| 最近记录: |