1 回答

TA貢獻1884條經驗 獲得超4個贊
我想我有一個答案:
我為我的應用程序創建了一個控制器,并按如下方式更新了我的代碼:
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages = {"Name_controller_path"})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
然后我的控制器將如下所示:
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Appcontroller {
@RequestMapping(value = "/home", method = RequestMethod.GET)
String home() {
return "home";
}
}
然后使用此路徑查看您的執行情況:http://localhost:8080/home。
添加回答
舉報