All Projects → jittagornp → Spring Boot Reactive Example

jittagornp / Spring Boot Reactive Example

ตัวอย่างการเขียน Java Spring-boot Reactive (WebFlux)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Spring Boot Reactive Example

Blog
蓝眼系列软件之《蓝眼博客》开发中...
Stars: ✭ 108 (-2.7%)
Mutual labels:  spring-boot
Spring Boot Examples
🥗​ Spring/SpringBoot/SpringCloud 实践学习案例,从入门到精通,持续更新中,欢迎交流学习🍺 !
Stars: ✭ 110 (-0.9%)
Mutual labels:  spring-boot
Entitas 2d Roguelike
Rewrite of the Unity 2D Roguelike example using the Entitas Entity Component System
Stars: ✭ 110 (-0.9%)
Mutual labels:  example
Discordsoundboard
Java Soundboard for Discord
Stars: ✭ 108 (-2.7%)
Mutual labels:  spring-boot
Spring Blog
Spring Boot base Blog
Stars: ✭ 109 (-1.8%)
Mutual labels:  spring-boot
Deep Learning Based Ecg Annotator
Annotation of ECG signals using deep learning, tensorflow’ Keras
Stars: ✭ 110 (-0.9%)
Mutual labels:  example
Mall
mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现,采用Docker容器化部署。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。
Stars: ✭ 54,797 (+49266.67%)
Mutual labels:  spring-boot
Spring Cloud Example
Stars: ✭ 111 (+0%)
Mutual labels:  spring-boot
Spring Cloud Sleuth
Distributed tracing for spring cloud
Stars: ✭ 1,531 (+1279.28%)
Mutual labels:  spring-boot
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-0.9%)
Mutual labels:  spring-boot
Spring Boot Quartz Scheduler Email Scheduling
Spring Boot Quartz Scheduler Example that schedules Emails to be sent at a later time.
Stars: ✭ 109 (-1.8%)
Mutual labels:  spring-boot
Example
Cake example repository
Stars: ✭ 109 (-1.8%)
Mutual labels:  example
Skeleton
springboot+mybatis skeleton
Stars: ✭ 110 (-0.9%)
Mutual labels:  spring-boot
Vaadin Microservices Demo
A microservices example developed with Spring Cloud and Vaadin
Stars: ✭ 108 (-2.7%)
Mutual labels:  spring-boot
Kotlin Playground
Kotlin practice
Stars: ✭ 111 (+0%)
Mutual labels:  example
Spring Cloud Study
spring-cloud学习
Stars: ✭ 108 (-2.7%)
Mutual labels:  spring-boot
Ugin
UGin is an API boilerplate written in Go (Golang) with Gin Framework.
Stars: ✭ 110 (-0.9%)
Mutual labels:  example
Nb Springboot
NetBeans IDE plugin supporting programming with Spring Boot
Stars: ✭ 111 (+0%)
Mutual labels:  spring-boot
Stm32 Dma Uart
Efficient DMA timeout mechanism for peripheral DMA configured in circular mode demonstrated on a STM32 microcontroller.
Stars: ✭ 111 (+0%)
Mutual labels:  example
Jeesite4
Java EE 企业级快速开发平台,基于经典技术组合(Spring Boot、Spring MVC、Apache Shiro、MyBatis、Beetl、Bootstrap、AdminLTE),在线代码生成功能,包括核心模块如:组织机构、角色用户、菜单及按钮授权、数据权限、系统参数、内容管理、工作流等。采用松耦合设计;界面无刷新,一键换肤;众多账号安全设置,密码策略;在线定时任务配置;支持集群,支持SAAS;支持多数据源
Stars: ✭ 1,563 (+1308.11%)
Mutual labels:  spring-boot

Spring-boot Reactive Example

ตัวอย่างการเขียน Java Spring-boot Reactive (WebFlux) ซึ่งเป็นการเขียน Spring-boot แบบ Non-Blocking I/O หรือ Asynchronous

Reactive Spring

เชิญชวน

อยากเชิญชวน คนที่มีความรู้ความสามารถด้านใดด้านหนึ่งตามที่ตัวเองถนัด ทำตัวอย่างอะไรทำนองนี้ไว้
เพื่อให้ผู้เริ่มต้น หรือมือใหม่ได้มีตัวอย่างอ้างอิงที่สามารถเอาไปประยุกต์ใช้ได้

ตัวผมเองก็ใช้อันนี้สอนน้อง ๆ สอนเด็กฝึกงานที่บริษัท อีกทั้งเอาไว้ทบทวนตัวเองด้วย
กับเห็นว่ามันมีประโยชน์สำหรับทุกคน เลยแชร์ไว้ครับ

ปัญหา / ข้อเสนอแนะ

หากพบปัญหา หรือ ต้องการให้ทำอะไรเพิ่ม รบกวนช่วยเปิด issue หรือ fork/pull request ให้ด้วยน่ะครับ
ขอบคุณครับ :)

