SpringBoot初体验
时间: 2023-10-26 11:25:28 浏览: 67
SpringBoot是一个用于简化Spring应用程序开发的框架。它通过提供默认的配置和实现,使得开发人员可以更加专注于业务逻辑的实现,而不需要手动配置和编写大量的样板代码。
在初次体验SpringBoot时,首先需要修改启动类,让它继承SpringBootServletInitializer,并添加@SpringBootApplication和@EnableScheduling注解。然后,执行clean和package命令,将应用打包并启动Tomcat。最后,访问相应的请求路径,就可以看到期望的页面了。
以下是一个示例的启动类:
```
@SpringBootApplication
@EnableScheduling
public class App {
public static void main(String[] args) {
System.out.println("Hello World!");
SpringApplication.run(App.class, args);
}
}
```
这个启动类中,我们使用了@SpringBootApplication注解来标识这是一个SpringBoot应用程序,并使用@EnableScheduling注解来启用定时任务的支持。然后,在main方法中,我们通过调用SpringApplication的run方法来启动应用程序。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [SpringBoot初体验(完整版)](https://blog.csdn.net/yuxiao97/article/details/78759473)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [SpringBoot初体验](https://blog.csdn.net/s13554341560b/article/details/78126194)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)