Olá pessoal, estou dando manutenção em uma aplicação Java com Spring, porém estou com erro no DAO somente nesta nova classe que criei, as existentes funcionam normalmente. O jdbcTemplate chega null na classe e não consigo saber o porque. Abaixo a minha classe DAO
package br.com.sce.dao;
//import static br.com.sce.dao.BaseDAO.log;
import br.com.sce.entities.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.stereotype.Repository;
import br.com.sce.util.ExecuteProcedure;
import br.com.sce.util.ParameterType;
import br.com.sce.util.ProcedureNames;
/**
*
*
*/
@Repository
public class SocioDAO extends BaseDAO {
private static final long serialVersionUID = 1L;
/**
* Seleciona todos os eventos cadastrados
*
* @return Map<String, Object>
*/
public Map<String, Object> selecaoSocio(Socio socio) {
log.debug("INICIO - SocioDAO.selecaoSocio()");
int i = 0;
SqlParameter[] tiposParametros = new SqlParameter[4];
// Parametros de entrada
tiposParametros[i++] = new SqlParameter("P_MATRICULA", ParameterType.VARCHAR);
tiposParametros[i++] = new SqlOutParameter(ProcedureNames.DADOS_RETORNO, ParameterType.CURSOR, new RowMapper<IBaseEntidade>() {
public IBaseEntidade mapRow(ResultSet rs, int rowNum) throws SQLException {
Socio socio = null;
try {
socio = new Socio();
socio.setIdSocio(rs.getInt("ID_SOCIO"));
socio.setIdCliente(rs.getInt("ID_CLIENTE"));
socio.setDsSocio(rs.getString("DS_SOCIO"));
return socio;
} catch (Exception e) {
log.error("Erro ao Carregar dados na Entidade Socio :" + e);
throw new SQLException(e);
}
}
});
tiposParametros[i++] = new SqlOutParameter(ProcedureNames.CODIGO_RETORNO, ParameterType.NUMERIC);
tiposParametros[i++] = new SqlOutParameter(ProcedureNames.MENSAGEM_RETORNO, ParameterType.VARCHAR);
ExecuteProcedure executeProcedure = new ExecuteProcedure(jdbcTemplate, ProcedureNames.PRC_SEL_SOCIO, tiposParametros);
Map<String, Object> parametros = new LinkedHashMap<String, Object>();
// Passa os valores para execução
parametros.put("P_MATRICULA", socio.getCdMatricula());
Map<String, Object> retorno = executeProcedure.executar(parametros);
log.debug("FIM - EventoDAO.selecaoSocio()");
return retorno;
}
}
abaixo meu springContextXML
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" 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/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- habilita a configuração por annotations -->
<context:annotation-config />
<!-- define os pacotes/subpacotes onde serão procurados beans do spring -->
<context:component-scan base-package="br.com.sce"
annotation-config="true" />
<context:spring-configured />
<!-- Arquivo com informações do banco de dados -->
<context:property-placeholder location="classpath:conexao.properties" />
<!-- Configura o servidor SMTP de E-mail -->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${sce.email.smtp.host}" />
<property name="port" value="${sce.email.smtp.port}" />
<!--
<property name="username" value="${sce.email.smtp.username}" />
<property name="password" value="${sce.email.smtp.password}" />
-->
<property name="javaMailProperties">
<props>
<!--
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.requiresAuthentication">true</prop>
<prop key="mail.smtp.isSecure">true</prop>
<prop key="mail.smtp.port">465</prop>
<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtp.sendpartial">true</prop>
<prop key="mail.smtp.userset">true</prop>
-->
<prop key="mail.smtp.auth">false</prop>
<prop key="mail.smtp.connectiontimeout">5000</prop>
<prop key="mail.mime.charset">UTF-8</prop>
<prop key="mail.smtp.isSecure">false</prop>
<prop key="mail.smtp.requiresAuthentication">false</prop>
<prop key="mail.smtp.port">25</prop>
<prop key="mail.smtp.socketFactory.fallback">false</prop>
<prop key="mail.debug">true</prop>
</props>
</property>
</bean>
<!-- Mail message -->
<bean id="simpleMailMessage" class="org.springframework.mail.SimpleMailMessage">
<property name="from" value="${sce.email.from}" />
</bean>
<!-- Determina a classe que será injetada -->
<bean id="sendEmail" class="br.com.sce.email.SendEmail">
<property name="mailSender" ref="mailSender" />
<property name="simpleMailMessage" ref="simpleMailMessage" />
</bean>
<!-- dataSource - O DataSource fornece conexões com o banco de dados. -->
<!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${database.driver}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="initialSize" value="10" />
<property name="maxActive" value="100" />
<property name="minIdle" value="10" />
</bean>-->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/femAGDS</value>
</property>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
<property name="scopes">
<map>
<entry key="view">
<bean class="br.com.sce.util.ViewScope" />
</entry>
</map>
</property>
</bean>
</beans>