久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" 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="qwawimqqmiuu" 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的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(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 文件中的每個 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 注解.為此,請按照 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  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(讀取文本文件并存儲出現(xiàn)的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語?)
                • <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="qwawimqqmiuu" 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'>

                            主站蜘蛛池模板: 欧美性a视频 | 久久国产精99精产国高潮 | 日韩中文字幕一区 | 特级黄一级播放 | 午夜a v电影 | 日日天天 | 国产在线视频一区二区董小宛性色 | 免费成人在线网站 | 欧美精品一区二区三区在线播放 | 国产日韩一区二区 | 日韩在线电影 | 亚洲欧美在线视频 | 国产精品欧美精品 | 一区二区日韩 | 国产成人自拍av | 免费a国产| 免费九九视频 | 国产农村妇女毛片精品久久麻豆 | 国产精品久久久亚洲 | aaa在线| 欧美成人a∨高清免费观看 欧美日韩中 | 欧美中文在线 | 欧美精品一区二区在线观看 | 欧美日韩精品久久久免费观看 | 97国产精品| 最新91在线 | 精品综合| 男女羞羞视频在线免费观看 | 在线国产欧美 | 狠狠爱视频 | 91九色porny首页最多播放 | 久久精品16 | 国产精品成人一区二区三区 | 日韩精品一二三 | 婷婷去俺也去 | 亚洲欧美日韩精品久久亚洲区 | 婷婷一级片 | 日本一区二区在线视频 | 成人午夜电影在线观看 | 视频一区中文字幕 | 亚洲国产成人精品久久久国产成人一区 |