Spring版本HelloWorld
来源:互联网 发布:判断二维数组是否为空 编辑:程序博客网 时间:2024/05/18 23:26
Main.java
import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import com.gc.action.HelloWorld;public class Main {/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubApplicationContext context = new ClassPathXmlApplicationContext("config.xml"); HelloWorld helloWorld = (HelloWorld) context.getBean("HelloWorld"); System.out.println(helloWorld.getMsg());}}
HelloWorld.java
package com.gc.action;public class HelloWorld {public String msg = null;public String getMsg() {return msg;}public void setMsg(String msg) {this.msg = msg;}}
config.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <bean id="HelloWorld" class="com.gc.action.HelloWorld"> <property name="msg"> <value>贾楠,10级软件工程1班</value> </property> </bean></beans>
工程目录
0 0
- Spring版本HelloWorld
- Spring MVC版本的helloworld
- Spring Boo之helloworld(myeclipse版本)
- Spring helloworld
- spring helloworld
- spring helloworld
- Spring -- HelloWorld
- spring helloworld
- Spring HelloWorld
- Spring--HelloWorld
- spring HelloWorld!
- spring-HelloWorld
- spring helloworld
- Spring-HelloWorld
- spring HelloWorld
- spring-1:Spring helloWorld
- Spring 之spring helloworld
- annotation版本的helloworld
- PNG Encrpyt加密和解密开发
- 二分+贪心-uva-1335 - Beijing Guards
- AnyChat游戏视频开发平台的特点?
- spring与mybatis三种整合方法
- 追逐繁星的孩子
- Spring版本HelloWorld
- Android Fragment完全解析,关于碎片你所需知道的一切
- 我的2013年
- matlab编程入门学习(4)
- 去除在线看电影或者电视剧、综艺节目之前各种广告
- POX学习笔记之组件注册与事件
- google collections介绍
- Qt的线程和 signal-slot
- java设计模式学习笔记-适配器模式