Tomcat 7 日志内容有效的web.xml
这可能是显而易见的,但我找不到任何细节。在观看 Tomcat 7 上的视频后,提到可以在处理 Web 应用程序中的所有注释后记录最终的 web.xml。此时,您可以将metadata-complete设置为true并使用web.xml进行生产,从而提高性能。我已经对带注释的 servlet 进行了快速测试,并且在日志(或与此相关的其他任何地方)中没有看到任何生成的 web.xml。我想我错过了一些东西。有人设法做到这一点吗?
This is probably obvious, but I can't find any details on it. After watching a video on tomcat 7, it was mentioned that it was possible to log the final web.xml after all the annotations in a web app had been processed. At this point, you could set metadata-complete to true and use the web.xml for production, thus improving performance. I've ran a quick test on an annotated servlet and I've not seen any generated web.xml in the logs (or anywhere else for that matter). I guess I'm missing something. Anyone managed to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,
我找到了答案,我似乎在 docs 中错过了这一点:
因此,这是定义上下文并将该属性设置为 true 的情况。我会试一试,让你知道我的进展如何。
Ok,
I've found the answer, I seemed to miss this in the docs:
So, it's a case of defining a context and setting this attribute to true. I'll take it for a spin and let you know how I get on.
您想查看该文件中的内容吗?或者只知道它什么时候开始?如果是后者,那么您可以实现 ServletContextListener 并记录您需要在那里看到的任何内容。您也可以在这里初始化和/或销毁应用程序配置。
Are you trying to see what is in that file? Or just know when it is started? If the latter then you can implement ServletContextListener and log whatever you need to see there. This is also where you can initialize and/or destroy an app configs.