无法访问非托管Bean类内的托管属性吗?

无法访问非托管Bean类内的托管属性吗?

问题描述:

是否无法通过使用@ManagedProperty(value="#{beanName}")访问非托管Bean类内的托管属性?

Is it not possible to access a managed property inside a non managed bean class by using @ManagedProperty(value="#{beanName}")?

在尝试执行此操作时,我得到一个NullPointerException

I am getting a NullPointerException while trying to do that!

如果在访问其属性

If you are sure that bean is alive when you are accessing its property you can fetch it from FacesContext and access its property, but you can't inject a managed bean as property in a normal Java class.