其他分享
首页 > 其他分享> > 9-写一个最简单的测试接口

9-写一个最简单的测试接口

作者:互联网

DemoApplication.java
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class DemoApplication {

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

    @GetMapping("/")
    public String index(){
        return "oK";
    }
}

 

配置服务启动端口为9090 ,配置文件application.properties:

server.port=9090

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3308/qing?serverTimeZone=GMT%2b8
spring.datasource.username=root
spring.datasource.password=123456

 

标签:spring,org,springframework,接口,测试,简单,import,DemoApplication,datasource
来源: https://www.cnblogs.com/jingzaixin/p/16369018.html