The brackets at the end of each step indicate the alias’s or IntelliJ Live Templates to use. You can find the template definitions at mraible/idea-live-templates.
-
start.spring.io: data-mongodb-reactive, webflux, devtools, and lombok [
webflux-start
]http https://start.spring.io/starter.zip dependencies==data-mongodb-reactive,webflux,devtools,lombok -d
-
Add
Profile
,ProfileRepository
, andSampleDataInitializer
[webflux-entity
,webflux-repo
,webflux-data
] -
Start and see list of profiles in console:
SPRING_PROFILES_ACTIVE=demo mvn
-
Create
ProfileService
[webflux-service
] -
Create
ProfileRestController
with a/profiles
endpoint [webflux-controller
] -
Restart server with classic profile:
SPRING_PROFILES_ACTIVE=classic mvn
-
Restart and confirm http://localhost:8080/profiles works in browser and with http
http POST :8080/profiles email='[email protected]' http PUT :8080/profiles/1 email='[email protected]' http DELETE :8080/profiles/1
-
Create
ProfileCreatedEvent
,ProfileCreatedEventPublisher
, and updateProfileService
[webflux-event
,webflux-publisher
] -
Create
WebSocketConfiguration
for executor bean [webflux-websocket
] -
Create
ProfileHandler
,ProfileEndpointConfiguration
, andCaseInsensitiveRequestPredicate
[webflux-handler
,webflux-endpoint
,webflux-predicate
] -
Restart and confirm http://localhost:8080/profiles works in browser and with http
-
Create
static/ws.html
to show event notifications [webflux-ws
] -
Restore
doOnSuccess
inProfileService
and show http://localhost:8080/ws.html withcreate.sh
-
Create
ServerSentEventController
, showhttp http://localhost:8080/sse/profiles -S
[webflux-sse
]
-
Run
npx create-react-app react-app --template typescript
; show app withnpm start
-
Modify
App.tsx
and addcomponentDidMount()
to fetch profiles [react-fetch
] -
Create interfaces:
Profile
,AppProps
, andAppState
; add constructor and initialize state [react-constructor
] -
Change
render()
to show profiles [react-loading
andreact-list
] -
Configure proxy for React and show list of profiles
-
Create
ProfileList.tsx
and copy code fromApp.tsx
; changeApp.tsx
to use<ProfileList/>
-
Modify
ProfileList.tsx
to fetch every second [react-interval
] -
Create and run
create-stream.sh
-
Use RxJS: install rxjs first! [
react-rxjs
] -
Use WebSocket [
react-websocket
] -
Create
src/setupProxy.js
to set up proxy for WebSockets [react-proxy
] -
Use EventSource with SSE [
react-eventsource
] -
Add
@CrossOrigin
inServerSentEventController
-
Add Spring Security OIDC and dependencies [
ss-maven
||okta-maven-boot
] -
Create OIDC app in Okta; add properties to
application.yml
[ss-application
||okta-oauth2-yaml
] -
Show login redirect from http://localhost:8080/profiles
-
Create
SecurityConfiguration
for resource server and CORS [ss-config
]. Addresourceserver
settings toapplication.yml
. -
Create a new SPA app on Okta for React
-
Add Okta’s React SDK using OktaDev Schematics
npm install @oktadev/schematics schematics @oktadev/schematics:add-auth
-
Show changes in
App.tsx
and newHome.tsx
file -
Add
<ProfileList authState={this.props.authState}/>
inHome.tsx
-
Add CSS to
App.css
to make buttons more visible [react-css
] -
Restart, show app and Loading…
-
Update
ProfileList
to add an authorization header + error handling [react-token
] -
Modify
WebSocketConfiguration.java
to only return an ID. -
Modify
ProfileList
to fetch a profile by ID when added. [react-websocket2
] -
Run
./create-stream.sh
and show profiles being added. -
Fini!