idea创建springboot项目
idea创建springboot项目
Spring Boot特点
1. 创建独立的Spring应用程序
2. 嵌入的Tomcat,无需部署WAR文件
3. 简化Maven配置
4. 自动配置Spring
5. 提供生产就绪型功能,如指标,健康检查和外部配置
6. 绝对没有代码生成和对XML没有要求配置。
1. 在idea中创建一个新工程。file->new->project
2. 选择Spring Initializr,右侧SDK选择自己安装的JDK->next。
3. 包名和项目名可自行修改,type选择maven project->next
4. 选择Web菜单下的web选项,其他需要整合的自己选择,这里只做最简单的demo
5. 修改工程名称和地址->finish,整体项目结构如下
6. 在springbootdemo包下新建controller包,并新建HelloController类,springboot值扫描springbootDemoApplicaiton主程序类所在的包及其子包
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello(){
return "欢饮使用springboot";
}
}
7.启动springbootDemoApplication类的main函数,测试http://localhost:8080/hello

浙公网安备 33010602011771号