Null pointer when autowiring the bean into JSF Managed bean

后端 未结 1 676
借酒劲吻你
借酒劲吻你 2021-01-13 12:39

I have developed a Email service using Spring Java mail and Velocity Template like below.

Email.java

@Component
public class Email {    

        pri         


        
相关标签:
1条回答
  • 2021-01-13 12:56

    You cannot inject a Spring bean like that in a JSF managed bean. Change it to

    @ManagedBean(name="person")
    @SessionScoped
    Public class Person{
    
    @ManagedProperty(value="#{email}")
    private Email email ; // getter and setter for this.
    
    }
    

    See also:

    • @Scope("request") not working
    0 讨论(0)
提交回复
热议问题