package com.ld.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @RequestMapping(value = "index")
    public String index() {

        return "Hello World!!!";
    }
    @RequestMapping(value = "show")
    public String show(){
        return "Hello Spring Boot";
    }
}
package com.ld.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class RootApplication {

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

pom.xml文件配置

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
</parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

一、Hello Spring Boot

运行程序main方法,在浏览器输入:http://localhost:8080/index

一、Hello Spring Boot

一、Hello Spring Boot

相关文章:

  • 2021-05-18
  • 2021-06-21
  • 2021-11-08
  • 2021-11-25
  • 2021-11-26
  • 2022-12-23
  • 2021-08-21
  • 2021-04-15
猜你喜欢
  • 2021-05-09
  • 2021-08-23
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-11-22
相关资源
相似解决方案