常见问题
常见问题
-
我想获取更详细的日志信息,例如在
JpaRepository
内部调用了哪些方法。我该如何实现?你可以使用 Spring 提供的
CustomizableTraceInterceptor
,如下例所示:<bean id="customizableTraceInterceptor" class="
org.springframework.aop.interceptor.CustomizableTraceInterceptor">
<property name="enterMessage" value="进入 $[methodName]($[arguments])"/>
<property name="exitMessage" value="离开 $[methodName](): $[returnValue]"/>
</bean>
<aop:config>
<aop:advisor advice-ref="customizableTraceInterceptor"
pointcut="execution(public * org.springframework.data.jpa.repository.JpaRepository+.*(..))"/>
</aop:config>
审计
-
我想使用 Spring Data JPA 的审计功能,但我的数据库已经配置为在实体上设置修改和创建日期。如何防止 Spring Data 以编程方式设置日期?
将
auditing
命名空间元素的set-dates
属性设置为false
。