overridden @PersistenceContext annotations on subclass methods are being processed correctly (SPR-8594)

This commit is contained in:
Juergen Hoeller
2011-08-12 13:54:44 +00:00
parent da36c2b8b8
commit 65077d262c
2 changed files with 46 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@@ -382,7 +382,7 @@ public class PersistenceAnnotationBeanPostProcessor
for (Method method : targetClass.getDeclaredMethods()) {
PersistenceContext pc = method.getAnnotation(PersistenceContext.class);
PersistenceUnit pu = method.getAnnotation(PersistenceUnit.class);
if (pc != null || pu != null &&
if ((pc != null || pu != null) &&
method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
if (Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("Persistence annotations are not supported on static methods");