org.springframework.aop.support.StaticMethodMatcher Java Examples

The following examples show how to use org.springframework.aop.support.StaticMethodMatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactivePersistenceExceptionTranslationPostProcessor.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 *
 * @param beanFactory              the ListableBeanFactory to obtaining all
 *                                 PersistenceExceptionTranslators from
 * @param repositoryAnnotationType the annotation type to check for
 */
ReactivePersistenceExceptionTranslationAdvisor(ListableBeanFactory beanFactory,
	Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new ReactivePersistenceExceptionTranslationInterceptor(beanFactory);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true) {
		@Override
		public MethodMatcher getMethodMatcher() {
			return new StaticMethodMatcher() {

				@Override public boolean matches(Method method, Class<?> targetClass) {
					Class<?> returnType = method.getReturnType();
					return returnType == Mono.class || returnType == Flux.class;
				}
			};
		}
	};
}