springframework springbeanfaceselresolver org mvc mkyong integrar con spring jsf-2 dependency-injection autowired managed-bean

springbeanfaceselresolver - spring security jsf



Puntero nulo al autocablear el bean en JSF Managed Bean (1)

No se puede inyectar un grano de primavera como ese en un frijol administrado JSF. Cambiarlo a

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

Ver también:

He desarrollado un servicio de correo electrónico usando Spring Java mail y Velocity Template como a continuación.

Email.java

@Component public class Email { private JavaMailSender mailSender; private VelocityEngine velocityEngine; @Autowired private ApplReviewService applReviewService; @Autowired private UserService userService; public void setUserService(UserService userService ) { this.userService=userService; } public UserService getuserService() { return userService; } @Autowired @Required public void setMailSender(JavaMailSender mailSender) { this.mailSender = mailSender; } public VelocityEngine getVelocityEngine() { return velocityEngine; } @Autowired @Required public void setVelocityEngine(VelocityEngine velocityEngine) { this.velocityEngine = velocityEngine; }

// Método para enviar correo electrónico. }

My Spring.xml

<context:component-scan base-package="com.test.common"/> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> </bean> <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> <property name="velocityProperties"> <value> resource.loader=class class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader </value> </property> </bean> @ManagedBean(name="person") @SessionScoped Public class Person{ @Autowired private Email email ; // getter and setter for this. }

Estoy intentando conectar automáticamente mi clase de correo electrónico a Jsf managedBean pero obtengo una excepción de puntero nulo. Donde me estoy equivocando