我如何自动装配速度模板?

发布于 2024-09-30 21:43:50 字数 159 浏览 3 评论 0原文

我有一个需要使用的静态速度模板,所以我想知道是否可以自动装配它而不是这样做:

Template template = velocityEngine.getTemplate("com/templates/template.vm");

谢谢

I have a static velocity template that I need to use, so I was wondering if it is possible to autowire it instead of doing:

Template template = velocityEngine.getTemplate("com/templates/template.vm");

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

是你 2024-10-07 21:43:50

您可以创建一个 FactoryBean 来生成速度模板作为其结果,然后 ApplicationContext 将能够将其自动装配到任何需要它的 bean 中。如果需要的话我可以给你寄一份样品。

You can create a FactoryBean that generates the velocity template as its result, and then the ApplicationContext will be able to autowire it into whatever beans need it. I can send you a sample if need be.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文