使用idea创建springboot

点击file选择new project使用idea创建springboot

使用idea创建springboot

在红色框写一个springbootdemo

使用idea创建springboot

使用idea创建springboot使用idea创建springboot

点击next再点击完成

使用idea创建springboot

创建一个HelloController

使用idea创建springboot

使用idea创建springboot

程序自动生成的SpringbootdemoApplication,会有一个@SpringBootApplication的注解,这个注解用来标明这个类是程序的入口

使用idea创建springboot使用idea创建springboot

@SpringBootApplication开启了Spring的组件扫描和springboot的自动配置功能,相当于将以下三个注解组合在了一起

(1)@Configuration:表名该类使用基于Java的配置,将此类作为配置类

(2)@ComponentScan:启用注解扫描

(3)@EnableAutoConfiguration:开启springboot的自动配置功能


运行SpringbootdemoApplication类

使用idea创建springboot


测试

使用idea创建springboot