Skip to content

Commit 59b8a13

Browse files
committed
JndiObjectFactoryBean explicitly only chooses public interfaces as default proxy interfaces (SPR-5869)
1 parent 9c44f92 commit 59b8a13

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

org.springframework.context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
package org.springframework.jndi;
1818

1919
import java.lang.reflect.Method;
20-
20+
import java.lang.reflect.Modifier;
2121
import javax.naming.Context;
2222
import javax.naming.NamingException;
2323

@@ -295,7 +295,12 @@ private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws Na
295295
throw new IllegalStateException(
296296
"Cannot deactivate 'lookupOnStartup' without specifying a 'proxyInterface' or 'expectedType'");
297297
}
298-
proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader));
298+
Class[] ifcs = ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader);
299+
for (Class ifc : ifcs) {
300+
if (Modifier.isPublic(ifc.getModifiers())) {
301+
proxyFactory.addInterface(ifc);
302+
}
303+
}
299304
}
300305
if (jof.exposeAccessContext) {
301306
proxyFactory.addAdvice(new JndiContextExposingInterceptor(jof.getJndiTemplate()));

0 commit comments

Comments
 (0)