Performance difference between spring javaconfig, xml config and annotations

前端 未结 4 563
天命终不由人
天命终不由人 2021-01-12 10:50

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 sav

4条回答
  •  再見小時候
    2021-01-12 11:30

    I actually tried this a while back and depressingly it was not faster.. or at least not perceivable faster. In some cases when I actually measured it was slower (ever so slightly). I wish I had numbers but it was one of those quick tests for my own benefit. I also didn't have 1200 beans but about 200.

    I also noticed mixing XML and Java config gave the worst performance (ever so slightly).

    What I have found to be the bottleneck in my Spring bootup time is Hibernate. I'm doing another project with much of the same config w/o Hibernate using JDBC and the bootup time is about 1/3.

提交回复
热议问题