Registering Repository Event Listeners

You’re able to add a custom logic before or after specific operations execution (like creation, update or deletion of the entity) using Spring Data AbstractRepositoryEventListener.

Firstly, create your domain entity repository event listener:

public class SimpleRepositoryEventListener extends AbstractRepositoryEventListener<Customer> {

    private final Logger logger = LoggerFactory.getLogger(SimpleRepositoryEventListener.class);

    private CustomerService customerService;

    public void onBeforeSave(Customer customer) {
        final boolean vipCustomer = customerService.isVIP(customer);"#handleBeforeSave: Customer {} is VIP: {}", customer, vipCustomer);

    public void onAfterSave(Customer customer) {"#handleAfterSave: Hello");

After adding all the logic you need, just register it in your AdministrationConfiguration:

public class CustomerAdministration extends AdministrationConfiguration<Customer> {

    public EntityMetadataConfigurationUnit configuration(EntityMetadataConfigurationUnitBuilder configurationBuilder) {
        return configurationBuilder

As a result, your custom event listener will be triggered for all the operations performed on the entity you declared it for.