如何从POP3Server类访问James的config.xml?
我正在更改 James POP3Server 类的某些部分,然后通过 IoC 注入它。 我需要配置一些我喜欢在修改中使用的部分,并且我认为如果可以使用 config.xml 来存储我的设置会很方便。
POP3Server.class
<-> config.xml
(可以直接访问吗?)
有没有一种简单的方法来访问这个 XML 或者我必须在 James 内部更深处的地方访问它?
I am changing some parts of the James POP3Server
class and inject it afterwards via IoC.
I need to configure some parts I like to use in my modifications, and I thought it would be handy if I could use the config.xml
to store my settings.
POP3Server.class
<-> config.xml
(direct access possible?)
Is there a easy way of accessing this XML or do I have to access it somewhere deeper inside James?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
org.apache.james.pop3server.POP3Server
的代码并找到public void configure(final Configuration configuration)
:这使用来自的 XML 处理服务器的配置代码>config.xml
。例如,如果您将james-config
文件中的 POP3Server XML 配置块修改为如下所示:您将能够在
configure
中添加一行,如下所示:这里的
25
是缺少配置变量时的默认值。让我知道这是否符合您的要求。Look at the code for
org.apache.james.pop3server.POP3Server
and findpublic void configure(final Configuration configuration)
: this handles configuration of the server with the XML fromconfig.xml
. For example, if you modify the POP3Server XML configuration block in thejames-config
file to look like this:you'll be able to add a line in
configure
like this:The
25
here is the default in the case where the config variable is missing. Let me know if that does what you want.