• <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 逛奔的蝸牛 閱讀(220) 評論(0)  編輯 收藏 引用 所屬分類: Java
            久久久久久综合网天天| 国产一级持黄大片99久久| 色青青草原桃花久久综合| 人妻少妇久久中文字幕| 99久久精品免费国产大片| 久久久久久国产a免费观看黄色大片| 久久久精品国产免大香伊| 久久久久无码精品国产不卡| 久久国产免费| 久久国产精品久久国产精品| 久久久久久久久久久精品尤物| 91久久成人免费| 精品少妇人妻av无码久久| 精品久久久久久久久免费影院| 国产精品国色综合久久| 色青青草原桃花久久综合| 国产精品免费久久| 2022年国产精品久久久久| 77777亚洲午夜久久多人| 久久亚洲天堂| 精品久久人人妻人人做精品| 久久国产精品99精品国产987| 乱亲女H秽乱长久久久| 久久久久久久久波多野高潮| 中文字幕亚洲综合久久菠萝蜜| 久久久精品人妻无码专区不卡 | 漂亮人妻被中出中文字幕久久| 久久精品国产免费一区| 亚洲av成人无码久久精品| 中文字幕久久精品无码| 国产美女亚洲精品久久久综合| 色妞色综合久久夜夜| 欧美日韩精品久久免费| 久久这里的只有是精品23| 久久无码中文字幕东京热| 久久人人爽人人爽人人片AV不 | 91精品久久久久久无码| 国产毛片久久久久久国产毛片 | 久久午夜电影网| 国内精品久久久久影院网站| 人妻系列无码专区久久五月天|