<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    waterye

    Spring集成Groovy

    2.0 M2 新增Package org.springframework.scripting, 集成了bsh, groovy, jruby, 這里只關心groovy

    1. xml
    <bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>

        
    <bean id="calculator" class="org.springframework.scripting.groovy.GroovyScriptFactory">
            
    <constructor-arg>
                
    <value>inline:
    package org.springframework.scripting.groovy;
    import org.springframework.scripting.Calculator
    class GroovyCalculator implements Calculator {
        int add(int x, int y) {
           return x + y;
        }
    }
                
    </value>
            
    </constructor-arg>
        
    </bean>

        
    <bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
            
    <constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
            
    <property name="message" value="Hello World!"/>
        
    </bean>
    在xml中寫groovy, 靈活得有點過頭(維護麻煩)

    2. groovy
    package org.springframework.scripting.groovy;

    import org.springframework.scripting.Messenger

    class GroovyMessenger implements Messenger {

        @Property String message;
    }

    3. test case
    ApplicationContext ctx =
                    
    new ClassPathXmlApplicationContext("org/springframework/scripting/groovy/groovyContext.xml");
            Calculator calc 
    = (Calculator) ctx.getBean("calculator");
            Messenger messenger 
    = (Messenger) ctx.getBean("messenger");

    上面的代碼出處: spring-framework-2.0-m2\test\org\springframework\scripting\groovy

    posted on 2006-02-06 22:57 waterye 閱讀(4394) 評論(5)  編輯  收藏 所屬分類: spring

    Feedback

    # re: Spring集成Groovy 2006-02-07 09:11 mmwy

    HOHO,幸福終于來了,再不用去cvs里面下spring modules代碼了
      回復  更多評論   

    # re: Spring集成Groovy 2006-02-07 19:47 江南白衣

    有沒有實用一點的例子?  回復  更多評論   

    # re: Spring集成Groovy 2006-02-07 19:59 Water Ye

    還沒有, 不過我更喜歡grails對spring的那種封裝方式  回復  更多評論   

    # re: Spring集成Groovy 2008-02-21 12:29 老龍

    請問org.springframework.scripting是在哪個JAR文件里面?
    知道的大哥能否發個郵件給我?shaoanfeng@163.com謝謝.  回復  更多評論   

    # re: Spring集成Groovy 2008-02-21 13:07 老龍

    找到了,在spring.jar中  回復  更多評論   

    主站蜘蛛池模板: 日本v片免费一区二区三区 | 色欲色欲天天天www亚洲伊| 人妻无码一区二区三区免费 | 亚洲av无码片在线播放| 中文字幕日本人妻久久久免费| 亚洲午夜久久久影院| a视频免费在线观看| 亚洲av日韩av不卡在线观看| 免费无码一区二区三区| 亚洲国产日韩在线成人蜜芽| 99国产精品永久免费视频| 91丁香亚洲综合社区| 国产男女猛烈无遮挡免费视频网站 | 亚洲综合成人婷婷五月网址| 最近中文字幕mv免费高清电影| 亚洲人成www在线播放| 精品久久免费视频| 人妻无码中文字幕免费视频蜜桃| 亚洲AV成人潮喷综合网| 亚洲免费无码在线| 亚洲国产国产综合一区首页| 很黄很色很刺激的视频免费| 亚洲乱码日产精品一二三| 内射无码专区久久亚洲| 免费一级不卡毛片| 中文字幕亚洲男人的天堂网络| 日日操夜夜操免费视频| 十八禁视频在线观看免费无码无遮挡骂过 | 午夜国产大片免费观看| 免费无码av片在线观看| 亚洲国产成人91精品| 日本不卡免费新一二三区| 你好老叔电影观看免费| 亚洲av永久无码嘿嘿嘿| 亚洲成A人片在线观看中文| 日韩中文字幕免费视频| 成人精品国产亚洲欧洲| 亚洲AV乱码久久精品蜜桃| 免费观看男人免费桶女人视频| 中文字幕一区二区三区免费视频| 亚洲成a人片在线观|