Reputation: 1088
I just started to learn Spring boot and I am wondering about a behavior I see.
I have just two classes. 1. Spring boot class 2. Controller class.
Please refer the images. It all works fine when I keep bot the classes inside the main package. But it doesn't work if I move the GreetingController class to the rest folder. I am getting 404 If I do that. Why is this?
Upvotes: 0
Views: 1233
Reputation: 4361
To work you have to put your controller on same folder or sub folder of BootStarter. The reason is that Spring Boot scan all classes of his folder and subfolder.
Upvotes: 2