I followed this guide http://ift.tt/Jb3BXl, so i made a simple restful web service using the following scenario:
-Netbeans 8.1 -Tomcat7 -Maven
my build and deploy works, but when i access the path localhost:8080/WsTaxiShare/hello nothing appears just a blank page, not even a error request or HTTP 404(not found), i don't know what happening could anyone help me?
My codes:
pom.xml
http://ift.tt/VE5zRx"> 4.0.0
<groupId>com.tinanlab</groupId>
<artifactId>WsTaxiShare</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>WsTaxiShare</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>http://ift.tt/1A9iaEo;
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>http://ift.tt/1A9iaEo;
</pluginRepository>
</pluginRepositories>
Application.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.tinanlab.wstaxishare;
/**
*
* @author alan
*/
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Controller.java
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author alan
*/
@RestController
public class Controller {
@RequestMapping("/hello")
public Teste hello()
{
return new Teste("hello");
}
}
Teste.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.tinanlab.wstaxishare;
/**
*
* @author alan
*/
public class Teste {
private final String name;
public String getName() {
return name;
}
public Teste(String name) {
this.name = name;
}
}
Aucun commentaire:
Enregistrer un commentaire