• <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
            久久综合亚洲色HEZYO社区| 久久国产精品波多野结衣AV| 久久免费视频1| 亚洲AV无码一区东京热久久| 精品久久人人爽天天玩人人妻| 人妻精品久久久久中文字幕一冢本| 国内精品久久久久影院日本| 精品久久人人爽天天玩人人妻| 亚洲精品乱码久久久久久不卡| 久久综合给合久久狠狠狠97色69| 99热热久久这里只有精品68| 久久狠狠爱亚洲综合影院| 94久久国产乱子伦精品免费| 国产成人精品综合久久久| 精品免费久久久久国产一区| 亚洲乱码中文字幕久久孕妇黑人| 国产精品99久久久久久猫咪 | 久久99精品国产99久久6| 亚洲精品tv久久久久| 香蕉久久夜色精品国产小说| 色欲综合久久中文字幕网| 日韩AV毛片精品久久久| Xx性欧美肥妇精品久久久久久| 精品国产乱码久久久久久郑州公司 | 色偷偷91久久综合噜噜噜噜| 久久亚洲欧美国产精品| 久久国产精品无码HDAV| 久久久WWW成人免费精品| 国产成人综合久久综合| 7777精品伊人久久久大香线蕉| 天天躁日日躁狠狠久久| 国产69精品久久久久99尤物| 香蕉久久AⅤ一区二区三区| 久久精品国产精品亚洲艾草网美妙 | av色综合久久天堂av色综合在| 国产精品99久久久久久猫咪| 97精品伊人久久大香线蕉app| 亚洲AV无码1区2区久久| 久久精品一本到99热免费| 欧美午夜精品久久久久久浪潮| 欧美亚洲另类久久综合|