I have created a spring boot application which is working fine but I am not able to get rest service which is clubbed with that application. Please find below code. I am able to access url http://localhost:8080/springbootr/ but not able to access web-service url http://localhost:8080/springbootr/Hello/, getting 404 at the moment of web service calling.
@Configuration
@ComponentScan(basePackages={"controller"})
@SpringBootApplication
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(new Object[] { Application.class }, args);
}
}
@RestController
public class UserController {
@RequestMapping(value ="/Hello/", method = RequestMethod.GET)
public String greeting() {
System.out.println("Achyut");
return "HEllo";
}
}
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yash</groupId>
<artifactId>springbootr</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-resource</name>
<description>spring-resource</description>
<packaging>war</packaging>
<properties>
<java.version>1.7</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
I am new to this application, please help me out.
http://localhost:8080/Hello/.