链接github:https://github.com/hoangtien2k3/reactify-core
这个库构建在 Spring WebFlux 和 Reactor-Core 的核心组件之上——这两个强大的工具支持反应式编程。通过这个库,您可以轻松构建异步微服务应用程序,高效处理非线性数据流。
亮点功能包括:
高性能和良好的响应能力:
使用非阻塞机制,该库可以处理数千个并发请求,而无需创建太多线程,从而减少了资源负载并提高了响应速度。
轻松流处理:
Reactor-Core 提供了强大的流处理 API,适合需要处理连续数据的应用,如实时通知系统、事件处理、大数据处理系统。
与 Spring 生态系统轻松集成:
该库旨在与 Spring 生态系统中的组件(例如 Spring Security、Spring Data R2DBC)良好配合,帮助轻松构建完整的应用程序。
@ComponentScan(basePackages = { "com.reactify.*", // add default: com.reactify.* "com.example.myproject" // varies depending on your project }) @SpringBootApplication public class ExampleApplication { public static void main(String[] args) { SpringApplication.run(Example.class, args); } }
# spring config spring: main: web-application-type: reactive allow-bean-definition-overriding: true messages: basename: i18n/messages #connect db R2DBC PostgreSQL r2dbc: url: r2dbc:postgresql://localhost:5434/auth username: admin password: admin pool: max-size: 10 initial-size: 5 # Config connect Keycloak security: oauth2: client: provider: oidc: token-uri: ${keycloak.serverUrl}/realms/${keycloak.realm}/protocol/openid-connect/token registration: oidc: client-id: ${keycloak.clientId} client-secret: ${keycloak.clientSecret} authorization-grant-type: ${keycloak.grantType} #password || #client_credentials resourceserver: jwt: jwk-set-uri: ${keycloak.serverUrl}/realms/${keycloak.realm}/protocol/openid-connect/certs keycloak: client-id: ${keycloak.clientId} # Web client config client: #keycloak keycloak: address: http://localhost:8080/realms/ezbuy-server/protocol/openid-connect name: keycloak auth: client-id: ezbuy-client client-secret: mI92QDfvi20tZgFtjpRAPWu8TR6eMHmw #notification notification: internal-oauth: true address: http://localhost:7777/v1/transmission name: notiServiceClient pool: max-size: 100 max-pending-acquire: 100 timeout: read: 60000 write: 1000 # Unauthenticated endpoints config application: http-logging: request: enable: true header: true param: true body: true response: enable: true body: true whiteList: - uri: /v1/auth/generate-otp methods: - POST - uri: /** methods: - OPTIONS - uri: /v1/auth/get-all methods: - GET data: sync-data: limit: 500 #keycloak client config keycloak: clientId: ezbuy-client clientSecret: mI92QDfvi20tZgFtjpRAPWu8TR6eMHmw realm: ezbuy-server serverUrl: http://localhost:8080 grantType: password host: localhost # minio server config minio: bucket: ezbuy-bucket enabled: true baseUrl: http://localhost:9000 publicUrl: http://localhost:9000/ezbuy-bucket accessKey: 4DoaZ0KdzpXdDlVK104t secretKey: nuRiQUIJNVygMOHhmtR4LT1etAa7F8PQOsRGP5oj private: bucket: ezbuy-private
# Using Maven mvn spring-boot:run # Using Gradle gradle bootRun
webflux 微服务项目的reactify-core 库:keycloak-auth-service
每个人都可以提供反馈并查找错误或改进这个库,以帮助社区发展得更强大,非常感谢
祝你有美好的一天
以上是后端微服务Webflux Java库简介(Reactor-core)的详细内容。更多信息请关注PHP中文网其他相关文章!