Announcement Announcement Module
No announcement yet.
Stop Spring searching for BeanInfo classes - performance issue loading applet Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stop Spring searching for BeanInfo classes - performance issue loading applet

    Our application is deployed as an applet and we use Spring on the client and server. On the client see see a lot of messages like this in the Java console.

    basic: JNLP2ClassLoader.findClass: try again ..

    Spring is attempting to lookup BeanInfo classes for some of our Spring beans, which is resulting in a lot of calls back to the server as the Classloader attempts to search for these classes. We don't have any BeanInfo classes so I was hoping to avoid these calls.

    I've managed to fix this as follows, but I'm not sure if this is the correct approach as I'm relying on something in SpringFactoriesLoader which the java docs state is 'for internal use within the framework'

    In Spring 3.2.2.RELEASE CachedIntrospectionResults has been updated to use a list of BeanInfoFactory's (if any are defined) before calling the standard Introspector. The BeanInfoFactory's are loaded by SpringFactoriesLoader which looks for a META-INF/spring.factories file.

    So I've created a custom BeanInfoFactory which uses an Introspector (but with the IGNORE_ALL_BEANINFO flag) and updated our application JAR with a spring.factories file.

    public class OisBeanInfoFactory implements BeanInfoFactory {
        public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {             
            BeanInfo info = null;     
            //Search for BeanInfo for the specified class.  The flag IGNORE_IMMEDIATE_BEANINFO means that for class 'Foo' the Introspector won't search for a 'FooBeanInfo' class.
            //Instead it will use standard reflection - see Java docs in Introspector class 
            if (beanClass != null && beanClass.getPackage().getName().startsWith("")) {
                info = Introspector.getBeanInfo(beanClass, Introspector.IGNORE_ALL_BEANINFO);
            return info;
    This works fine and stops Spring attempting to load BeanInfo files for our Spring Beans. But is there a better way to do this (and is there any way to do this in Spring 3.1.0.RELEASE)?

    Also, does anyone know if its possible to stop the Introspector searching for 'Customizer' class? I'm still getting a lot of messages like this:

    basic: JNLP2ClassLoader.findClass: try again ..