spring boot(1):简介
Spring Boot的优点
Spring Boot 是伴随着 Spring 4.0 诞生的,从字面理解,Boot是引导的意思,因此 Spring Boot 旨在帮助开发者快速搭建 Spring 框架。Spring Boot 继承了原有 Spring 框架的优秀基因,使 Spring 在使用中更加方便快捷。
嵌入的 Tomcat 、 Jetty 或者 Undertow,无须部署 WAR 文件:
配置Ecplise的Spring Boot开发环境
Unregistering JMX-exposed beans on shutdown
解决办法:去除 <scope>provided</scope>
<dependency>
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
To display the auto-configuration report re-run your application with 'debug' enabled.
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
pom.xml
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.0.7.Final</version> </dependency>
Spring环境配置(安装springsource-tool-suite插件)及第一个Spring HelloWorld
[spring boot][thymeleaf]spring boot 1.5+ 页面无法找到
<properties> <!-- springboot 默认使用thymeleaf的2.0,即:spring-boot-starter-thymeleaf中包含的是thymeleaf2.X springboot1.5.2+需要使用thymeleaf3.X。手动去配置 --> <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version> <thymeleaf-layout-dialect.version>2.0.4</thymeleaf-layout-dialect.version> </properties>
@Controller返回试图 @RestController返回Json
spring boot热部署,pom需要添加以下的配置:
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin> </plugins> </build>
Spring Boot 的配置文件及多环境配置
Profile 是 Spring 用来针对不同的环境对不同的配置提供支持的,全局 Profile 配置使用 application-{profile}. yml(如 application-prod.yml)。
通过在 application.yml 中设置 spring.profiles.active = prod 来指定活动的 Profile。
依次再目录下面新建三个配置文件,application-dev.yml、application-test.yml、application-prod.yml。它们分别代表开发环境、测试环境、生产环境的配置文件。
项目设计
本项目用到的技术和框架
项目构建: maven
web框架:spring boot
数据库ORM:mybatis
数据库连接池:Druid
分页插件:PageHelper
数据库:mysql
缓存NOSQL:redis
前端模板:thymeleaf
文章展示:使用commonmark,将markdown转成html页面
资料
http://springboot.fun/
http://spring.io/tools/sts/all
http://blog.csdn.net/q649381130/article/details/77875736
https://www.cnblogs.com/superfj/p/9044532.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
2017-03-03 Java MyBatis3(1)入门
2016-03-03 KBase使用教程