title: Spring Bean never set as ManagedProperty in JSF Bean
body: <p>Notice: Problem already solved, currently I can't post the answer but just posted to inform for a rare case. See comment at bottom. Thnx</p>
  
  <p>I am trying to inject a spring bean into JSF bean as managed property.
  No exception is thrown when JSF Bean is initialized.
  But ManagedProperty is null. I put some logs on setter method, but it seems it is never called. But I can get the Spring bean via at @Postconstruct method:</p>
  
  <pre><code>WebApplicationContext webAppContext = ContextLoader.getCurrentWebApplicationContext();
  modelOperations = (ModelOperations) webAppContext.getBean("modelOperations");
  </code></pre>
  
  <p>PS: I know there are many similar threads, spent whole day, but exhausted reading them ending up with no clue why it is not working</p>
  
  <p>Environment: Spring 3.2.1, JSF: 2.2.4, Jetty on Eclipse</p>
  
  <pre><code>@ManagedBean(name = "batchOperation")
  @SessionScoped
  public class BatchOperation implements Serializable {
  
      @ManagedProperty(value = "#{modelOperations}", name = "modelOperations")
      ModelOperations modelOperations;
  
      @PostConstruct
      public void prepareLazyDataModel() {
          ..
          List&lt;XXX&gt; list = modelOperations.getXXXList()
          ..
      }
  
      public ModelOperations getModelOperations() {
          return modelOperations;
      }
  
      public void setModelOperations(ModelOperations modelOperations) {   
          this.modelOperations = modelOperations;
      }
  }
  </code></pre>
  
  <p>ModelOperations bean:</p>
  
  <pre><code>package xxxxx.dao;
  
  @Component(value = "modelOperations")
  @Scope("prototype")
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false, value = "transactionManager")
  public class ModelOperationsImpl implements ModelOperations {
  
      protected SessionFactory sessionFactory;
  }
  </code></pre>
  
  <p>faces.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                                    http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
                version="2.2"&gt;
  
  &lt;application&gt;
      &lt;el-resolver&gt;org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>applicationContext.xml:</p>
  
  <pre><code>&lt;context:annotation-config/&gt;
  
  &lt;context:component-scan base-package="xxxxx"
      name-generator="xxxxx.util.WithoutTrailingImplBeanNameGenerator"&gt;
      &lt;context:include-filter type="regex"
          expression="xxxxx.dao.*" /&gt;
  &lt;/context:component-scan&gt;
  </code></pre>
  
  <p>(Put that if anybody wonders)
  WithoutTrailingImplBeanNameGenerator:</p>
  
  <pre><code>public class WithoutTrailingImplBeanNameGenerator extends
          AnnotationBeanNameGenerator {
      public String generateBeanName(BeanDefinition definition,
              BeanDefinitionRegistry registry) {
          String beanName = super.generateBeanName(definition, registry);
          if (!beanName.endsWith("Impl")) {
              return beanName;
          }
          return beanName.substring(0, beanName.length() - "Impl".length());
      }
  }
  </code></pre>