Skip to content
Advertisement

Spring Boot – Controller is recognised but the api is not binded

I have two files in my application.

The Main class file.

JavaScript

The controller class.

JavaScript

My application.properties looks like :

JavaScript

Here’s what my console looks like :

JavaScript

I tried hitting the api with the url : http://localhost:8080/util-service/util and this throws up a 404 error.

So even though the controller is picked up for component scanning(according to the logs), the request within it isn’t mapped. Not sure why this is happening.

I suspect there is something wrong with the way i’m configuring my request here! Haven’t been able to pinpoint what it really is though.

Advertisement

Answer

If you explicitly want to scan base packages, use

JavaScript

Edit: Updating answer w.r.t. your code
Change spring-web dependency to

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement