• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::

            給點信心,來個簡單的 HelloWorld

            使用到的類: Action, UpperAction, BeanFactoryTest

            使用到的bean配置文件: bean.xml

            使用到的Spring包: org.springframework.beans-3.0.5.jar, org.springframework.core-3.0.5.jar

            另外的包: commons-logging-1.1.1.jar

            ----------------------------------------Action.java----------------------------------------

            面向接口

            public interface Action {

                public String execute(String str);

            }


            -------------------------------------UpperAction.java-------------------------------------

            public class UpperAction implements Action {

                private String message;

                

                @Override

                public String execute(String str) {

                    return (getMessage() + str).toUpperCase();

                }


                public String getMessage() {

                    return message;

                }

                

                public void setMessage(String message) {

                    this.message = message;

                }

            }


            ----------------------------------BeanFactoryTtest.java----------------------------------

            BeanFactory 就是 Spring 容器

            import org.springframework.beans.factory.BeanFactory;

            import org.springframework.beans.factory.xml.XmlBeanFactory;

            import org.springframework.core.io.FileSystemResource;

            import org.springframework.core.io.Resource;


            public class BeanFactoryTest {

                public static void main(String[] args) {

                    Resource resource = new FileSystemResource("bean.xml");

                    BeanFactory factory = new XmlBeanFactory(resource);

                    Action action = (Action)factory.getBean("theAction");

                    System.out.println(action.execute("Biao"));

                }

            }


            ----------------------------------------bean.xml----------------------------------------

            <?xml version="1.0" encoding="UTF-8"?>

            <!DOCTYPE beans PUBLIC 

                "-//SPRING//DTD BEAN 2.0//EN" 

                "http://www.springframework.org/dtd/spring-beans-2.0.dtd">


            <beans>

                <description>Spring Quick Start</description>

                <bean id="theAction" class="UpperAction">

                    <property name="message">

                        <value>HeLLo World:</value>

                    </property>

                </bean>

            </beans>

             

             

             

            posted on 2010-11-04 18:59 逛奔的蝸牛 閱讀(224) 評論(0)  編輯 收藏 引用 所屬分類: Java
            亚洲精品白浆高清久久久久久 | 国产亚洲成人久久| 久久青青草原国产精品免费| 一本伊大人香蕉久久网手机| 四虎国产精品成人免费久久| 99久久婷婷国产综合亚洲| 国産精品久久久久久久| 色婷婷久久综合中文久久蜜桃av| 狠狠88综合久久久久综合网| 久久久久久免费视频| 9999国产精品欧美久久久久久| 久久人妻少妇嫩草AV蜜桃| 青青草原综合久久大伊人精品| 久久亚洲精品中文字幕| 日韩欧美亚洲综合久久影院Ds| 久久青青草原精品影院| 亚洲国产另类久久久精品| 日产久久强奸免费的看| 一本色道久久88加勒比—综合| 久久精品国产99久久无毒不卡 | 色综合久久久久综合99| 精品久久久久久中文字幕| 国内高清久久久久久| 久久婷婷色综合一区二区| 99久久精品这里只有精品| 国产精品无码久久久久久| 99999久久久久久亚洲| 久久精品亚洲精品国产色婷| 亚洲精品乱码久久久久久蜜桃图片 | 久久久久无码精品国产| 亚洲AV无码1区2区久久| 综合网日日天干夜夜久久| 伊人久久大香线焦AV综合影院| 久久精品国产免费观看| 久久人人爽人人爽人人av东京热 | 香蕉久久av一区二区三区| 国产A级毛片久久久精品毛片| 99精品久久久久中文字幕| 久久久久波多野结衣高潮| 色天使久久综合网天天| 久久精品一本到99热免费|