0
点赞
收藏
分享

微信扫一扫

SpringBoot入门(一) springBoot框架搭建和启动

大明宫 2023-09-13 阅读 49


1.创建maven工程 Maven Project

       

SpringBoot入门(一) springBoot框架搭建和启动_spring

SpringBoot入门(一) springBoot框架搭建和启动_apache_02


//CODE

    

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.spb.one</groupId>
  <artifactId>spb-one</artifactId>
    <version>1.0</version>

   <parent>
	    <groupId>org.springframework.boot</groupId>
	    <artifactId>spring-boot-starter-parent</artifactId>
	    <version>1.5.10.RELEASE</version>
	</parent>
	<dependencies>
	    <dependency>
	        <groupId>org.springframework.boot</groupId>
	        <artifactId>spring-boot-starter-web</artifactId>
	    </dependency>
	</dependencies>
	
</project>



package hello;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
@EnableAutoConfiguration
public class SampleController {

    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World!";
    }

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

//运行结果

    

SpringBoot入门(一) springBoot框架搭建和启动_spring_03

//访问spring官方第一个springBoot工程

    

SpringBoot入门(一) springBoot框架搭建和启动_maven_04


举报

相关推荐

0 条评论