Spring framework default-lazy-init all beans

Is there a spring property for lazy-init all beans that loads the spring framework?

I know about these properties.

 - lazy-init="true"
 - default-lazy-init="true"

however, there are several xmax w760 configuration files, and some of them are packaged in jar, so they are not allowed to modify either <bean> or <beans & gt; tag.

Any other way to solve this problem through configuration? or programmatically?

+5
source share
4 answers

The Spring bean bootloader extension that I don't know about is ending.

+2
source

You can also use annotation @Lazy, but it is the same as you mentioned above.

+2
source

java doc ( )

if (context.getBeanFactory() instanceof DefaultListableBeanFactory)
    {
        ((DefaultListableBeanFactory) context.getBeanFactory()).setAllowEagerClassLoading(false);
    }
0

I implemented this in my company, I had to expand some spring hard classes. This was not easy, but we got about 20 seconds on every tomcat launch. Unfortunately, for privacy terms, I can’t show the code, but check out the ClassPathBeanDefinitionScanner, DefaultBeanDefinitionDocumentReader, ContextNamespaceHandler, and ComponentScanBeanDefinitionParser classes.

0
source

All Articles