如何在<jpa:auditing auditor-aware-ref="yourAuditorAwarebean" />
班级中以编程方式执行以下操作:@Configuration
?
弹簧xml配置是否必须执行此操作?
答案 0 :(得分:2)
自Spring Data JPA 1.5(link to documentation)
以来,现在支持用于审计的Java Config在任何配置类上用<jpa:auditing auditor-aware-ref="yourAuditorAwarebean" />
注释替换@EnableJpaAuditing
。
E.g:
@Configuration
@EnableJpaAuditing
class Config {
@Bean
public AuditorAware<AuditableUser> yourAuditorAwarebean() {
return new YourAuditorAwareImpl();
}
}