io.bitsensor.plugins.shaded.org.springframework.transaction.event.TransactionalEventListenerFactory Maven / Gradle / Ivy
/*
* Copyright 2002-2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.bitsensor.plugins.shaded.org.springframework.transaction.event;
import java.lang.reflect.Method;
import io.bitsensor.plugins.shaded.org.springframework.context.ApplicationListener;
import io.bitsensor.plugins.shaded.org.springframework.context.event.EventListenerFactory;
import io.bitsensor.plugins.shaded.org.springframework.core.Ordered;
import io.bitsensor.plugins.shaded.org.springframework.core.annotation.AnnotationUtils;
/**
* {@link EventListenerFactory} implementation that handles {@link TransactionalEventListener}
* annotated method.
*
* @author Stephane Nicoll
* @since 4.2
*/
public class TransactionalEventListenerFactory implements EventListenerFactory, Ordered {
private int order = 50;
public void setOrder(int order) {
this.order = order;
}
@Override
public int getOrder() {
return this.order;
}
@Override
public boolean supportsMethod(Method method) {
return (AnnotationUtils.findAnnotation(method, TransactionalEventListener.class) != null);
}
@Override
public ApplicationListener createApplicationListener(String beanName, Class type, Method method) {
return new ApplicationListenerMethodTransactionalAdapter(beanName, type, method);
}
}