Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

estou tendo esse erro ao iniciar no vscode

org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:788) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:606) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.1.jar:3.3.1] at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.3.1.jar:3.3.1] Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'medicosControler' for bean class [com.example.demo.Medico.MedicosControler] conflicts with existing, non-compatible bean definition of same name and class [com.example.demo.controller.MedicosControler] at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:361) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:288) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:128) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:306) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:246) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:197) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:165) ~[spring-context-6.1.10.jar:6.1.10] ... 18 common frames omitted

no inteliji nem consigo executar ja que da erro nessa parte public DadosListagemMedicos (Medico medico){ this(medico.getNome(), medico.getEmail(), medico.getCrm(), medico.getEspecialidade()); } no inteliji não consigo acessar esse valores mas no vscode consigo package com.example.demo.Medico;

import com.example.demo.Endereco.Endereco; import com.example.demo.controller.Especialidade; import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; @Table(name = "medicos") @Entity(name = "Medico") @Getter @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(of = "id") public class Medico {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nome;
private String email;
private String crm;

@Enumerated(EnumType.STRING)
private Especialidade especialidade;

@Embedded
private Endereco endereco;


public Medico(Dadoscadastromedico dados) {
    this.nome = dados.nome();
    this.crm = dados.crm();
    this.email = dados.email();
    this.especialidade = dados.especialidade();
    this.endereco = new Endereco(dados.endereco());
}

}minha classe medico

2 respostas

. ____ _ __ _ _ /\ / _' __ _ ()_ __ __ _ \ \ \ ( ( )__ | '_ | '| | ' / ` | \ \ \ \/ _)| |)| | | | | || (_| | ) ) ) ) ' || .|| ||| |_, | / / / / =========||==============|_/=//_//

:: Spring Boot :: (v3.3.1)

2024-07-01T10:23:48.143-03:00 INFO 19252 --- [demo] [ restartedMain] com.example.demo.DemoApplication : Starting DemoApplication using Java 17.0.6 with PID 19252 (C:\Users\evert\OneDrive\Área de Trabalho\demo\target\classes started by evert in c:\Users\evert\OneDrive\Área de Trabalho\demo) 2024-07-01T10:23:48.146-03:00 INFO 19252 --- [demo] [ restartedMain] com.example.demo.DemoApplication : No active profile set, falling back to 1 default profile: "default" 2024-07-01T10:23:48.213-03:00 INFO 19252 --- [demo] [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable 2024-07-01T10:23:48.213-03:00 INFO 19252 --- [demo] [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' 2024-07-01T10:23:48.480-03:00 WARN 19252 --- [demo] [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.example.demo.DemoApplication] 2024-07-01T10:23:48.778-03:00 ERROR 19252 --- [demo] [ restartedMain] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.example.demo.DemoApplication] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:179) ~[spring-context-6.1.10.jar:6.1.10] ConfigurationClassParser.java:179 at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:417) ~[spring-context-6.1.10.jar:6.1.10] ConfigurationClassPostProcessor.java:417 at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:290) ~[spring-context-6.1.10.jar:6.1.10] o resto do erro não deu para colocar tudo

solução!

para quem estiver tendo esse erro, meu problema foi devido a que eu estava executando na variavel de ambiente o java na versão jre e não jdk, assim que tirei a jre o cofigo funcionou