Skip to content

Instantly share code, notes, and snippets.

@moriya-hm5

moriya-hm5/audit

Created Oct 6, 2019
Embed
What would you like to do?
import java.util.Optional;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@Configuration
@EnableJpaAuditing
public class AuditConfig {
@Bean
public AuditorAware<String> auditorAware() {
return new AuditorAware<String>() {
@Override
public Optional<String> getCurrentAuditor() {
return Optional.of("testuser");
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment