連結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中文網其他相關文章!