• <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 逛奔的蝸牛 閱讀(219) 評論(0)  編輯 收藏 引用 所屬分類: Java
            国产精品久久久久乳精品爆| 久久e热在这里只有国产中文精品99 | 亚洲精品高清国产一久久| 久久婷婷国产麻豆91天堂| 欧美午夜A∨大片久久| 99国产欧美久久久精品蜜芽| 久久久噜噜噜久久中文字幕色伊伊| 久久久精品国产sm调教网站| 亚洲精品99久久久久中文字幕| 狠狠久久亚洲欧美专区| 亚洲精品国精品久久99热一| 日本久久中文字幕| AV狠狠色丁香婷婷综合久久 | 久久精品无码专区免费青青 | 亚洲国产精品无码久久九九 | 久久久久国产一级毛片高清板 | 久久精品国产一区二区三区不卡| 久久久久波多野结衣高潮| 久久久久无码精品| 99久久精品午夜一区二区| 久久精品视频一| 久久久久婷婷| 久久97久久97精品免视看| 99精品久久精品| 国内精品久久久久久久97牛牛| 偷偷做久久久久网站| 影音先锋女人AV鲁色资源网久久| 日产精品久久久久久久| 久久99热这里只有精品国产| 久久美女人爽女人爽| 国产成年无码久久久久毛片| 日日噜噜夜夜狠狠久久丁香五月| 午夜精品久久久久久久久| 久久精品国产99国产精品亚洲| 日本WV一本一道久久香蕉| 久久人人爽人人爽人人片AV不| 亚洲?V乱码久久精品蜜桃| 久久露脸国产精品| 久久精品视频一| 三上悠亚久久精品| 天天爽天天爽天天片a久久网|