Skip to content
Advertisement

An APRI REST http request goes in 404

I am new with SpringBoot, and API REST, i used to develop in a Struts MVC SOAP project.

When i try to run an API REST on a browser or with curl it goes in 404.

here is my projec, the ide that I am using is IntelliJ IDEA 2021.3.3 (Community Edition):

info about the ide

JavaScript

pom.xml

JavaScript

Controller

JavaScript

The Object

JavaScript

Interface

JavaScript

Implementation

JavaScript

Start Class

JavaScript

curl response in cmd

JavaScript

Did I put all that is required to understand the problem?

Advertisement

Answer

The issue is that your beans are not even being picked up and created by the Spring Framework. Move RestweekendApplication to the package com.restweek.restweekend as follows:

JavaScript

@SpringBootApplication encapsulates @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations with their default attributes. The default value for @ComponentScan means that all the sub packages on the package the @ComponentScan is used are scanned. That is why it is usually a good practice to include the main class in the base package of the project.

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