- 浏览: 3369181 次
- 性别:
- 来自: 珠海
文章分类
- 全部博客 (1633)
- Java (250)
- Android&HTML5 (111)
- Struts (10)
- Spring (236)
- Hibernate&MyBatis (115)
- SSH (49)
- jQuery插件收集 (55)
- Javascript (145)
- PHP (77)
- REST&WebService (18)
- BIRT (27)
- .NET (7)
- Database (105)
- 设计模式 (16)
- 自动化和测试 (19)
- Maven&Ant (43)
- 工作流 (36)
- 开源应用 (156)
- 其他 (16)
- 前台&美工 (119)
- 工作积累 (0)
- OS&Docker (83)
- Python&爬虫 (28)
- 工具软件 (157)
- 问题收集 (61)
- OFbiz (6)
- noSQL (12)
最新评论
-
HEZR曾嶸:
你好博主,这个不是很理解,能解释一下嘛//左边+1,上边+1, ...
java 两字符串相似度计算算法 -
天使建站:
写得不错,可以看这里,和这里的这篇文章一起看,有 ...
jquery 遍历对象、数组、集合 -
xue88ming:
很有用,谢谢
@PathVariable映射出现错误: Name for argument type -
jnjeC:
厉害,困扰了我很久
MyBatis排序时使用order by 动态参数时需要注意,用$而不是# -
TopLongMan:
非常好,很实用啊。。
PostgreSQL递归查询实现树状结构查询
1. System.getProperty()获取tomcat自定义变量
http://zwxiaole.iteye.com/blog/1832053
环境 tomcat 集群 有一个定时器
为了防止所有集群的服务器都跑定时而出错
选择其中一台服务器 修改tomcat bin 目录下的
windows catalina.bat
linux catalina.sh
你定义的变量 必须以-D开头 否则System.getProperty()无法获取到该参数值
以 scheduler.start为例子
set JAVA_OPTS= -Dscheduler.start=true
System.getProperty('scheduler.start')可以获取到 true值
当获取到true时 那台服务器就会开始定时任务 其他服务器就不会开启
2. catalina.bat或者eclipse服务器里面设定的环境变量
http://stackoverflow.com/questions/686591/is-there-a-way-to-resolve-system-properties-in-a-web-xml-file
http://stackoverflow.com/questions/3965446/how-to-read-system-environment-variable-in-spring-applicationcontext
A:在catalina.bat增加JAVA_OPTS="...... -DPANDY_HOME=e:/aaa ...... "
B:在eclipse的tomcat服务器里面设定环境变量(不确定)
-DPANDY_HOME=e:/aaa
在applicationcontext.xml引用
3.Spring类里面读取变量
http://stackoverflow.com/questions/10324702/propertyplaceholderconfigurer-and-environment-variables-in-properties-files
A:
E.g.
or
B:
You must also remember to pass the parameter into the program using
-DJAVA_MY_ENV=xyz
This way when you run the production version you can pass one thing and when you are running tests another.
Also what I often what I do is something like this:
where environment is prod/stage/test/int/ci/local (1 per environment - you may only have 2 or 3 for now). You can pass the environment variable to the program. Any properties which should be the same regardless of if its production/running on your local pc/tests would be in the someprops.properties property file. Any ones specific to the environment/way its being run as will go in the more specific file (you should put it in the someprops.properties file as well as a default unless overridden mechanism)
E.g. in classpath:someprops.properties
url=www.mysite.com
in classpath:someprops-local.properties
url=localhost
By using this basic idea you can separate tests and the program's normal running properties in a clean manner.
http://zwxiaole.iteye.com/blog/1832053
环境 tomcat 集群 有一个定时器
为了防止所有集群的服务器都跑定时而出错
选择其中一台服务器 修改tomcat bin 目录下的
windows catalina.bat
linux catalina.sh
你定义的变量 必须以-D开头 否则System.getProperty()无法获取到该参数值
以 scheduler.start为例子
set JAVA_OPTS= -Dscheduler.start=true
System.getProperty('scheduler.start')可以获取到 true值
当获取到true时 那台服务器就会开始定时任务 其他服务器就不会开启
2. catalina.bat或者eclipse服务器里面设定的环境变量
http://stackoverflow.com/questions/686591/is-there-a-way-to-resolve-system-properties-in-a-web-xml-file
http://stackoverflow.com/questions/3965446/how-to-read-system-environment-variable-in-spring-applicationcontext
A:在catalina.bat增加JAVA_OPTS="...... -DPANDY_HOME=e:/aaa ...... "
B:在eclipse的tomcat服务器里面设定环境变量(不确定)
-DPANDY_HOME=e:/aaa
在applicationcontext.xml引用
<bean id="appProperties" class="com.pandy.config.AppProperties"> <property name="locations"> <list> <value>classpath:resources/default.properties</value> <value>file:${PANDY_HOME}/conf/jdbc.properties</value> </list> </property> </bean>
3.Spring类里面读取变量
http://stackoverflow.com/questions/10324702/propertyplaceholderconfigurer-and-environment-variables-in-properties-files
A:
E.g.
@Value("#{ systemProperties['JAVA_MY_ENV'] }") private String myVar;
or
<property name ="myVar" value="#{systemProperties['JAVA_MY_ENV']}"/>
B:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:someprops.properties</value> </list> </property> <property name="ignoreResourceNotFound" value="true" /> <property name="searchSystemEnvironment" value="true" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
You must also remember to pass the parameter into the program using
-DJAVA_MY_ENV=xyz
This way when you run the production version you can pass one thing and when you are running tests another.
Also what I often what I do is something like this:
<property name="locations"> <list> <value>classpath:someprops.properties</value> <value>classpath:someprops-{environment}.properties</value> </list> </property>
where environment is prod/stage/test/int/ci/local (1 per environment - you may only have 2 or 3 for now). You can pass the environment variable to the program. Any properties which should be the same regardless of if its production/running on your local pc/tests would be in the someprops.properties property file. Any ones specific to the environment/way its being run as will go in the more specific file (you should put it in the someprops.properties file as well as a default unless overridden mechanism)
E.g. in classpath:someprops.properties
url=www.mysite.com
in classpath:someprops-local.properties
url=localhost
By using this basic idea you can separate tests and the program's normal running properties in a clean manner.
发表评论
-
分布式存储系统GlusterFS安装配置
2016-06-27 14:51 999http://navyaijm.blog.51cto.com/ ... -
分布式查询 presto 入门安装使用
2016-06-24 15:44 2471http://my.oschina.net/chengxiao ... -
跟我学习dubbo
2016-06-17 15:20 1036跟我学习dubbo-目录 http://bluereader. ... -
JavaMelody监控web服务器
2016-06-17 14:20 1152JavaMelody监控web服务器 http://my.os ... -
freemarker使用记录
2016-06-08 16:24 1284freeMarker语法 http://uule.iteye. ... -
freemarker判断是否为空
2016-06-08 16:03 2http://www.oschina.net/code/sni ... -
ehcache 分布式支持
2016-06-05 22:26 1061原文 http://my.oschina.net/glenxu ... -
Intellij IDEA插件开发入门
2016-05-26 11:42 2850原文: http://blog.csdn.net/dc_726 ... -
阿里巴巴Druid数据源的配置与使用
2016-05-24 17:42 1503http://my.oschina.net/wjme/blog ... -
分布式任务调度组件 Uncode-Schedule
2016-05-13 14:47 2247http://www.oschina.net/p/uncode ... -
mysql中间件研究(Atlas,cobar,TDDL), 分库分表插件
2016-05-09 14:15 3397http://www.guokr.com/blog/47576 ... -
Fedora安装Redis
2016-05-04 08:56 1384管理工具: centos6.3下安装phpredisadmin ... -
redis-install.sh
2016-05-04 08:56 4#!/bin/bash # From here: http: ... -
redis 集群中Session解决方案之Spring Session
2016-05-04 08:54 1277集群中Session解决方案之Spring Session h ... -
使用Spring-data进行Redis操作
2016-05-04 08:54 4739使用Spring-data进行Redis操作 http://z ... -
Shiro集群实现
2016-05-04 08:53 2268apache shiro集群实现(一) session共享 h ... -
spring 注解方式下使用commons-validator 验证表单
2016-05-03 11:08 3041原文: http://www.programgo.com/ar ... -
Apache Lucene 5.x版本 示例
2016-04-28 15:46 1103http://blog.csdn.net/isea533/ar ... -
Hessian 二进制RPC协议整合到SpringMVC
2016-04-27 09:47 1707SpringMVC集成Hessianhttp://blog.c ... -
shiro过滤器过滤属性含义
2016-04-21 13:51 1279http://my.oschina.net/cng1985/b ...
相关推荐
MyEclipse + JDK + Tomcat 环境变量配置
视频教您如何配环境变量,直观,简单,容易上手
J2EE开发框架的搭建过程,环境变量的配置非常详细!!非常符合初学者的一步步摸索!
linux下基本环境搭建,j2ee开发环境的搭建,包括java环境变量,应用服务器,共享文件夹等。。。。
JDK的安装及其系统环境变量的设置, tomcat的安装及其环境变量的设置
访问环境变量 65 企业Bean的比较 66 访问企业Bean的远程对象引用 67 第5章 BMP的例子 68 一.SavingsAccountEJB 68 实体Bean类(SavingsAccountBean) 69 EntityBean接口 69 ejbCreate方法 70 EjbPostCreate方法 71 ...
如何安装JDK、 Tomcat,配置环境变量。测试JDK是否安装好。如何配置JSP开发环境。
8.2.单机应用可以透明的迁移到集群环境 -- 否定! 8.2.1.HTTP会话 8.2.2.缓存 8.2.3.静态变量 8.2.4.外部资源 8.2.5.特殊的服务 8.3.分布式结构比单一结构更灵活 ?C 未必 9.总结 10.关于作者 11.附录A:中英文对照...
实验一 熟悉J2EE编程环境 7 一、实验目的及任务 7 二、实验环境 7 三、实验步骤 7 1、JDK150的下载、安装和配置 7 ①新增系统变量JAVA_HOME: 7 ②编辑系统变量Path: 8 2、下载、安装Tomcat web服务器 9 3、下载、...
里面全面的给出集成Myeclipse需要的软件,环境变量,和相关的集成顺序,等。
完整的环境变量配置 JAVA_HOME=D:\J2EE\j2sdk1.5.0_06 TOMCAT_HOME=F:\apache-tomcat-5.5.12 PATH=%JAVA_HOME%\bin;%TOMCAT_HOME%\bin; CLASSPATH=.;%JAVA_HOME%\lib
这个文档中记载了J2EE中JDK与Tomcat环境变量配置的具体操作,希望可以帮上大家的忙。
目 录 2 实验一 Tomcat+JSP配置 3 实验二 JSP程序的编写 6 实验三 JDBC的应用 11 实验四 SERVLET编程 15 实验五 JavaBean 19 实验六 EJB 23 实验七 XML 24 实验八 25
它是基于java编写的j2ee代码自动生成工具暨数据库管理工具,运行于jdk1.5环境中,目前版本支持Oracle、mysql、mssql三种常用的数据库,以后会视情况扩充至其它种类的关系型数据库。它的功能类似于MyEclipse的自动...
本系统的开发平台: ... 在实际开发中需要在服务器端事先安装JAVA运行环境并需要配置相应的环境变量。此外系统中访问数据库采用纯JDBC直接连接数据库的方式,还要安装SQL Server2000 的JDBC数据库驱动程序。
java环境变量配置,tomcat在eclipse和myeclipse中的配置
全称Haiv Database Tool for J2EE,是基于java编写的j2ee代码自动生成工具暨数据库管理工具,运行于jdk1.5环境中,目前版本支持Oracle、mysql、mssql三种常用的数据库,以后会视情况扩充至其它种类的关系型数据库。...
Java是由sun公司开发的新一代纯面向对象的网络编程语言,其目标是建立一种在任意种机器、任一种操作系统的网络环境中运行的软件,实行所谓的“程序写一次,到处运行”的目标。正因为如此,Java已成为当今Internet上...
J2EE_HOME指J2EE SDK安装路径——在系统中增加JAVA_HOME和J2EE_HOME两个环境变量。 2.保证在d:盘根路径下安装Apache的Tomcat 5.5.20,不要使用安装文件安装,而是采用解压缩的安装方式。即:Tomcat的安装路径为d:...
J2EE_HOME指J2EE SDK安装路径——在系统中增加JAVA_HOME和J2EE_HOME两个环境变量。 2.保证在d:盘根路径下安装Apache的Tomcat 5.5.20,不要使用安装文件安装,而是采用解压缩的安装方式。即:Tomcat的安装路径为d:...