การสนันสนุน หรือ Donate

สำหรับคนที่นำ Repository นี้ไปใช้ในการเรียนรู้ หรือสร้างสรรค์ผลงานให้เกิดมูลค่า
ถ้าอยากที่จะสนับสนุนหรือ Support Repository นี้ สามารถทำได้ 3 ทางครับ คือ

  1. ผ่านทาง Prompt Pay QR Code
  2. ผ่านบัญชีธนาคาร
  3. ผ่านทาง Buy Me a Coffee

ทั้งนี้เพื่อเป็นค่ากาแฟ และค่าแพมเพิส (ผ้าอนามัย) ลูกสาวครับ 😍

Prompt Pay QR

บัญชีธนาคาร

ธนาคารไทยพาณิชย์
เลขที่บัญชี 274-214985-3
ชื่อบัญชี นายจิตกร พิทักษ์เมธากุล

By Me a Coffee

คลิกที่ปุ่มนี้

ถ้ามีข้อสงสัยอะไร สามารถ Inbox ไปสอบถามใน Facebook ส่วนตัวได้ครับ
https://www.facebook.com/jittagornp

Spring

https://spring.io

Spring เป็น Framework ฝั่งภาษา Java สำหรับใช้เขียน Web และ Back-end Application ที่ได้รับความนิยมอย่างมากในปัจจุบัน มีระบบนิเวศ หรือ Ecosystem ต่าง ๆ มากมาย ทำให้สามารถนำ Spring ไปใช้สร้างสรรค์ผลงานต่าง ๆ ได้อย่างรวดเร็ว

Spring-boot

https://spring.io/projects/spring-boot

Spring-boot เป็น Subset (Project นึง) ของ Spring Framework เป็นการเอา Ecosystem ต่าง ๆ ของ Spring ที่มีอยู่ มาประกอบร่างรวมกัน เพื่อให้ใช้งาน Spring ได้ง่ายขึ้น โดยมีจุดเด่นดังนี้

  1. สามารถใช้ Spring-boot ทำ Stand Alone หรือ Micro Service Application ได้
  2. มี Embeded Application Server ภายในตัว สามารถ Start ตัวเองได้ โดยไม่ต้องพึ่งพา Application Server จากภายนอก
  3. มีระบบ Auto Configuration
  4. Config ง่าย
  5. ใช้งานง่าย
  6. Deploy ง่าย
  7. อื่น ๆ

Spring-boot มี 2 แบบ คือ

  1. แบบ Servlet Stack
  2. แบบ Reactive Stack

Servlet Stack

  • เป็นการเขียน Code แบบ Blocking I/O
  • ใช้ Web MVC เป็น Base
  • เขียนง่าย ตรงไปตรงมา
  • Application Server จะใช้เทคนิคในการจัดการ Request/Response ด้วย Thread Pool Connection

Reactive Stack

  • เป็นการเขียน Code แบบ Non-Blocking I/O
  • เขียน Code แบบ Reactive (เป็นการเขียนโปรแกรมรูปแบบหนึ่ง ที่ตอบสนองต่อเหตุการณ์ที่เกิดขึ้น)
  • ใช้ WebFlux เป็น Base
  • เขียน/เข้าใจ ยากกว่าแบบ Servlet Stack
  • Application Server จะใช้เทคนิคในการจัดการ Request/Response ด้วย Event Loop
  • กิน Resources (CPU, RAM) น้อยกว่าแบบ Servlet Stack
  • รองรับ Concurrent ได้มากกว่าแบบ Servlet Stack

Spring-boot Reactive

สามารถเขียนได้ 2 แบบ คือ

  1. แบบ Annotated Controllers
  2. แบบ Functional Endpoints

จากตัวอย่าง โดยส่วนมากจะใช้เป็นแบบ Annotated Controllers

เอกสาร Spring-boot Reactive

สำหรับคนที่เขียน Spring-boot ใหม่ ๆ แล้วสงสัยว่า เราจะรู้ได้ยังไงว่าเราสามารถ Config Application Properties อะไรได้บ้าง ให้ดูจากหน้านี้

ข้อแตกต่าง

WebFlux Performance

Prerequisites

สิ่งที่ต้องรู้ก่อนเขียน Spring-boot Reactive

ตัวอย่างการเขียน Reactor

เริ่ม

Code บางตัวอาจจะไม่สามารถเอาไป Run ได้เลย เนื่องจากต้องเตรียม environment ต่าง ๆ ให้พร้อมก่อน เช่น Postgresql, Mongodb, Redis เป็นต้น ต้องมี database หรือ data source ปลายทางก่อน

ให้เรียนรู้/ดูตัวอย่างตามลำดับต่อไปนี้

ปรับ Code เป็น Java 11 แล้ว

รอการปรับ Code เป็น Java 11

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].