001/* 002 * Copyright 2002-2015 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.context; 018 019import java.util.EventListener; 020 021/** 022 * Interface to be implemented by application event listeners. 023 * Based on the standard {@code java.util.EventListener} interface 024 * for the Observer design pattern. 025 * 026 * <p>As of Spring 3.0, an ApplicationListener can generically declare the event type 027 * that it is interested in. When registered with a Spring ApplicationContext, events 028 * will be filtered accordingly, with the listener getting invoked for matching event 029 * objects only. 030 * 031 * @author Rod Johnson 032 * @author Juergen Hoeller 033 * @param <E> the specific ApplicationEvent subclass to listen to 034 * @see org.springframework.context.event.ApplicationEventMulticaster 035 */ 036public interface ApplicationListener<E extends ApplicationEvent> extends EventListener { 037 038 /** 039 * Handle an application event. 040 * @param event the event to respond to 041 */ 042 void onApplicationEvent(E event); 043 044}