1. 程式人生 > >spring boot參考示例

spring boot參考示例

TE ping AR IT enc conf resp 分享 ica

庫配置

<!-- 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自身帶的瀏覽器測試時有可能會出現以下問題,換個瀏覽器就可以解決

技術分享圖片

spring boot參考示例