从代码中更改应用程序上下文
我有一个小问题。我希望有人能帮助我。
我正在为我的论文开发一个应用程序。 现在我有一个 application-context.properties.txt,我在其中定义:
host= (ip address)
port=8080
现在这是静态的,我将 IP 地址更改为我想要连接的服务器。 但这对于用户来说并不是很有用,因为他无法访问该文件。
现在我的问题是我可以在 Flex 代码中更改此主机 IP 地址吗?我该怎么做呢?
希望有人能帮助我。
亲切的问候,
蒂博·海伦
I have a little problem. I hope someone can help me.
I'm developping an application for my thesis.
Now I have an application-context.properties.txt where I define:
host= (ip address)
port=8080
Now this is static and I change the ip address to the server I want to connect to.
But this isn't verry usefull for the user because he can't access that file.
Now is my question can I change this host ip address from in my flex code? And how do I do that.
Hope someone can help me.
Kind regards,
Thibault Heylen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常配置即 services.xml 在编译时嵌入,此博客
使用 BlazeDS 和 LCDS 外部化服务配置
指出了外部化服务配置的方法,
希望可行,
Usually Configurations i.e services.xml embeds at compile time, this blog
Externalizing Service Configuration using BlazeDS and LCDS
pointed towards way to Externalizing Service Configuration,
hopes that works,
查看文档,
FlexXMLApplicationContext
只是应用程序上下文的一个示例。如果上下文类尚不支持,您可能可以从它或XMLApplicationContext
派生以允许运行时更改配置变量?您将无法更改 XML 文件本身中的值,因为它是已编译的资源,但您应该能够扩展 SpringAS 以在运行时执行您想要的操作。
Looking at the documentation, the
FlexXMLApplicationContext
is just one example of an application context. Possibly, you can derive from it or theXMLApplicationContext
to allow for runtime changes to configuration variables, if the context class doesn't support it already?You won't be able to change the value in the XML file itself, since it is a compiled resource, but you should be able to extend SpringAS to do what you want at runtime.