- 浏览: 3444072 次
- 性别:
- 来自: 珠海
-
文章分类
- 全部博客 (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 1046http://navyaijm.blog.51cto.com/ ... -
分布式查询 presto 入门安装使用
2016-06-24 15:44 2516http://my.oschina.net/chengxiao ... -
跟我学习dubbo
2016-06-17 15:20 1086跟我学习dubbo-目录 http://bluereader. ... -
JavaMelody监控web服务器
2016-06-17 14:20 1194JavaMelody监控web服务器 http://my.os ... -
freemarker使用记录
2016-06-08 16:24 1325freeMarker语法 http://uule.iteye. ... -
freemarker判断是否为空
2016-06-08 16:03 2http://www.oschina.net/code/sni ... -
ehcache 分布式支持
2016-06-05 22:26 1114原文 http://my.oschina.net/glenxu ... -
Intellij IDEA插件开发入门
2016-05-26 11:42 2905原文: http://blog.csdn.net/dc_726 ... -
阿里巴巴Druid数据源的配置与使用
2016-05-24 17:42 1561http://my.oschina.net/wjme/blog ... -
分布式任务调度组件 Uncode-Schedule
2016-05-13 14:47 2301http://www.oschina.net/p/uncode ... -
mysql中间件研究(Atlas,cobar,TDDL), 分库分表插件
2016-05-09 14:15 3477http://www.guokr.com/blog/47576 ... -
Fedora安装Redis
2016-05-04 08:56 1434管理工具: 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 1339集群中Session解决方案之Spring Session h ... -
使用Spring-data进行Redis操作
2016-05-04 08:54 4822使用Spring-data进行Redis操作 http://z ... -
Shiro集群实现
2016-05-04 08:53 2329apache shiro集群实现(一) session共享 h ... -
spring 注解方式下使用commons-validator 验证表单
2016-05-03 11:08 3094原文: http://www.programgo.com/ar ... -
Apache Lucene 5.x版本 示例
2016-04-28 15:46 1161http://blog.csdn.net/isea533/ar ... -
Hessian 二进制RPC协议整合到SpringMVC
2016-04-27 09:47 1764SpringMVC集成Hessianhttp://blog.c ... -
shiro过滤器过滤属性含义
2016-04-21 13:51 1328http://my.oschina.net/cng1985/b ...
相关推荐
J2EE开发环境搭建资源摘要 J2EE开发环境搭建是指创建一个完整的J2EE开发环境,包括安装JDK、Tomcat和Eclipse。...J2EE开发环境搭建是J2EE开发的重要一步,需要安装JDK、Tomcat和Eclipse,并设置相关的环境变量。
### j2ee环境搭建全套知识点详解 #### 一、引言 在进行Java企业级应用开发之前,构建一个稳定且高效的开发环境至关重要。本篇文章将详细介绍如何从零开始搭建一个完整的j2ee(Java 2 Platform, Enterprise Edition...
### J2EE环境搭建详解 #### 一、背景与需求 在IT行业,尤其是软件开发领域,掌握如何搭建开发环境是每位程序员的基本功之一。本文将深入探讨如何从零开始搭建J2EE(Java 2 Platform, Enterprise Edition)开发环境...
### J2EE环境配置知识点详解 #### 一、J2EE环境概述 J2EE(Java 2 Platform, Enterprise Edition)是一种广泛应用于企业级应用开发的技术标准,它为开发者提供了强大的工具来构建分布式多层应用。J2EE的核心组件...
### J2EE开发框架搭建及环境变量配置详解 #### 一、下载所需软件 为了搭建一个完整的J2EE开发环境,我们需要下载以下软件: - **JDK**: Java Development Kit,用于提供Java编程语言所需的工具集。 - **Eclipse**: ...
视频教您如何配环境变量,直观,简单,容易上手
### J2EE环境配置详解 #### 一、概述 本文档旨在详细介绍如何在开发环境中配置J2EE(Java 2 Enterprise Edition)相关的组件,包括Eclipse、MyEclipse、Tomcat以及与版本控制系统Visual SourceSafe (VSS)的集成。...
- 如果Tomcat无法正常启动,需要配置相应的环境变量: - 新建系统变量`CATALINA_HOME`,值为`C:\tomcat`。 - 新建系统变量`CATALINA_BASE`,值为`C:\tomcat`。 - 修改系统变量`Classpath`,追加`%CATALINA_HOME%\...
【J2EE开发环境搭建】涉及的关键知识点包括: ...总的来说,搭建J2EE开发环境涉及多个步骤,包括软件的安装、环境变量的配置、IDE的设置以及可能遇到的问题解决。正确配置这些环境对于进行J2EE应用的开发至关重要。
- 配置环境变量JAVA_HOME:在系统属性中添加变量JAVA_HOME,并设置其值为JDK的安装路径。 - 配置path环境变量:在系统变量中找到path变量,添加`%JAVA_HOME%\bin;`。 - 测试JDK是否安装成功:在命令行中输入`java -...
- 完成安装后,需要配置环境变量来确保系统能够识别并使用该JDK版本。 2. **配置环境变量**: - 打开“我的电脑”属性 -> 高级 -> 环境变量。 - 新建环境变量`JAVA_HOME`: 值为`D:\j2sdk`。 - 新建环境变量`...
至此,Linux下的J2EE环境已经搭建完成,你可以将打包好的J2EE应用(WAR文件)部署到Tomcat的webapps目录下,然后通过访问相应的URL来运行应用。需要注意的是,实际环境中还需要考虑防火墙设置、用户权限、日志监控等...
- 配置服务器的运行环境,包括设置JAVA_HOME环境变量指向JDK的安装路径,确保服务器能够使用JDK来解析和运行Java代码。 - 根据服务器文档,配置服务器的启动脚本,可能涉及端口、应用目录、数据库连接等设置。 4....
### j2ee环境配置详解:从零到精通 在IT领域,Java 2 Platform, Enterprise Edition(简称J2EE)是一套广泛应用于企业级应用开发的技术标准,它为开发、部署和管理多层分布式应用程序提供了全面的支持。对于初学者...
然后,同样需要设置环境变量`CATALINA_HOME`指向Tomcat的安装目录,并通过`/etc/profile`更新环境变量。为了启动Tomcat,可以运行`/usr/tomcat/bin/startup.sh`。验证安装是否成功,可以在浏览器中访问`...
#### 一、JDK的安装及系统环境变量配置 在构建Java企业级应用开发环境时,首先需要安装并配置Java Development Kit (JDK)。JDK是Java开发的基础,包含了Java运行环境(JRE)、Java工具和Java文档等。 **1. JDK安装...
进入`/etc/profile.d/`目录,创建一个名为`JAVA.sh`的文件,使用vi编辑器输入环境变量设置,例如: ``` JAVA_HOME=/ltw/jdk1.6.0_11 CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar PATH=$JAVA_HOME/bin...