开发和生产的属性

编程入门 行业动态 更新时间:2024-10-24 12:20:53
本文介绍了开发和生产的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个GlassFish / j2ee应用程序,我开发一个盒子,生产是一个遥控盒。 我有一个功能,使文件,我需要的文件的位置是不同的,基于我的开发箱或生产。 什么是一种自动的切换方式,所以我不需要根据它被部署在哪里编辑源文件?

解决方案

最简单的方法是定义一个系统属性,指定数据的文件系统位置在哪里。生产应用服务器将定义一个值(在启动脚本中使用 java -D ),并且您的开发应用服务器将定义另一个值。您的应用程序来源将查询系统属性值(使用 System.getProperty())来发现适当的位置。

I have a GlassFish/j2ee application, and I develop on one box, and production is a remote box. I have a function that makes files, and I need the files' location to be different based on my dev box or production. What is an automatic way to do the switching so I do not have to edit the source file based on where it is being deployed?

解决方案

The easiest approach is to define a system property which specifies where the file system location for your data is. The production appserver would define one value (using java -D in the startup script), and your dev app server would define another value. Your application source would consult the system property value (using System.getProperty()) to discover the appropriate location.

更多推荐

开发和生产的属性

本文发布于:2023-11-01 01:18:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547828.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!