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

Não consigo acessar o http://localhost:8080/

Postei uma dúvida referente as configurações basicas da dependencia dev.toools

link da minha primeira pergunta: https://cursos.alura.com.br/forum/topico-configuracao-dev-tools-259659#1201997

Após aplicar, tive outro problema. Eu executo o projeto e após alguns segundos é desligado automaticamente.

Segue o log abaixo para mais detalhes.

Mesmo desfazendo a configuração o problema persiste. Como devo proceder?

Disponibilizei no final do log dois prints da configuração feita na minha IDE

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.0.0)

2022-12-07T18:37:02.385-03:00  INFO 7848 --- [  restartedMain] br.com.alura.forum.ForumApplicationKt    : Starting ForumApplicationKt using Java 19.0.1 with PID 7848 (F:\programacao\mobile\kotlin\alura\back end\projeto\forum\target\classes started by thailan in F:\programacao\mobile\kotlin\alura\back end\projeto\forum)
2022-12-07T18:37:02.387-03:00  INFO 7848 --- [  restartedMain] br.com.alura.forum.ForumApplicationKt    : No active profile set, falling back to 1 default profile: "default"
2022-12-07T18:37:02.443-03:00  INFO 7848 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-12-07T18:37:02.443-03:00  INFO 7848 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-12-07T18:37:03.696-03:00  INFO 7848 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-12-07T18:37:03.710-03:00  INFO 7848 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-12-07T18:37:03.710-03:00  INFO 7848 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.1]
2022-12-07T18:37:03.758-03:00  INFO 7848 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-12-07T18:37:03.759-03:00  INFO 7848 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1315 ms
2022-12-07T18:37:04.046-03:00  WARN 7848 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Ambiguous mapping. Cannot map 'topicoControler' method 
br.com.alura.forum.controller.TopicoControler#listar()
to {GET [/topicos]}: There is already 'topicoControler' bean method
br.com.alura.forum.controller.TopicoControler#buscarPorId() mapped.
2022-12-07T18:37:04.051-03:00  INFO 7848 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-12-07T18:37:04.068-03:00  INFO 7848 --- [  restartedMain] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2022-12-07T18:37:04.088-03:00 ERROR 7848 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Ambiguous mapping. Cannot map 'topicoControler' method 
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:225) ~[spring-webmvc-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[spring-beans-6.0.2.jar:6.0.2]
    ... 19 common frames omitted


Process finished with exit code 0

Insira aqui a descrição dessa imagem para ajudar na acessibilidadeInsira aqui a descrição dessa imagem para ajudar na acessibilidade

2 respostas
solução!

Na classe topicoControler provavelmente vc esta mapeando dois endpoints com o mesmo nome por isso ele da esse erro de Ambiguous mapping

vc nao pode ter o mesmo nome para dois endpoints que tenham um mesmo metodo http.

Realmente estava, obrigado Raul

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software