From a86f6d3676ab655b7e7c4f82009c0c20726bd144 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 13 Sep 2016 21:42:23 +0200 Subject: [PATCH] ApplicationEventPublisher as functional interface Issue: SPR-14699 --- .../springframework/context/ApplicationEventPublisher.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/ApplicationEventPublisher.java b/spring-context/src/main/java/org/springframework/context/ApplicationEventPublisher.java index d21653b222..43b8dd40bc 100644 --- a/spring-context/src/main/java/org/springframework/context/ApplicationEventPublisher.java +++ b/spring-context/src/main/java/org/springframework/context/ApplicationEventPublisher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ package org.springframework.context; * @see org.springframework.context.ApplicationEvent * @see org.springframework.context.event.EventPublicationInterceptor */ +@FunctionalInterface public interface ApplicationEventPublisher { /** @@ -37,7 +38,9 @@ public interface ApplicationEventPublisher { * @param event the event to publish * @see org.springframework.web.context.support.RequestHandledEvent */ - void publishEvent(ApplicationEvent event); + default void publishEvent(ApplicationEvent event) { + publishEvent((Object) event); + } /** * Notify all matching listeners registered with this