spring boot参考示例

库配置

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
   <version>1.5.13.RELEASE</version>
</dependency>

控制器

@Controller
@EnableAutoConfiguration
public class HelloController {
    @RequestMapping("/hello")
    @ResponseBody
    String home() {
        return "Hello ,spring boot!,I'm here!,what's up!Hello!";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(HelloController.class, args);
    }

}

注意

IE浏览器和eclipse自身带的浏览器测试时有可能会出现以下问题,换个浏览器就可以解决

猜你喜欢

转载自www.cnblogs.com/suheng/p/9222534.html