运行 Main 类后,我无法获得输出。Spring Boot 新手
控制器
@Controller
public class WelcomeController {
private static final String welcomemsg = "Welcome Mr. %s!";
@GetMapping("/welcome/user")
@ResponseBody
public Welcome welcomeUser(@RequestParam(name = "name", required = false, defaultValue = "Java Fan") String name)
{
return new Welcome(String.format(welcomemsg, name));
}
}
主班
package com.beans.mainsrc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = { "com.beans" })
public class DemoApplication {
public static void main(String[] args)
{
SpringApplication.run(DemoApplication.class, args);
}
}
有关运行主类的控制台详细信息
2018-09-28 00:40:01.268 INFO 2304 --- [ main] com.beans.mainsrc.DemoApplication : Starting DemoApplication on DESKTOP-551C51M with PID 2304 (F:\springbootdemo\demo\target\classes started by sparsh in F:\springbootdemo\demo)
2018-09-28 00:40:01.273 INFO 2304 --- [ main] com.beans.mainsrc.DemoApplication : No active profile set, falling back to default profiles: default
跃然一笑
相关分类