-
SpringBoot
是一個(gè)微框架,快速上手,門檻低
可以創(chuàng)建獨(dú)立運(yùn)行的應(yīng)用不依賴于容器
提供maven極簡配置,缺點(diǎn)是會(huì)引入很多不需要的包
簡化配置,不再用過多的xml
為微服務(wù)SpringCloud鋪路
使用場景:
有Spring的地方都可以
J2EE/WEB項(xiàng)目
微服務(wù)
查看全部 -
Spring Boot介紹
????Spring Boot 是一個(gè)開源框架,它可以簡化創(chuàng)建獨(dú)立的、基于 Spring 的應(yīng)用程序和服務(wù)。使用約定優(yōu)于配置的方式來減少開發(fā)人員的工作量,并提供了強(qiáng)大的自動(dòng)化配置功能。 Spring Boot 支持多種構(gòu)建工具,包括 Maven 和 Gradle。
?
Spring Boot 的主要特點(diǎn):
快速啟動(dòng):Spring Boot可以在幾秒鐘內(nèi)啟動(dòng)并運(yùn)行。
自動(dòng)配置:Spring Boot可以自動(dòng)配置大部分應(yīng)用程序所需的組件和庫,減少了手動(dòng)配置的工作。
無代碼生成和 XML 配置:Spring Boot 遵循 “約定優(yōu)于配置” 的原則,減少了手動(dòng)編寫代碼和配置文件的工作。
集成多種常用庫:Spring Boot 可以輕松集成多種常用庫,包括數(shù)據(jù)庫、消息隊(duì)列、安全等。
生產(chǎn)就緒性:Spring Boot 提供了各種功能,例如 Forwaring、metrics 和健康指示器,以確保應(yīng)用程序在生產(chǎn)環(huán)境中穩(wěn)定運(yùn)行
?
在 Maven 中添加 Spring Boot依賴項(xiàng):
????xml文件中:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
?
查看全部 -
源碼
https://github.com/leechenxiang/imooc-springboot-starter
查看全部 -
異步@EnableAsync
查看全部 -
使用注解@EnableAsync開啟異步,寫在Application啟動(dòng)類上
@Async? 標(biāo)記為異步任務(wù)
查看全部 -
@EnableScheduling? ?//開啟定時(shí)任務(wù),自動(dòng)掃描? 寫在Application啟動(dòng)類上
@Component? ?//作為組件被容器掃描
@Scheduld中也可以使用cron表達(dá)式
@Scheduld(cron = "4-40 * * * * ?")
cron.qqe2.com
查看全部 -
@JsonIgnore? ? ?// 此屬性不返回
@JsonFromat(pattern="yyyy-MM-dd hh:mm:ss a", locale="zh",timezone="GMT+8")? ?//格式化
@JsonInclude(Include.NON_NULL)? ? //如果此屬性為空則不返回
查看全部 -
Spring Boot筆記
重要性:
微框架。
可以快速的上手,整合了一些子項(xiàng)目。
很少的配置。
特點(diǎn):
基于Spring,使開發(fā)者快速入門,門檻很低。
springBoot可以獨(dú)立運(yùn)行的運(yùn)用,不用依賴于容器。
不需要打包,直接可以在服務(wù)器中使用。
提供了maven配置,缺點(diǎn)就是引入一些你不用的包。
可視化
簡化配置,不要看過多的xml配置
為微服務(wù)鋪路,比如dubbo
使用場景:
有Spring的地方都可以
j2EE/web項(xiàng)目
微服務(wù)
查看全部 -
熱處理代碼
查看全部 -
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="UTF-8">
? ? <title>制作我的第一個(gè)網(wǎng)頁</title>
? ? <h1>hello? world</h1>
</head>
<body>
</body>
</html>
查看全部 -
<!DOCTYPE?html><html><head>????<meta?charset="UTF-8">????<title>制作我的第一個(gè)網(wǎng)頁</title>????<h1>hello??world</h1></head><body></body></html>
查看全部 -
<!DOCTYPE?html><html><head>????<meta?charset="UTF-8">????<title>制作我的第一個(gè)網(wǎng)頁</title>????<h1>hello??world</h1></head><body></body></html>
查看全部 -
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="UTF-8">
? ? <title>制作我的第一個(gè)網(wǎng)頁</title>
? ? <h1>hello? world</h1>
</head>
<body>
</body>
</html>
查看全部 -
<h1>你好</h1>
查看全部 -
使用devtools來進(jìn)行熱部署,可以在不關(guān)閉服務(wù)的情況下進(jìn)行實(shí)時(shí)更新
查看全部 -
https://github.com/abel533/MyBatis-Spring-Boot
https://github.com/leechenxiang/imooc-springboot-starter
查看全部 -
緩存
查看全部 -
Redis
查看全部 -
sprinboot 配置文件
在resources?
????*.properties
@configuration
@configurationProperties(prefix="com.*")????/前綴
@prepertySourec?(value ="classpath:")? ?/文件地址
查看全部 -
熱部署
springboot:
devtools
查看全部 -
熱部署
springboot:
devtools -jar
查看全部 -
熱部署
springboot:
devtools -jar
查看全部 -
LeeJsonResult
查看全部 -
SringMVC
@controller?
@requestMapping
????@requestMapping
????@responseBody
Springboot
@restcontroller? ?:@controller+@responseBody
????@requestMapping
?
查看全部 -
@ExceptionHandler統(tǒng)一捕獲異常
查看全部 -
https://github.com/leechenxiang/imooc-springboot-starter
查看全部 -
java class文件
spring-boot-devtools
<optional>true</optional>
頁面文件
spring.thymeleaf.cache=false
spring.devtools.restart.enabled=true
spring.devtools.restart.additional-paths=src/main/java
spring.devtools.restart.exclude=static/**,public/**
spring.devtools.restart.exclude=WEB-INF/**
restart.include.mapper=/mapper-[\\w-\\.]+jar
restart.include.pagehelper=/pagehelper-[\\w-\\.]+jar
查看全部
舉報(bào)