spring简单示例
2016-02-17 11:14
453 查看
1 配置config.xml
View Code
package com.gc.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; import com.gc.action.HelloWorld; public class TestHelloWorld { public static void main(String[] args) { @SuppressWarnings("resource") ApplicationContext actx = new FileSystemXmlApplicationContext("config.xml"); HelloWorld hello=(HelloWorld)actx.getBean("HelloWorld"); System.out.println(hello.getMsg()); } }
View Code
相关文章推荐
- spring框架之AOP
- java中的队列
- 从第一个Java文件开始
- 深入分析JavaWeb -- 国际化(i18n)
- java中int类型和byte[]数组之间的转换
- Collection集合
- 深入分析JavaWeb 21 -- JSTL核心标签库
- java中映射表
- XML读写之JDOM
- java项目转为maven项目
- Java和C的区别
- java GBK中文乱码问题
- javabean in structs2
- 深入分析JavaWeb 20 -- EL表达式和EL函数库
- mybatis配置多数据源
- spring aop
- Java CookBook--Using a Bag--by Tim O'Brien 整理by博主
- 深入分析JavaWeb 19 -- 基于Servlet+JSP+JavaBean开发模式的用户登录注册
- java中==、equals()、hashCode()
- spring+Quartz集群