springboot3 record新特性
时间: 2023-09-27 11:10:34 浏览: 49
很抱歉,目前还没有Spring Boot 3版本。目前最新的版本是Spring Boot 2.5.x。不过,Spring Boot 2.5版本中引入了一些新特性,如下所示:
1. 对Java 16的支持。
2. 对Micrometer 1.6的支持,可以在应用程序中度量和监控指标。
3. 为Spring WebFlux应用程序引入了HTTP/2支持。
4. 引入了新的Spring Boot Actuator端点,包括/jvm、/system和/scheduledtasks等。
5. 引入了对Kotlin 1.5和Gradle 7的支持。
6. 引入了对RSocket的支持,可以在应用程序中使用RSocket进行双向异步通信。
除此之外,Spring Boot 2.5版本还修复了许多bug和改进了性能。
相关问题
springboot3 整合jooq
以下是Spring Boot 3整合Jooq的步骤:
1.在pom.xml文件中添加以下依赖:
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
</dependency>
```
2.在application.yml文件中添加以下配置:
```yaml
spring:
datasource:
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password: root
jooq:
sql-dialect: MYSQL
```
3.在pom.xml文件中添加以下插件:
```xml
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.14.4</version>
<executions>
<execution>
<id>generate-jooq-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>com.mysql.cj.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false</url>
<user>root</user>
<password>root</password>
</jdbc>
<generator>
<database>
<name>org.jooq.meta.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>test</inputSchema>
</database>
<target>
<packageName>com.example.demo.jooq</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
</plugin>
```
4.在src/main/resources目录下创建jooq.xml文件,添加以下内容:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.14.4.xsd">
<jdbc>
<driver>com.mysql.cj.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false</url>
<user>root</user>
<password>root</password>
</jdbc>
<generator>
<database>
<name>org.jooq.meta.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>test</inputSchema>
</database>
<target>
<packageName>com.example.demo.jooq</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
```
5.运行以下命令生成Jooq代码:
```bash
mvn clean install
```
6.在代码中使用Jooq进行CURD操作,例如:
```java
@Autowired
DSLContext dsl;
public void insert() {
dsl.insertInto(TABLE_NAME)
.set(TABLE_NAME.NAME, "test")
.set(TABLE_NAME.AGE, 18)
.execute();
}
public void update() {
dsl.update(TABLE_NAME)
.set(TABLE_NAME.NAME, "test2")
.where(TABLE_NAME.ID.eq(1))
.execute();
}
public void delete() {
dsl.delete(TABLE_NAME)
.where(TABLE_NAME.ID.eq(1))
.execute();
}
public List<Record> select() {
return dsl.select()
.from(TABLE_NAME)
.where(TABLE_NAME.ID.eq(1))
.fetch();
}
```
java17有哪些新特性?
Java 17 是 Java SE Platform Standard Edition 17 的一个版本,于 2021 年 9 月发布。它包含了一些新特性和改进,其中一些是:
1. Sealed Classes:可以限制子类的数量,提高代码的安全性和可维护性。
2. Pattern Matching for instanceof:可以在一个语句中同时判断对象类型和类型转换。
3. Switch Expressions:可以作为表达式使用的 Switch 语句,使代码更简洁。
4. Records:引入了一个新的 Record 类型,可以更方便地定义不可变的数据类。
5. Enhanced Enums:枚举类型可以实现接口和方法,使其更灵活。
6. Vector API:引入了一组向量化操作 API,可以提高数值计算的性能。
7. Foreign Function and Memory API:允许 Java 代码与非 Java 语言交互,并提供更直接的内存访问。
8. Deprecate the Applet API:不再支持 Applet 技术,提高了 Java SE 平台的安全性。
以上就是 Java 17 的一些新特性和改进。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.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)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)