Issue With Spring: There was an unexpected error (type=Not Found, status=404)
I believe your issue is related to packages. Your application is defined in com.organization_name.webservices.application
. I am guessing your other classes are in a different package that is not a child of com.organization_name.webservices.application
. Spring will automatically load controllers that are in the same package or sub-packages, for example:
com.organization_name.webservices.application
com.organization_name.webservices.application.controllers
But not packages like this:
com.organization_name.webservices.controllers
You can fix this by either moving your controller (or application), or adding ComponentScan
to your Application:
@SpringBootApplication
@ComponentScan(basePackageClasses=GreetingController.class)
public class Application {
You should be seeing this in your log:
Mapped "{[/greeting]}" onto public com.organization_name.webservices.xxx.Greeting com.organization_name.webservices.xxx.GreetingController.greeting(java.lang.String)
seems like you are missing thymleaf dependency. Put this inside your pom.xml dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
in pom.xml add the following dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>