Problems with springboot filling

Asked

Viewed 392 times

0

I’m entering the world of Springboot now and stumbled upon a problem I believe is easy to solve.

Follow the structure of my project with class packages:

br.com.springboot.api

Springbootapplication

br.com.springboot.controller

Clientecontroller

br.com.springboot.model

Client

I created a mapping inside Springbootapplication with @Requestmapping, the problem is that when I start the application the way it is and try to access this mapping in the browser it does not think, but if I put the Springbootapplication and Clientecontroller classes in the same package it works! What can be??

  • you have put @Controller and @Componentscan in the controller class?

  • I used @Restcontroller just above the class

1 answer

0


You should map your package with controllers.

@ComponentScan({"br.com.springboot.controller"})
public class SpringBootApplication {
    // ...
}
  • 1

    That’s right, thank you!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.