锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线视频中文字幕,av岛国在线,国产欧美一区二区三区久久http://www.aygfsteel.com/haiing/category/28992.html鏂扮殑璧風(fēng)偣zh-cnSun, 03 Feb 2008 01:29:08 GMTSun, 03 Feb 2008 01:29:08 GMT60Spring鑷絎旇(1)http://www.aygfsteel.com/haiing/archive/2008/01/29/178295.html杞ч挗鐜嬪瓙杞ч挗鐜嬪瓙Tue, 29 Jan 2008 00:19:00 GMThttp://www.aygfsteel.com/haiing/archive/2008/01/29/178295.htmlhttp://www.aygfsteel.com/haiing/comments/178295.htmlhttp://www.aygfsteel.com/haiing/archive/2008/01/29/178295.html#Feedback0http://www.aygfsteel.com/haiing/comments/commentRss/178295.htmlhttp://www.aygfsteel.com/haiing/services/trackbacks/178295.html鐢ㄤ簡(jiǎn)涓孌墊椂闂寸殑鍏徃妗嗘灦錛岃繕娌℃椂闂磋鐪熺殑鍧愪笅鏉ョ粌涔?fàn)涓涓?/span>Spring寮婧愭鏋剁殑鍩虹錛岀湡鏄湁浜涗笉濂芥剰鎬濄傚垰鐪嬪畬鍦ㄧ綉涓婁笅鐨勫叧浜?/span>Spring鐨勮棰戞暀紼嬶紝姝eソ緇冧範(fàn)涓涓嬶紝灝變互姘存灉浣滀負(fù)浠婂ぉ渚嬪瓙紼嬪簭鐨勪富瑙掋?/span>

鎵撳紑Myeclipse錛屾坊鍔犲Spring鐨勬敮鎸侊紙涔熶笉鐭ラ亾榪欎箞閫夎涓嶈錛屾睏锝烇級(jí)

       鎺ヤ笅鏉ユ寜鐓ч粯璁よ緗洿鎺ョ偣鍑?/span>Next錛屾渶鍚庣偣瀹屾垚鍗沖彲銆傞」鐩腑鐢熸垚浜?jiǎn)浼犺涓姛鑳藉己澶х?/span>Spring閰嶇疆鏂囦歡applicationContext.xml錛屽搱鍝堬紝浜蹭竴涓紒

       鐜璁劇疆濂戒簡(jiǎn)錛屾帴涓嬫潵璇ョ紪鍐欑被鏂囦歡浜?jiǎn)銆傚厛鐢熸垚涓涓?/span>Fruit鎺ュ彛錛?br />

1package com.haiing.myspring;
2
3public interface Fruit 
4
5{
6       //鍚冩按鏋?/span>
7       public void eat();
8}

9

       鎺ョ潃緙栧啓瀹炵幇姝ゆ帴鍙g殑綾繪枃浠訛細(xì)

 1package com.haiing.myspring;
 2
 3public class Apple implements Fruit {
 4
 5  public void eat() {
 6
 7              // 鍚冭嫻鏋?/span>
 8
 9              System.out.println("鎴戣鍚冭嫻鏋滀簡(jiǎn)锝烇綖锝?/span>") ;       
10
11       }

12
13}

14


 1package com.haiing.myspring;
 2
 3public class potato implements Fruit 
 4{
 5       public void eat() 
 6       {
 7
 8            // 鍚冭タ綰㈡熆
 9
10              System.out.println("鎴戣鍚冭タ綰㈡熆浜?jiǎn)锝烇綖锝?/span>") ;
11       }

12}

13


 1package com.haiing.myspring;
 2
 3public class Orange implements Fruit {
 4
 5       public void eat() {
 6
 7              // 鍚冩瀛?/span>
 8
 9              System.out.println("鎴戣鍚冩瀛愪簡(jiǎn)锝烇綖锝?/span>") ;
10
11       }

12
13}

14


       鎺ュ彛鏂囦歡鍐欏ソ浜?jiǎn)锛岀幇鍦ㄨ鍐檵箣璇暰c誨拰閰嶇疆Spring鏂囦歡浜?jiǎn)銆?/span>

       璁劇疆applicationContext.xml閰嶇疆鏂囦歡濡備笅錛?/span>

<?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="apple" class="com.haiing.myspring.Apple"></bean>

    
<bean id="potato" class="com.haiing.myspring.Potato"></bean>

    
<bean id="orange" class="com.haiing.myspring.Orange"></bean>

</beans>


       緙栧啓涓涓祴璇曠被鏂囦歡錛?/span>

 1package com.haiing.myspring;
 2
 3import org.springframework.context.ApplicationContext;
 4
 5import org.springframework.context.support.ClassPathXmlApplicationContext;
 6
 7public class TestFruit 
 8
 9{
10       public static void main(String[] args)
11       {
12
13              ApplicationContext context = null ;
14
15              context = new ClassPathXmlApplicationContext("applicationContext.xml") ;
16
17              Fruit fruit = (Fruit)context.getBean("orange") ; 
18
19              fruit.eat() ;            
20       }

21}

22

 

鐜板湪鍙互寮濮嬫祴璇曟晥鏋滀簡(jiǎn)錛岃繍琛屾祴璇曠被錛屽湪鎺у埗鍙拌緭鍑猴細(xì)

鎴戣鍚冭嫻鏋滀簡(jiǎn)锝烇綖锝?/span>

log4j:WARN No appenders could be found for logger (org.springframework.beans.factory.xml.XmlBeanDefinitionReader).

log4j:WARN Please initialize the log4j system properly.

澶у姛鍛婃垚錛屼笅闈㈢孩瀛楁彁紺烘槸鍥犱負(fù)娌℃湁璁劇疆鏃ュ織銆傝繖鏍鳳紝鍦ㄨ嫻鏋滄定浠蜂箣鍚庯紝鎴戜滑灝卞彲浠ユ柟渚跨殑淇敼嫻嬭瘯鏂囦歡錛屾崲鎴愬叾浠栫殑姘存灉錛岀収鍚冧笉璇簡(jiǎn)锝?/span>

涓嶈繃璇濆張璇村洖鏉ヤ簡(jiǎn)錛屾崲褰掓崲錛屽悆鍏朵粬鐨勪笢瑗垮彲鏄悆涓嶅嚭鑻規(guī)灉鐨勫懗閬撳憖



]]>
主站蜘蛛池模板: 库伦旗| 成武县| 潮州市| 拉萨市| 平安县| 兴城市| 阳原县| 长泰县| 中西区| 浦东新区| 德昌县| 新津县| 那坡县| 灯塔市| 宜阳县| 扶沟县| 湖南省| 清河县| 通渭县| 红原县| 大足县| 龙泉市| 凤台县| 民丰县| 柞水县| 宁化县| 龙江县| 石渠县| 神池县| 广汉市| 深州市| 咸丰县| 东阳市| 东丽区| 孝昌县| 东安县| 长海县| 肇州县| 垦利县| 霍山县| 铜鼓县|