<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 山風小子 閱讀(773) 評論(2)  編輯  收藏 所屬分類: Groovy & Grails
    主站蜘蛛池模板: 99久热只有精品视频免费看| 手机看片国产免费永久| 久久久久久一品道精品免费看| 四虎影视在线影院在线观看免费视频 | 精品一区二区三区免费毛片| 免费无码又爽又刺激聊天APP| 久久精品九九亚洲精品| 久久久久久久久久国产精品免费| 亚洲AV无码专区电影在线观看 | 国产免费无码AV片在线观看不卡| 99精品国产免费久久久久久下载| 亚洲天堂视频在线观看| 13一14周岁毛片免费| 无码欧精品亚洲日韩一区夜夜嗨 | 亚洲色欲色欲www| 无码免费午夜福利片在线| 亚洲成人高清在线观看| 丁香花在线观看免费观看图片 | 吃奶摸下高潮60分钟免费视频| 亚洲成色www久久网站夜月| 免费观看一区二区三区| 亚洲天堂一区二区| a毛片基地免费全部视频| 亚洲AV日韩AV无码污污网站| 日韩精品电影一区亚洲| 成人无码区免费A∨直播| 亚洲av无码不卡一区二区三区| 亚洲视频免费在线看| 亚洲视频在线观看2018| 国产精品国产免费无码专区不卡| 人碰人碰人成人免费视频| 久久久久亚洲Av片无码v| 一个人看的www在线观看免费| 亚洲a无码综合a国产av中文| 亚洲色中文字幕无码AV| 成人黄色免费网址| 美景之屋4在线未删减免费 | 亚洲综合成人婷婷五月网址| xvideos亚洲永久网址| 丁香花在线视频观看免费| 亚洲国产视频久久|