Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF 2 inject Spring bean/service with @ManagedProperty and no xml
    primarykey
    data
    text
    <p>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 <code>@named</code> / <code>@inject</code>.</p> <p>I have tried to find a solution on the net but without any luck.</p> <p>Example</p> <pre><code>@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 } } </code></pre> <p>Is something like this possible without the use of xml. For example, I would NOT like to use something like</p> <pre><code>FacesContextUtils.getWebApplicationContext(context).getBean("MySpringBean"); </code></pre> <p>or in <code>faces-config.xml</code></p> <pre class="lang-xml prettyprint-override"><code>&lt;managed-bean&gt; &lt;managed-bean-name&gt;myBean&lt;/managed-bean-name&gt; &lt;managed-bean-class&gt;com.mytest.MyBean&lt;/managed-bean-class&gt; &lt;managed-bean-scope&gt;view&lt;/managed-bean-scope&gt; &lt;managed-property&gt; &lt;property-name&gt;mySpringBean&lt;/property-name&gt; &lt;value&gt;#{mySpringBean}&lt;/value&gt; &lt;/managed-property&gt; &lt;/managed-bean&gt; </code></pre> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload