4
respostas

Gostaria de saber o problema

Oi! O erro a no select!Insira aqui a descrição dessa imagem para ajudar na acessibilidade Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2023-08-07T12:18:23.346-03:00 ERROR 908 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consultaController': Unsatisfied dependency expressed through field 'agenda': Error creating bean with name 'agendaDeConsultas': Unsatisfied dependency expressed through field 'medicoRepository': Error creating bean with name 'medicoRepository' defined in med.voll.api.domain.medico.MedicoRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract med.voll.api.domain.medico.Medico med.voll.api.domain.medico.MedicoRepository.escolherMedicoAleatorioLivreNaData(med.voll.api.domain.medico.Especialidade,java.time.LocalDateTime); Reason: Validation failed for query for method public abstract med.voll.api.domain.medico.Medico med.voll.api.domain.medico.MedicoRepository.escolherMedicoAleatorioLivreNaData(med.voll.api.domain.medico.Especialidade,java.tim

4 respostas

Oi!

Troca de m.ativo = 1 para m.ativo = true

Outra coisa, você está utilizando o MySQL?

sim estou usado MySQL! Error creating bean with name 'consultaController': Unsatisfied dependency expressed through field 'agenda': Error creating bean with name 'agendaDeConsultas': Unsatisfied dependency expressed through field 'medicoRepository': Error creating bean with name 'medicoRepository' defined in med.voll.api.domain.medico.MedicoRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract med.voll.api.domain.medico.Medico med.voll.api

package med.voll.api.domain.consulta.cancelamento;

import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import med.voll.api.domain.Paciente.Paciente; import med.voll.api.domain.medico.Medico;

import java.time.LocalDateTime;

@Table(name = "consultas") @Entity(name = "consulta") @Getter @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(of = "id") public class Consulta {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "medico_id")
private Medico medico;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "paciente_id")
private Paciente paciente;

private LocalDateTime data;

@Column(name = "motivo_cancelamento")
@Enumerated(EnumType.STRING)
private MotivoCancelamento motivoCancelamento;

public void cancelar(MotivoCancelamento motivo) {
    this.motivoCancelamento = motivo;
}

}

Na sua classe Consulta:

@Entity(name = "consulta")

Deveria ser Consulta (com a letra C em maiúsculo)