java 如何减少初始化 Spring 根 WebApplicationContext 的时间?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14066851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to reduce the Initializing Spring root WebApplicationContext time?
提问by Mahendran
I know that this question is too vague for anyone to provide a solution but I can provide more details if required.
我知道这个问题对任何人来说都太模糊了,无法提供解决方案,但如果需要,我可以提供更多详细信息。
My web application is using spring and I have deployed it to JBoss server, while jboss start-up "Initializing Spring root WebApplicationContext" is nearly taking 20 minutes. Am I having any options to reduce this? I have close to 300 beans in 20 or more xml files.
我的 web 应用程序正在使用 spring 并且我已经将它部署到 JBoss 服务器,而 jboss 启动“初始化 Spring root WebApplicationContext”几乎需要 20 分钟。我有什么选择可以减少这种情况吗?我在 20 个或更多 xml 文件中有接近 300 个 bean。
Please advice.
请指教。
采纳答案by NPKR
Here are some Best practices TIPS for Spring, compare these steps to Your application.
以下是 Spring 的一些最佳实践 TIPS,将这些步骤与您的应用程序进行比较。
https://developers.google.com/appengine/articles/spring_optimization
https://developers.google.com/appengine/articles/spring_optimization
回答by Vinay Lodha
why don't specify lazy loading of beans. So they dont get created at Server startup
为什么不指定 bean 的延迟加载。所以它们不会在服务器启动时创建
回答by Mahendran
It got reduced to 4 minutes after commenting out the following from run.conf.bat:
从 run.conf.bat 注释掉以下内容后,它减少到 4 分钟:
rem set "JAVA_OPTS=%JAVA_OPTS% -agentpath:C:\yjp\YourKit-Java-Profiler-11.0.1\bin\win32\yjpagent.dll"