idea:springboot搭建的问题

我照着教程写了一遍先创建个简单的spring boot,最终运行有错,请问这个SpringApplication应该补充什么程序?

package com.example.demo;

import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication

class DemoApplication {
    @RequestMapping("/")
public String first(){
        return "my name is Stephen";
    }
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

img

请问StringApplication应该补充pubilc String run(){}吗还是什么?

这个是test文件中的,你把这个文件删了,然后在你的src/java下面的启动类DemoApplication中,右键run就行了,如果有连接数据库的,可能需要通过注解排除掉数据库的类