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

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

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

    First they ignore you
    then they ridicule you
    then they fight you
    then you win
        -- Mahatma Gandhi
    Chinese => English     英文 => 中文             
    隨筆-221  評論-1047  文章-0  trackbacks-0
    An interesting post by Craig Walls that I hadn't noticed before shows how you can create Spring configs with a little JRuby DSL:

    DAOS = [ :ZoneDAO, :EmailDomainDAO, :DayDAO, :PreferenceDAO,
    ???????????????? :WhatEverDao... ]
    DAOS.each do |dao|
    bean(dao, "daos.hibernate.#{dao}Hibernate")
    {|b| b.new("sonarSession")}
    end

    The Groovy version with Grails' SpringBuilder would look like:

    def DAOS = [ZoneDAO, EmailDomainDAO, DayDAO, PreferenceDAO, WhateverDAO]
    DAOs.each { dao ->
    "${dao}"("daos.hibernate.${dao.simpleName}Hibernate") {
    sessionFactory = ref("sonarSession")
    }
    }

    Another important difference between the two is that Springy, the JRuby version, serializes the JRuby code into XML and then reads the beans from that. We used to do this in Grails, but it had serious performance implications for load time, BeanBuilder constructs the ApplicationContext programmatically on the fly.

    Bob Lee also offered his alternative using Guice:

    Class[] daos = { ZoneDao.class, EmailDomainDao.class, PreferenceDao.class... };
    for (Class dao : daos)
    bind(dao).to(Class.forName("daos.hibernate.Hibernate" + dao.getSimpleName()));

    Since Groovy does annotations it is possible to make this code even Groovier:

    def daos = [ZoneDao, EmailDomainDao, PreferenceDao...]
    daos.each { bind(it).to(Class.forName("daos.hibernate.Hibernate${it.simpleName}") }

    原文地址:http://graemerocher.blogspot.com/2007/04/contrasting-grails-springbuilder-vs.html
    posted on 2007-04-19 06:13 山風小子 閱讀(769) 評論(2)  編輯  收藏 所屬分類: Groovy & Grails
    主站蜘蛛池模板: 亚洲精品成人片在线观看| 中文字幕成人免费高清在线| 99在线免费观看视频| 亚洲综合色自拍一区| 一级毛片免费在线| 亚洲精品线路一在线观看| 国产亚洲福利一区二区免费看| 精品久久洲久久久久护士免费| 激情综合亚洲色婷婷五月| 人成午夜免费视频在线观看| 亚洲一区二区久久| 免费无码A片一区二三区| 亚洲一区二区观看播放| 国产成人精品男人免费| ssswww日本免费网站片| 亚洲一区二区三区香蕉| 99视频在线精品免费| 亚洲一区无码中文字幕乱码| 最近的中文字幕大全免费版| 看成年女人免费午夜视频| 自拍偷自拍亚洲精品情侣| 久久99精品免费视频| 国产精品亚洲自在线播放页码| 啦啦啦www免费视频| 日韩精品视频在线观看免费| 亚洲中文字幕无码日韩| 99久久久国产精品免费牛牛四川| 亚洲人成网站在线观看播放动漫| 免费的一级片网站| 国产日韩久久免费影院| 亚洲国产成+人+综合| 国产91久久久久久久免费| 国产日韩一区二区三免费高清| 亚洲国产成人精品无码一区二区| 成年在线网站免费观看无广告| 一个人看的免费观看日本视频www| 亚洲大片在线观看| 女人张开腿等男人桶免费视频 | 久久免费看少妇高潮V片特黄| 亚洲成在人线电影天堂色| 国产免费久久精品|