1 回答

TA貢獻(xiàn)1884條經(jīng)驗(yàn) 獲得超4個贊
我想我有一個答案:
我為我的應(yīng)用程序創(chuàng)建了一個控制器,并按如下方式更新了我的代碼:
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";
}
}
然后使用此路徑查看您的執(zhí)行情況:http://localhost:8080/home。
添加回答
舉報