2
I’m having the following problem with the Beans in spring:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'agrupamentoTaxonomiaController' defined in file [D:\IBGE\workspaces\Agatha\adaptacao-RedHat-OpenShift\agatha\codigo-fonte\servico\target\classes\br\gov\mpog\gestaoriscos\controller\AgrupamentoTaxonomiaController.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.gov.mpog.gestaoriscos.servico.AgrupamentoTaxonomiaService]: Error creating bean with name 'agrupamentoTaxonomiaServiceImpl' defined in file [D:\IBGE\workspaces\Agatha\adaptacao-RedHat-OpenShift\agatha\codigo-fonte\servico\target\classes\br\gov\mpog\gestaoriscos\servico\impl\AgrupamentoTaxonomiaServiceImpl.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.gov.mpog.gestaoriscos.repositorio.AgrupamentoTaxonomiaRepository]: No qualifying bean of type [br.gov.mpog.gestaoriscos.repositorio.AgrupamentoTaxonomiaRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.gov.mpog.gestaoriscos.repositorio.AgrupamentoTaxonomiaRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'agrupamentoTaxonomiaServiceImpl' defined in file [D:\IBGE\workspaces\Agatha\adaptacao-RedHat-OpenShift\agatha\codigo-fonte\servico\target\classes\br\gov\mpog\gestaoriscos\servico\impl\AgrupamentoTaxonomiaServiceImpl.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.gov.mpog.gestaoriscos.repositorio.AgrupamentoTaxonomiaRepository]: No qualifying bean of type [br.gov.mpog.gestaoriscos.repositorio.AgrupamentoTaxonomiaRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.gov.mpog.gestaoriscos.repositorio.AgrupamentoTaxonomiaRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
Taxonomiarepository
package br.gov.mpog.gestaoriscos.repositorio;
import br.gov.mpog.gestaoriscos.modelo.AgrupamentoTaxonomia;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* Spring Data JPA repository for the AgrupamentoTaxonomia entity.
*/
public interface AgrupamentoTaxonomiaRepository extends JpaRepository<AgrupamentoTaxonomia, Long>{
}
AgrupamentoTaxonomiaCustomRepositorioImpl
@Repository
public class AgrupamentoTaxonomiaCustomRepositorioImpl implements AgrupamentoTaxonomiaCustomRepositorio{
@Autowired
private JpaContext jpaContext;
//RESTO DO CÓDIGO ...
}
Would anyone like to tell me how to solve it? Apparently @Autowired and class types are defined and the class Repository too.
EDIT
Grouping taxonomiacontroller
@RestController
@RequestMapping(value = "/agrupamentotaxonomias", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class AgrupamentoTaxonomiaController {
private final Logger log = LoggerFactory.getLogger(AgrupamentoTaxonomiaController.class);
private final AgrupamentoTaxonomiaService service;
@Autowired
public AgrupamentoTaxonomiaController(AgrupamentoTaxonomiaService service) {
this.service = service;
}
//RESTO DO CÓDIGO...
}
Grouping
/**
* Service Interface for managing Taxonomia.
*/
public interface AgrupamentoTaxonomiaService {
//METODOS A SEREM IMPLEMENTADOS EM OUTRA CLASSE
}
AgrupamentoTaxonomiaServiceImpl
/**
* Service Implementation for managing Taxonomia.
*/
@Service
@Transactional
public class AgrupamentoTaxonomiaServiceImpl implements AgrupamentoTaxonomiaService {
private final Logger log = LoggerFactory.getLogger(AgrupamentoTaxonomiaServiceImpl.class);
private final AgrupamentoTaxonomiaRepository agrupamentoTaxonomiaRepository;
private final TaxonomiaRepository taxonomiaRepository;
private final StatusTaxonomiaRepository statusTaxonomiaRepository;
private final TipoTaxonomiaRepository tipoTaxonomiaRepository;
private final AgrupamentoTaxonomiaCustomRepositorio agrupamentoTaxonomiaCustomRepositorio;
private final TaxonomiaCustomRepositorio taxonomiaCustomRepositorio;
private final EventoRepository eventoRepository;
private final CausaRepository causaRepository;
private final ConsequenciaRepository consequenciaRepository;
private final ControleRepository controleRepository;
private final OrgaoRepository orgaoRepository;
private final EventoRiscoRepository eventoRiscoRepository;
private final EventoCausaRepository eventoCausaRepository;
private final EventoConsequenciaRepository eventoConsequenciaRepository;
private final ControleEventoRepository controleEventoRepository;
private final PlanoControleRepository planoControleRepository;
private final EventoCustomRepositorio eventoCustomRepositorio;
private final CausaCustomRepositorio causaCustomRepositorio;
private final ConsequenciaCustomRepositorio consequenciaCustomRepositorio;
private final ControleCustomRepositorio controleCustomRepositorio;
private final AgrupamentoTaxonomiaMapper agrupamentoTaxonomiaMapper;
private final TipoTaxonomiaMapper tipoTaxonomiaMapper;
private final TaxonomiaMapper taxonomiaMapper;
private final EventoMapper eventoMapper;
private final CausaMapper causaMapper;
private final ConsequenciaMapper consequenciaMapper;
private final ControleMapper controleMapper;
@Autowired
public AgrupamentoTaxonomiaServiceImpl(AgrupamentoTaxonomiaRepository agrupamentoTaxonomiaRepository, CausaRepository causaRepository, TaxonomiaRepository taxonomiaRepository, StatusTaxonomiaRepository statusTaxonomiaRepository, TipoTaxonomiaRepository tipoTaxonomiaRepository, AgrupamentoTaxonomiaCustomRepositorio agrupamentoTaxonomiaCustomRepositorio, TaxonomiaCustomRepositorio taxonomiaCustomRepositorio, ControleCustomRepositorio controleCustomRepositorio, EventoRepository eventoRepository, PlanoControleRepository planoControleRepository, EventoCausaRepository eventoCausaRepository, ConsequenciaRepository consequenciaRepository, AgrupamentoTaxonomiaMapper agrupamentoTaxonomiaMapper, TaxonomiaMapper taxonomiaMapper, ControleRepository controleRepository, EventoCustomRepositorio eventoCustomRepositorio, ConsequenciaCustomRepositorio consequenciaCustomRepositorio, EventoConsequenciaRepository eventoConsequenciaRepository, OrgaoRepository orgaoRepository, ControleEventoRepository controleEventoRepository, EventoRiscoRepository eventoRiscoRepository, CausaCustomRepositorio causaCustomRepositorio, TipoTaxonomiaMapper tipoTaxonomiaMapper, EventoMapper eventoMapper, CausaMapper causaMapper, ConsequenciaMapper consequenciaMapper, ControleMapper controleMapper) {
this.agrupamentoTaxonomiaRepository = agrupamentoTaxonomiaRepository;
this.causaRepository = causaRepository;
this.taxonomiaRepository = taxonomiaRepository;
this.statusTaxonomiaRepository = statusTaxonomiaRepository;
this.tipoTaxonomiaRepository = tipoTaxonomiaRepository;
this.agrupamentoTaxonomiaCustomRepositorio = agrupamentoTaxonomiaCustomRepositorio;
this.taxonomiaCustomRepositorio = taxonomiaCustomRepositorio;
this.controleCustomRepositorio = controleCustomRepositorio;
this.eventoRepository = eventoRepository;
this.planoControleRepository = planoControleRepository;
this.eventoCausaRepository = eventoCausaRepository;
this.consequenciaRepository = consequenciaRepository;
this.agrupamentoTaxonomiaMapper = agrupamentoTaxonomiaMapper;
this.taxonomiaMapper = taxonomiaMapper;
this.controleRepository = controleRepository;
this.eventoCustomRepositorio = eventoCustomRepositorio;
this.consequenciaCustomRepositorio = consequenciaCustomRepositorio;
this.eventoConsequenciaRepository = eventoConsequenciaRepository;
this.orgaoRepository = orgaoRepository;
this.controleEventoRepository = controleEventoRepository;
this.eventoRiscoRepository = eventoRiscoRepository;
this.causaCustomRepositorio = causaCustomRepositorio;
this.tipoTaxonomiaMapper = tipoTaxonomiaMapper;
this.eventoMapper = eventoMapper;
this.causaMapper = causaMapper;
this.consequenciaMapper = consequenciaMapper;
this.controleMapper = controleMapper;
}
//resto do código
}
I posted only the basics that does not show the rules of business because it is a company software.
Enter your controller code
agrupamentoTaxonomiaController
andAgrupamentoTaxonomiaService
– Viktor Hugo