PersistenceConfig.java (796B)
1 package com.wimdupont.sxcybot.config; 2 3 import com.wimdupont.sxcybot.util.SpringSecurityAuditorAware; 4 import org.springframework.context.annotation.Bean; 5 import org.springframework.context.annotation.Configuration; 6 import org.springframework.data.domain.AuditorAware; 7 import org.springframework.data.jpa.repository.config.EnableJpaAuditing; 8 9 @Configuration 10 @EnableJpaAuditing(auditorAwareRef = "auditorProvider") 11 public class PersistenceConfig { 12 13 private final SpringSecurityAuditorAware springSecurityAuditorAware; 14 15 public PersistenceConfig(SpringSecurityAuditorAware springSecurityAuditorAware) { 16 this.springSecurityAuditorAware = springSecurityAuditorAware; 17 } 18 19 @Bean 20 public AuditorAware<String> auditorProvider() { 21 return springSecurityAuditorAware; 22 } 23 }