//spring-boot
implementation 'org.springframework.boot:spring-boot-starter:2.6.3'
//webflux
implementation 'org.springframework.boot:spring-boot-starter-webflux:2.6.0'
//mongoDb
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive:2.6.0'
实体类User:
package com.fdw.webflux.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.persistence.Id;
/**
* @program:
* @description:
* @author:
* @create: 2023-12-15 17:47
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "user")
public class User {
@Id
private String id;
private String name;
private int age;
}