【Java】Spring源码 If a @Configuration class gets proxied 如何理解?

【Java】Spring源码 If a @Configuration class gets proxied  如何理解?

ConfigurationClassEnhancer enhancer = new ConfigurationClassEnhancer();

for (Map.Entry<String, AbstractBeanDefinition> entry : configBeanDefs.entrySet()) {

AbstractBeanDefinition beanDef = entry.getValue();

// If a @Configuration class gets proxied, always proxy the target class

beanDef.setAttribute(AutoProxyUtils.PRESERVE_TARGET_CLASS_ATTRIBUTE, Boolean.TRUE);

// Set enhanced subclass of the user-specified bean class

Class<?> configClass = beanDef.getBeanClass();

Class<?> enhancedClass = enhancer.enhance(configClass, this.beanClassLoader);

if (configClass != enhancedClass) {

if (logger.isTraceEnabled()) {

logger.trace(String.format("Replacing bean definition '%s' existing class '%s' with " +

"enhanced class '%s'", entry.getKey(), configClass.getName(), enhancedClass.getName()));

}

beanDef.setBeanClass(enhancedClass);

}

}

请问上图中设置的哪个属性有什么意义,该如何理解?

延伸问题一:
【Java】Spring源码 If a @Configuration class gets proxied  如何理解?

延伸问题二:
【Java】Spring源码 If a @Configuration class gets proxied  如何理解?

这个配置有什么意义啊

回答

以上是 【Java】Spring源码 If a @Configuration class gets proxied 如何理解? 的全部内容, 来源链接: utcz.com/a/88133.html

回到顶部