-
SpringBoot
是一個微框架,快速上手,門檻低
可以創建獨立運行的應用不依賴于容器
提供maven極簡配置,缺點是會引入很多不需要的包
簡化配置,不再用過多的xml
為微服務SpringCloud鋪路
使用場景:
有Spring的地方都可以
J2EE/WEB項目
微服務
查看全部 -
Spring Boot介紹
????Spring Boot 是一個開源框架,它可以簡化創建獨立的、基于 Spring 的應用程序和服務。使用約定優于配置的方式來減少開發人員的工作量,并提供了強大的自動化配置功能。 Spring Boot 支持多種構建工具,包括 Maven 和 Gradle。
?
Spring Boot 的主要特點:
快速啟動:Spring Boot可以在幾秒鐘內啟動并運行。
自動配置:Spring Boot可以自動配置大部分應用程序所需的組件和庫,減少了手動配置的工作。
無代碼生成和 XML 配置:Spring Boot 遵循 “約定優于配置” 的原則,減少了手動編寫代碼和配置文件的工作。
集成多種常用庫:Spring Boot 可以輕松集成多種常用庫,包括數據庫、消息隊列、安全等。
生產就緒性:Spring Boot 提供了各種功能,例如 Forwaring、metrics 和健康指示器,以確保應用程序在生產環境中穩定運行
?
在 Maven 中添加 Spring Boot依賴項:
????xml文件中:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
?
查看全部 -
源碼
https://github.com/leechenxiang/imooc-springboot-starter
查看全部 -
異步@EnableAsync
查看全部 -
使用注解@EnableAsync開啟異步,寫在Application啟動類上
@Async? 標記為異步任務
查看全部 -
@EnableScheduling? ?//開啟定時任務,自動掃描? 寫在Application啟動類上
@Component? ?//作為組件被容器掃描
@Scheduld中也可以使用cron表達式
@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筆記
重要性:
微框架。
可以快速的上手,整合了一些子項目。
很少的配置。
特點:
基于Spring,使開發者快速入門,門檻很低。
springBoot可以獨立運行的運用,不用依賴于容器。
不需要打包,直接可以在服務器中使用。
提供了maven配置,缺點就是引入一些你不用的包。
可視化
簡化配置,不要看過多的xml配置
為微服務鋪路,比如dubbo
使用場景:
有Spring的地方都可以
j2EE/web項目
微服務
查看全部 -
熱處理代碼
查看全部 -
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="UTF-8">
? ? <title>制作我的第一個網頁</title>
? ? <h1>hello? world</h1>
</head>
<body>
</body>
</html>
查看全部 -
<!DOCTYPE?html><html><head>????<meta?charset="UTF-8">????<title>制作我的第一個網頁</title>????<h1>hello??world</h1></head><body></body></html>
查看全部 -
<!DOCTYPE?html><html><head>????<meta?charset="UTF-8">????<title>制作我的第一個網頁</title>????<h1>hello??world</h1></head><body></body></html>
查看全部 -
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="UTF-8">
? ? <title>制作我的第一個網頁</title>
? ? <h1>hello? world</h1>
</head>
<body>
</body>
</html>
查看全部 -
<h1>你好</h1>
查看全部 -
使用devtools來進行熱部署,可以在不關閉服務的情況下進行實時更新
查看全部 -
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統一捕獲異常
查看全部 -
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
查看全部
舉報