Problemas com Spring 3.0 jsf 1.2
Boa tarde pessoal, estou na seguinte situação. configurei o spring acredito que esteja correto, porém ao tentar injetar o entityManager ele vem NULL. Alguém saberia me ajudar ? Embaixo vão os códigos:
applicationcontext.xml
web.xml
facesconfig.xml
applicationcontext.xml
<beans xmlns=http://www.springframework.org/schema/beans
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:mvc=http://www.springframework.org/schema/mvc
xmlns:context=http://www.springframework.org/schema/context
xmlns:tx=http://www.springframework.org/schema/tx
xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xs
default-autowire=byName>
<context:component-scan base-package=* />
<bean id=entityManagerFactory class=org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean >
<property name=persistenceUnitName value=ciclo/>
</bean>
<bean id=transactionManager class=org.springframework.orm.jpa.JpaTransactionManager>
<property name=entityManagerFactory ref=entityManagerFactory/>
</bean>
<tx:annotation-driven />
<bean id=dataSource class=org.apache.commons.dbcp.BasicDataSource destroy-method=close>
<property name=driverClassName value=com.mysql.jdbc.Driver />
<property name=url value=jdbc:mysql://localhost:3306/ciclo />
<property name=username value=root />
<property name=password value=root />
</bean>
</beans> web.xml
<?xml version=1.0 encoding=UTF-8?>
<web-app version=2.5 xmlns=http://java.sun.com/xml/ns/javaee xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
facesconfig.xml
<?xml version=1.0 encoding=UTF-8?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version=1.2
xmlns=http://java.sun.com/xml/ns/javaee
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd>
<application>
<variable-resolver>org.springframework.web.jsf.SpringBeanVariableResolver</variable-resolver>
<locale-config>
<default-locale>pt_br</default-locale>
<supported-locale>pt_br</supported-locale>
</locale-config>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<managed-bean>
<managed-bean-name>cicloMBean</managed-bean-name>
<managed-bean-class>br.com.ciclo.mBean.CicloMBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
Euclides Filizola
Curtidas 0