zoukankan      html  css  js  c++  java
  • (017)Spring Boot之引入jetty

      springboot引入spring-boot-starter-web,默认会引入tomcat。

      所以引入jetty先要排除掉tomcat,然后添加jetty的依赖,如下所示:

    <dependency>
      <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-web</artifactId>
       <exclusions>
         <exclusion>
            <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-tomcat</artifactId>
          </exclusion>
        </exclusions>
     </dependency>
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-jetty</artifactId>
     </dependency>

      启动如下图所示:

       测试类如下:

    package com.edu.spring.springboot;
    
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @RestController
    public class AccountController {
    
        @RequestMapping("/hello")
        public String reg(){
            return "hello Tom";
        }
        
    }

      浏览器输入:http://127.0.0.1:8080/hello 即可返回:hello Tom

  • 相关阅读:
    luogu P1451 求细胞数量
    P1443 马的遍历
    luogu P1194 买礼物
    codevs 4919 线段树练习4
    printf的实型
    printf的整型
    scanf
    printf
    c++常用函数
    字符类型C++(ascll码表)
  • 原文地址:https://www.cnblogs.com/javasl/p/11918176.html
Copyright © 2011-2022 走看看