美文网首页
SpringBoot(入门Hello!)

SpringBoot(入门Hello!)

作者: 磨陀货_ | 来源:发表于2019-10-21 18:07 被阅读0次

    环境要求

    •   开发环境JDK 1.8
    •   项目管理工具( Maven )
    •   开发工具(Eclipse/idea)

    创建Maven项目

    SpringMVC支持


    导包

    <parent>        <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.5.RELEASE</version>
    </parent>
           
    <dependencyManagement>
    <dependencies>
    <!--springboot版本管理-->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.0.5.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
    </dependency>
    </dependencies>
    </dependencyManagement>
    

    • 新建一个在导包


        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
        </dependencies>
    
    @SpringBootApplication
    public class SpringMVCAppTest {
        public static void main(String[] args) {
            SpringApplication.run(SpringMVCAppTest.class);
        }
    }
    
    @RestController
    public class HelloController {
        @RequestMapping("/hello")
        public String test(){
            return "嗨~!";
        }
    }
    

    相关文章

      网友评论

          本文标题:SpringBoot(入门Hello!)

          本文链接:https://www.haomeiwen.com/subject/oqvtvctx.html