SpringBoot3

JDK****关注的新特性

搭建学习环境

有用的新特性

Java Record

看看Record怎么用

Instance Methods

静态方法****Static Method

Record****的构造方法

RecordLombok

Record****实现接口

Local Record

嵌套****Record

instanceof判断Record****类型

Switch

箭头表达式,新的case标签

yeild****返回值

java 复制代码
public static void main(String[] args) {
int week = 1;
//yield 是 switch 的返回值, yield 跳出当前 switch 块
String memo = switch (week){
case 1 ->{
System.out.println("week=1 的 表达式部分");
yield "星期日,休息";
}
case 2,3,4,5,6 ->{
System.out.println("week=2,3,4,5,6 的 表达式部分");
yield "工作日";
}
case 7 -> {
System.out.println("week=7 的 表达式部分");
yield "星期六,休息";
}
default -> {
System.out.println("其他语句");
yield "无效日期";
}
};
System.out.println("week = " + memo);
}

Java Record

Text Block

认识文本块

文本块与普通的双引号字符串一样

java 复制代码
public void fun1() {
String s1= """
lisi
""";
String s2 = """
lisi
""";
//比较字符串
boolean b1 = s1.equals(s2);
System.out.println("b1 = " + b1);
//使用 == 的比较
boolean b2 = s1 == s2;
System.out.println("b2 = " + b2);
String msg = """
hello world""";
//字符串方法 substring
String sub = msg.substring(0, 5);
System.out.println("sub = " + sub);
}

空白

文本块的方法

转义字符

var

var****声明局部变量

使用时候使用****var

sealed

Sealed Classes

java 复制代码
//第一种 final
public final class Circle extends Shape {
}
//第二种 sealed class
public sealed class Square extends Shape permits RoundSquare {
@Override
public void draw() {
System.out.println("=======Square 图形======");
}
}
//密封类的子类的子类
public final class RoundSquare extends Square{
}
//非密封类 , 可以被扩展。放弃密封
public non-sealed class Rectangle extends Shape {
}
//继承非密封类
public class Line extends Rectangle{
}

Sealed Interface

Spring Boot

Spring关系

SpringCloud关系

最新的Spring Boot3新特性

如何学好框架

脚手架

使用脚手架创建项目

IDEA创建SpringBoot****项目

代码结构

单一模块

多个模块

包和主类

spring-boot-starter-parent

运行Spring Boot项目方式

starter

外部化配置

相关推荐
Jeremy_102213 分钟前
SpringBatch之ResultSet.next()
spring·batch
芒猿君18 分钟前
AQS——同步器框架之源
后端
SaebaRyo27 分钟前
手把手教你在网站中启用https和http2
后端·nginx·https
Forget the Dream30 分钟前
设计模式之迭代器模式
java·c++·设计模式·迭代器模式
MiniFlyZt37 分钟前
消息队列MQ(RabbitMQ)
spring boot·分布式·微服务·rabbitmq
大丈夫在世当日食一鲲37 分钟前
Java中用到的设计模式
java·开发语言·设计模式
A-Kamen41 分钟前
Spring Boot拦截器(Interceptor)与过滤器(Filter)深度解析:区别、实现与实战指南
java·spring boot·后端
练川43 分钟前
Stream特性(踩坑):惰性执行、不修改原始数据源
java·stream
豆豆酱1 小时前
Transformer结构详解
后端
upsilon1 小时前
golang切片slice
后端·go