springboot 创建一个HelloWorld应用并且运行


1.创建一个helloworld主程序类

/**
* @SpringBootApplication 用来标注一个主程序类,这是一个SpringBoot应用
*/
@SpringBootApplication
public class SpringBootHellowordConfigApplication {

public static void main(String[] args) {

//Spring应用启动
SpringApplication.run(SpringBootHellowordConfigApplication.class,args);
}

}

2.写一个controller

@Controller
public class HelloController {

@ResponseBody
@RequestMapping("/hello")
public String helloController(){
return "hello controller";
}

}
3.运行主配置类,后查看端口号
  

4.浏览器运行:http://localhost:8081/hello 即可



					


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM