问题描述
我们的Spring配置包含大约1200个bean,我们使用component-scan / @ Autowired。如果我们将ApplicationContext导出为Xml(并且仍然使用@Autowired),我们在上下文启动时节省了大约10%。
Our Spring configuration contains about 1200 beans, and we use component-scan/@Autowired. If we exported the ApplicationContext as an Xml (and still used @Autowired), we saved about 10% on context startup-time.
如果我们尝试使用spring javaconfig,我们可以期待什么?
What can we expect if we try spring javaconfig ?
推荐答案
注释和XML之间可能没有区别,相反,它将是使用组件扫描的启动性能, 慢。如果您将组件扫描添加到XML版本,您会发现它的速度一样慢。
The difference is likely not between annotations and XML, but instead it'll be the startup performance hit of using component-scanning, which is slow. If you add component-scanning to your XML version, you should find that it's just as slow.
这篇关于spring javaconfig,xml config和注释之间的性能差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!