Log do Erro: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consultaController': Unsatisfied dependency expressed through field 'regrasConsulta': Error creating bean with name 'regrasConsulta': Unsatisfied dependency expressed through field 'consultaRepository': Error creating bean with name 'consultaRepository' defined in med.voll.api.domain.consulta.ConsultaRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract org.springframework.data.domain.Page med.voll.api.domain.consulta.ConsultaRepository.findByMedicoId(org.springframework.data.domain.Pageable); Reason: Failed to create query for method public abstract org.springframework.data.domain.Page med.voll.api.domain.consulta.ConsultaRepository.findByMedicoId(org.springframework.data.domain.Pageable); Method public abstract org.springframework.data.domain.Page med.voll.api.domain.consulta.ConsultaRepository.findByMedicoId(org.springframework.data.domain.Pageable) expects at least 1 arguments but only found 0; This leaves an operator of type SIMPLE_PROPERTY for property medico.id unbound
public interface ConsultaRepository extends JpaRepository<Consulta,Long> {
Page<DadosDetalhamentoConsulta> findByMedicoId(Pageable paginacao);
@Query("""
select m from Medico m
where m.ativo = true
and m.especialidade = :especialidade
and m.id not in (select c.medico.id from Consulta c where c.data != :data)
order by rank ()
limit 1
""")
Medico escolherMedicoAleatorio(Especialidade especialidade, LocalDateTime data);
boolean existsByMedicoIdAndData(Long medicoId, LocalDateTime data);
boolean existsByPacienteIdAndData(Long pacienteId, LocalDateTime data);
}
Estou tentando listar a agenda de um médico por exemplo. O erro ocorre apenas quando tento incluir a linha **Page findByMedicoId(Pageable paginacao); **Se eu retiro essa linha o sistema funciona certinho...