package com.drdg.junit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.drdg.emp.common.Globle;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:spring.xml"})
public class SpringJunit {
@Autowired
private Globle globle;
@Test
public void testGetProperties() {
System.out.println("--- 获取配置文件中信息 ---");
System.out.println(globle.getDriverClassName());
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
让spring加载自己的properties配置文件,在代码中获得配置信息
共21个文件
jar:10个
class:2个
java:2个
2星 需积分: 50 83 下载量 177 浏览量
2015-04-23
13:43:50
上传
评论 1
收藏 3.54MB ZIP 举报
温馨提示
在web应用用写的一些Socket服务等,需要配置IP、端口等信息,我们希望这些信息写到配置文件中,并有spring帮我们加载。
资源推荐
资源详情
资源评论
收起资源包目录
SpringJunitPro.zip (21个子文件)
SpringJunitPro
bin
com
drdg
emp
common
Globle.class 766B
junit
SpringJunit.class 1KB
config.properties 41B
spring.xml 1019B
.settings
org.eclipse.jdt.core.prefs 598B
src
com
drdg
emp
common
Globle.java 439B
junit
SpringJunit.java 658B
config.properties 41B
spring.xml 1019B
.project 390B
.classpath 1KB
lib
spring-core-3.2.0.RELEASE.jar 843KB
spring-expression-3.2.0.RELEASE.jar 189KB
spring-tx-3.1.1.RELEASE.jar 241KB
spring-context-3.2.0.RELEASE.jar 834KB
commons-logging-1.1.1.jar 59KB
spring-aop-3.2.0.RELEASE.jar 327KB
servlet-api-3.0-alpha-1.jar 170KB
spring-beans-3.2.0.RELEASE.jar 591KB
spring-test-3.2.0.RELEASE.jar 441KB
spring-jdbc-3.1.1.RELEASE.jar 395KB
共 21 条
- 1
资源评论
- Cansluck2018-11-12并没有什么用。
- jmdxy2017-11-02垃圾啊 你这种东西也放上来
小傅哥
- 粉丝: 7w+
- 资源: 120
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功