pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='DiD5I'><style id='DiD5I'><dir id='DiD5I'><q id='DiD5I'></q></dir></style></legend>

      • <bdo id='DiD5I'></bdo><ul id='DiD5I'></ul>
      1. <small id='DiD5I'></small><noframes id='DiD5I'>

      2. <tfoot id='DiD5I'></tfoot>
        <i id='DiD5I'><tr id='DiD5I'><dt id='DiD5I'><q id='DiD5I'><span id='DiD5I'><b id='DiD5I'><form id='DiD5I'><ins id='DiD5I'></ins><ul id='DiD5I'></ul><sub id='DiD5I'></sub></form><legend id='DiD5I'></legend><bdo id='DiD5I'><pre id='DiD5I'><center id='DiD5I'></center></pre></bdo></b><th id='DiD5I'></th></span></q></dt></tr></i><div class="bv31rtp" id='DiD5I'><tfoot id='DiD5I'></tfoot><dl id='DiD5I'><fieldset id='DiD5I'></fieldset></dl></div>

        JSF 2 使用 @ManagedProperty 注入 Spring bean/service 而沒

        JSF 2 inject Spring bean/service with @ManagedProperty and no xml(JSF 2 使用 @ManagedProperty 注入 Spring bean/service 而沒有 xml)

          <tfoot id='Dvmi4'></tfoot>
        • <i id='Dvmi4'><tr id='Dvmi4'><dt id='Dvmi4'><q id='Dvmi4'><span id='Dvmi4'><b id='Dvmi4'><form id='Dvmi4'><ins id='Dvmi4'></ins><ul id='Dvmi4'></ul><sub id='Dvmi4'></sub></form><legend id='Dvmi4'></legend><bdo id='Dvmi4'><pre id='Dvmi4'><center id='Dvmi4'></center></pre></bdo></b><th id='Dvmi4'></th></span></q></dt></tr></i><div class="ddffdl1" id='Dvmi4'><tfoot id='Dvmi4'></tfoot><dl id='Dvmi4'><fieldset id='Dvmi4'></fieldset></dl></div>
            <legend id='Dvmi4'><style id='Dvmi4'><dir id='Dvmi4'><q id='Dvmi4'></q></dir></style></legend>

          1. <small id='Dvmi4'></small><noframes id='Dvmi4'>

                <bdo id='Dvmi4'></bdo><ul id='Dvmi4'></ul>
                  <tbody id='Dvmi4'></tbody>
                  本文介紹了JSF 2 使用 @ManagedProperty 注入 Spring bean/service 而沒有 xml的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我想使用 jsf 注釋和一些 spring將 spring bean/服務(wù)注入 jsf 托管 bean 的注釋.(在 jsf bean 上我只想使用 jsf 注釋)我不想使用像 @named/@inject 這樣的注解.

                  I would like to use jsf annotations and some spring annotations to inject a spring bean/service into a jsf managed bean. (on the jsf bean i only want to use jsf annotations) I dont want to use annotations like @named / @inject.

                  我試圖在網(wǎng)上找到解決方案,但沒有任何運(yùn)氣.

                  I have tried to find a solution on the net but without any luck.

                  例子

                  @ManagedBean
                  @ViewScoped 
                  public class MyBean {
                  
                      @ManagedProperty(value = "#{mySpringBean}")
                      private MySpringBean mySpringBean;
                  
                      public void setMySpringBean(MySpringBean mySpringBean) {
                          this.mySpringBean = mySpringBean;
                      }
                  
                      public void doSomething() {
                      //do something with mySpringBean
                      }
                  }
                  

                  在不使用 xml 的情況下,這樣的事情是否可行.例如,我不想使用類似的東西

                  Is something like this possible without the use of xml. For example, I would NOT like to use something like

                  FacesContextUtils.getWebApplicationContext(context).getBean("MySpringBean");
                  

                  或在 faces-config.xml

                  <managed-bean>
                      <managed-bean-name>myBean</managed-bean-name>
                      <managed-bean-class>com.mytest.MyBean</managed-bean-class>
                      <managed-bean-scope>view</managed-bean-scope>
                      <managed-property>
                          <property-name>mySpringBean</property-name>
                          <value>#{mySpringBean}</value>
                      </managed-property>
                  </managed-bean>
                  

                  上面的內(nèi)容是否可能有注釋和沒有注釋定義所有 jsf beans/properties 和 spring beans/properties配置 xml 文件中的每個(gè) bean?

                  Is something like the above possible with annotations and without defining all the jsf beans/properties and the spring beans/properties for every bean in the config xml files?

                  推薦答案

                  如果你已經(jīng)有了 Spring 容器,為什么不使用它的 @Autowired 注解.為此,請(qǐng)按照 Boni 的建議更新您的 faces-config.xml.然后在此之后將這些偵聽器添加到您的 web.xml 中

                  If you already have Spring container why not use its @Autowired annotation. For that, Update your faces-config.xml as suggested by Boni. Then add these listeners to your web.xml after this

                  <context-param>
                      <param-name>contextConfigLocation</param-name>
                      <param-value>/WEB-INF/applicationContext.xml</param-value>
                  </context-param>
                  
                  <listener>
                    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
                  </listener>
                  
                  <listener>
                    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
                  </listener>
                  

                  然后將這些添加到您的 applicationContext.xml

                  Then add these to your applicationContext.xml

                  <context:component-scan base-package="com.examples" />
                  

                  現(xiàn)在您可以使用 Spring 注釋,您的 bean 將是這樣的:

                  Now you can use Spring annotations and your bean will be something like this:

                  package com.examples;
                  @Component
                  @Scope(value="request")
                  public class MyBean {
                      @Autowired
                      private MySpringBeanClass mySpringBean;
                  }
                  

                  使用 @Service 注釋您的 MySpringBeanClass

                  Annotate your MySpringBeanClass with @Service

                  另見:

                  • @Scope("request") 不起作用

                  這篇關(guān)于JSF 2 使用 @ManagedProperty 注入 Spring bean/service 而沒有 xml的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯(cuò)誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語(yǔ)句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數(shù)的三元表達(dá)式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲(chǔ)出現(xiàn)的每個(gè)字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語(yǔ)?)
                • <legend id='rtRpU'><style id='rtRpU'><dir id='rtRpU'><q id='rtRpU'></q></dir></style></legend>
                    <tbody id='rtRpU'></tbody>

                      <tfoot id='rtRpU'></tfoot>

                        <i id='rtRpU'><tr id='rtRpU'><dt id='rtRpU'><q id='rtRpU'><span id='rtRpU'><b id='rtRpU'><form id='rtRpU'><ins id='rtRpU'></ins><ul id='rtRpU'></ul><sub id='rtRpU'></sub></form><legend id='rtRpU'></legend><bdo id='rtRpU'><pre id='rtRpU'><center id='rtRpU'></center></pre></bdo></b><th id='rtRpU'></th></span></q></dt></tr></i><div class="vrbr1rb" id='rtRpU'><tfoot id='rtRpU'></tfoot><dl id='rtRpU'><fieldset id='rtRpU'></fieldset></dl></div>
                        • <bdo id='rtRpU'></bdo><ul id='rtRpU'></ul>
                          • <small id='rtRpU'></small><noframes id='rtRpU'>

                            主站蜘蛛池模板: 酸度计_PH计_特斯拉计-西安云仪 纯水电导率测定仪-万用气体检测仪-低钠测定仪-米沃奇科技(北京)有限公司www.milwaukeeinst.cn | 深圳市八百通智能技术有限公司官方网站 | 掺铥光纤放大器-C/L波段光纤放大器-小信号光纤放大器-合肥脉锐光电技术有限公司 | 特种阀门-调节阀门-高温熔盐阀-镍合金截止阀-钛阀门-高温阀门-高性能蝶阀-蒙乃尔合金阀门-福建捷斯特阀门制造有限公司 | 篷房[仓储-婚庆-展览-活动]生产厂家-江苏正德装配式帐篷有限公司 | 橡胶接头|可曲挠橡胶接头|橡胶软接头安装使用教程-上海松夏官方网站 | 济南冷库安装-山东冷库设计|建造|冷库维修-山东齐雪制冷设备有限公司 | 定制液氮罐_小型气相液氮罐_自增压液氮罐_班德液氮罐厂家 | led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 | 北京翻译公司-专业合同翻译-医学标书翻译收费标准-慕迪灵 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 宁波普瑞思邻苯二甲酸盐检测仪,ROHS2.0检测设备,ROHS2.0测试仪厂家 | 宠物店加盟_宠物连锁店_开宠物店-【派多格宠物】 | 3dmax渲染-效果图渲染-影视动画渲染-北京快渲科技有限公司 | 北京森语科技有限公司-模型制作专家-展览展示-沙盘模型设计制作-多媒体模型软硬件开发-三维地理信息交互沙盘 | 工业硝酸钠,硝酸钠厂家-淄博「文海工贸」| 手机游戏_热门软件app下载_好玩的安卓游戏下载基地-吾爱下载站 | 派财经_聚焦数字经济内容服务平台 | 新能源汽车教学设备厂家报价[汽车教学设备运营18年]-恒信教具 | 结晶点测定仪-润滑脂滴点测定仪-大连煜烁 | 浙江宝泉阀门有限公司| 健康管理师报名入口,2025年健康管理师考试时间信息网-网站首页 塑料造粒机「厂家直销」-莱州鑫瑞迪机械有限公司 | 阴离子聚丙烯酰胺价格_PAM_高分子聚丙烯酰胺厂家-河南泰航净水材料有限公司 | 成都租车_成都租车公司_成都租车网_众行宝 | 重庆磨床过滤机,重庆纸带过滤机,机床伸缩钣金,重庆机床钣金护罩-重庆达鸿兴精密机械制造有限公司 | 快速门厂家批发_PVC快速卷帘门_高速门_高速卷帘门-广州万盛门业 快干水泥|桥梁伸缩缝止水胶|伸缩缝装置生产厂家-广东广航交通科技有限公司 | 挤出熔体泵_高温熔体泵_熔体出料泵_郑州海科熔体泵有限公司 | 蒜肠网-动漫,二次元,COSPLAY,漫展以及收藏型模型,手办,玩具的新媒体.(原变形金刚变迷TF圈) | 振动筛,震动筛,圆形振动筛,振动筛价格,振动筛厂家-新乡巨宝机电 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | sfp光模块,高速万兆光模块工厂-性价比更高的光纤模块制造商-武汉恒泰通 | 齿轮减速机_齿轮减速电机-VEMT蜗轮蜗杆减速机马达生产厂家瓦玛特传动瑞环机电 | 高效复合碳源-多核碳源生产厂家-污水处理反硝化菌种一长隆科技库巴鲁 | 楼承板设备-楼承板成型机-免浇筑楼承板机器厂家-捡来 | 定硫仪,量热仪,工业分析仪,马弗炉,煤炭化验设备厂家,煤质化验仪器,焦炭化验设备鹤壁大德煤质工业分析仪,氟氯测定仪 | 消泡剂_水处理消泡剂_切削液消泡剂_涂料消泡剂_有机硅消泡剂_广州中万新材料生产厂家 | 皮带机-带式输送机价格-固定式胶带机生产厂家-河南坤威机械 | 制丸机,小型中药制丸机,全自动制丸机价格-甘肃恒跃制药设备有限公司 | 厂厂乐-汇聚海量采购信息的B2B微营销平台-厂厂乐官网 | 深圳公司注册-工商注册代理-注册公司流程和费用_护航财税 | 对辊破碎机_四辊破碎机_双齿辊破碎机_华盛铭重工 | 北京网络营销推广_百度SEO搜索引擎优化公司_网站排名优化_谷歌SEO - 北京卓立海创信息技术有限公司 |