从基于 Spring 的 Web 应用程序读取文件

发布于 2024-10-02 06:24:44 字数 198 浏览 0 评论 0原文

我正在开发一个基于 Spring 的 JMS 应用程序,它将部署为 Web 应用程序。除了带有加载 Spring 上下文的侦听器的 web.xml 之外,它没有 servlet 部分。当JMS监听器收到消息时,我需要读取资源文件来获取回复消息。但我不确定将资源文件放在Web应用程序中的哪里以及如何在读取文件的Java命令中指定文件路径。有人可以解释一下吗?

谢谢。

I am developing a Spring based JMS application which will be deployed as a web application. It has no servlet part except the web.xml with listener which loads the Spring context. When JMS listener receive a message, I need to read a resource file to get the reply message. But I am not sure where to put the resource file inside web app and how to specify the file path in the Java command which reads the file. Can somebody explain?

Thank you.

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

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

发布评论

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

评论(1

感性不性感 2024-10-09 06:24:44

你的问题很模糊,但我建议你阅读 Spring 参考手册的章节 I/O 资源。 Spring 提供了一个非常好的Resource 抽象来完成这类事情。

不过,您选择如何使用它取决于您。根据您提供给我们的信息,我无法为您提供进一步的建议。

Your question is quite vague, but I suggest you read up on the chapter of the Spring reference manual on I/O Resources. Spring provides a very nice Resource abstraction for doing this sort of thing.

How you choose to use it, though, is up to you. I can't further advise you based on the information you've given us.

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