Preciso de ajuda Não estou conseguindo injetar o meu Entitymanager, ele esta vindo null.
Ajudem Por Favor, segue as configurações. Context<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
<!--DataSource MySQL -->
<bean id="dataSourceMySQL" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" scope="singleton">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="password" value="root" />
<property name="url" value="jdbc:mysql://localhost:3306/pagina_demo" />
<property name="username" value="root" />
<property name="testOnBorrow" value="true" />
<property name="validationQuery" value="SELECT 1" />
</bean>
<bean id="persistenceUnitManager"
class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/persistence.xml</value>
</list>
</property>
<property name="dataSources">
<map>
<entry key="localDataSource" value-ref="dataSourceMySQL" />
</map>
</property>
<property name="defaultDataSource" ref="dataSourceMySQL" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="persistenceUnitManager" />
<property name="persistenceUnitName" value="PUTeste" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<context:annotation-config />
<!-- <context:component-scan base-package="br.com.service" /> -->
<context:component-scan base-package="br.com.paulo.sistema.dao" />
</beans>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="PUTeste">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>localDataSource</non-jta-data-source>
<!-- <non-jta-data-source>java:comp/env/jdbc/fnp</non-jta-data-source>-->
<properties>
<property name="default" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.hibernate.transaction.factory_class" value="org.hibernate.transaction.JDBCTransactionFactory" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<!-- <property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver"/> -->
<!-- <property name="hibernate.connection.url" value="jdbc:mysql://localhost/pagina_demo"/> -->
<!-- <property name="hibernate.connection.username" value="root"/> -->
<!-- <property name="hibernate.connection.password" value="root"/> -->
</properties>
</persistence-unit>
</persistence>
@Transactional(propagation = Propagation.REQUIRED)
public abstract class GenericDAO<T extends Domain, ID extends Serializable> implements IGenericDAO<T, ID>{
@PersistenceContext(unitName="PUTeste")
private EntityManager entityManager;