Skip to content

Commit 38634ad

Browse files
committed
Complete Spring Boot and React frontend integration with CORS fixes
Major Changes: - Simplified springboot-relational-stack: removed MicroTx LRA dependencies and services - Retained only AccountAndJournalAdminService with core account management endpoints - Fixed application.yaml to use environment variables for database configuration - Added comprehensive CORS configuration to resolve cross-origin request issues Spring Boot Changes: - Removed AccountsDepositService, AccountsWithdrawService, AccountTransferDAO - Updated pom.xml: removed microtx-lra-spring-boot-starter, added spring-boot-starter-web - Added CorsConfig class with proper allowedOriginPatterns configuration - Added @crossorigin annotation to AccountAndJournalAdminService - Updated application.yaml to use SPRING_DATASOURCE_* environment variables React Frontend Changes: - Removed agenticAIAPI.js and AgenticAIBuilder.js components - Fixed URL construction to match Spring Boot endpoints (/accounts/accounts, /accounts/api/accounts) - Updated .env file with correct base URLs (http://localhost:8080) - Removed AgenticAIBuilder navigation from App.js and Sidebar.js - Created build_and_run_local.sh scripts for both Spring Boot and React Environment Configuration: - Updated .env and .env.example with proper service URLs - Added Oracle database wallet path configuration for local development - Centralized environment variable management for consistent configuration Local Development: - Added build_and_run_local.sh for React frontend with npm build and start - Moved and configured build_and_run_local.sh for Spring Boot with Maven build and run - Both scripts source environment variables from financial/.env CORS Resolution: - Fixed 'allowCredentials with origins *' error by using allowedOriginPatterns - Set allowCredentials to false for simpler CORS configuration - Added comprehensive CORS headers for GET, POST, PUT, DELETE, OPTIONS methods The application now provides a clean, simplified Spring Boot backend with proper CORS configuration that successfully integrates with the React frontend for account management.
1 parent f8ff3a1 commit 38634ad

27 files changed

+840
-1363
lines changed

financial/.env.example

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Application Configuration
2-
export REACT_APP_BACKEND_URL=https://oracleai-financial.org/accounts
3-
export REACT_APP_MICROTX_TRANSFER_SERVICE_URL=https://oracleai-financial.org/accounts
4-
export REACT_APP_MICROTX_ACCOUNT_SERVICE_URL=https://oracleai-financial.org/accounts
5-
export REACT_APP_MERN_BACKEND_SERVICE_URL=https://oracleai-financial.org/accounts
6-
export REACT_APP_MERN_MONGODB_SERVICE_URL=https://oracleai-financial.org/accounts
7-
export REACT_APP_MERN_MONGODB_JSONDUALITY_ORACLE_SERVICE_URL=https://oracleai-financial.org/accounts
8-
export REACT_APP_MERN_SQL_ORACLE_SERVICE_URL=https://oracleai-financial.org/accounts
9-
export REACT_APP_JAVA_ACCOUNTDETAIL_SERVICE_URL=https://oracleai-financial.org/accounts
10-
export REACT_APP_GRAPH_LAUNDERING_SERVICE_URL=https://oracleai-financial.org/accounts
11-
export REACT_APP_TRUECACHE_STOCK_SERVICE_URL=https://oracleai-financial.org/accounts
12-
export REACT_APP_SHARDING_SPATIAL_CC_SERVICE_URL=https://oracleai-financial.org/accounts
13-
export REACT_APP_STOCK_SERVICE_URL=https://oracleai-financial.org/accounts
14-
export REACT_APP_KAFKA_TXEVENTQ_SERVICE_URL=https://oracleai-financial.org/accounts
15-
export REACT_APP_AIAGENT_VECTOR_ADVISOR_SERVICE_URL=https://oracleai-financial.org/accounts
16-
export REACT_APP_SPEECH_SELECTAI_QUERY_SERVICE_URL=https://oracleai-financial.org/accounts
17-
export REACT_APP_ORDS_BASE_URL=https://oracleai-financial.org/accounts
2+
3+
export REACT_APP_MERN_MONGODB_SERVICE_URL=http://localhost:8080
4+
export REACT_APP_MERN_MONGODB_JSONDUALITY_ORACLE_SERVICE_URL=http://localhost:8080
5+
export REACT_APP_MERN_SQL_ORACLE_SERVICE_URL=http://localhost:8080
6+
7+
export REACT_APP_MICROTX_TRANSFER_SERVICE_URL=http://localhost:8080/accounts
8+
export REACT_APP_MICROTX_ACCOUNT_SERVICE_URL=http://localhost:8080/accounts
9+
export REACT_APP_JAVA_ACCOUNTDETAIL_SERVICE_URL=http://localhost:8080/accounts
10+
export REACT_APP_GRAPH_LAUNDERING_SERVICE_URL=http://localhost:8080/accounts
11+
export REACT_APP_TRUECACHE_STOCK_SERVICE_URL=http://localhost:8080/accounts
12+
export REACT_APP_SHARDING_SPATIAL_CC_SERVICE_URL=http://localhost:8080/accounts
13+
export REACT_APP_STOCK_SERVICE_URL=http://localhost:8080/accounts
14+
export REACT_APP_KAFKA_TXEVENTQ_SERVICE_URL=http://localhost:8080/accounts
15+
export REACT_APP_AIAGENT_VECTOR_ADVISOR_SERVICE_URL=http://localhost:8080/accounts
16+
export REACT_APP_SPEECH_SELECTAI_QUERY_SERVICE_URL=http://localhost:8080/accounts
17+
export REACT_APP_ORDS_BASE_URL=http://localhost:8080/accounts
1818

1919
# Database Configuration for Spring Boot Services
2020
export SPRING_DATASOURCE_URL=jdbc:oracle:thin:@financialdb_high?TNS_ADMIN=/Users/pparkins/Downloads/Wallet_financialdb
@@ -23,13 +23,11 @@ export SPRING_DATASOURCE_PASSWORD=Welcome12345
2323

2424
# Display all set environment variables
2525
echo "=== Environment Variables Set ==="
26-
echo "REACT_APP_BACKEND_URL: $REACT_APP_BACKEND_URL"
27-
echo "REACT_APP_MICROTX_TRANSFER_SERVICE_URL: $REACT_APP_MICROTX_TRANSFER_SERVICE_URL"
28-
echo "REACT_APP_MICROTX_ACCOUNT_SERVICE_URL: $REACT_APP_MICROTX_ACCOUNT_SERVICE_URL"
29-
echo "REACT_APP_MERN_BACKEND_SERVICE_URL: $REACT_APP_MERN_BACKEND_SERVICE_URL"
3026
echo "REACT_APP_MERN_MONGODB_SERVICE_URL: $REACT_APP_MERN_MONGODB_SERVICE_URL"
3127
echo "REACT_APP_MERN_MONGODB_JSONDUALITY_ORACLE_SERVICE_URL: $REACT_APP_MERN_MONGODB_JSONDUALITY_ORACLE_SERVICE_URL"
3228
echo "REACT_APP_MERN_SQL_ORACLE_SERVICE_URL: $REACT_APP_MERN_SQL_ORACLE_SERVICE_URL"
29+
echo "REACT_APP_MICROTX_TRANSFER_SERVICE_URL: $REACT_APP_MICROTX_TRANSFER_SERVICE_URL"
30+
echo "REACT_APP_MICROTX_ACCOUNT_SERVICE_URL: $REACT_APP_MICROTX_ACCOUNT_SERVICE_URL"
3331
echo "REACT_APP_JAVA_ACCOUNTDETAIL_SERVICE_URL: $REACT_APP_JAVA_ACCOUNTDETAIL_SERVICE_URL"
3432
echo "REACT_APP_GRAPH_LAUNDERING_SERVICE_URL: $REACT_APP_GRAPH_LAUNDERING_SERVICE_URL"
3533
echo "REACT_APP_TRUECACHE_STOCK_SERVICE_URL: $REACT_APP_TRUECACHE_STOCK_SERVICE_URL"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Stage 1: Build the app
2+
FROM --platform=linux/amd64 maven:3.9.4-eclipse-temurin-21 AS maven_build
3+
WORKDIR /build
4+
COPY pom.xml .
5+
COPY src ./src
6+
RUN mvn clean package -DskipTests
7+
8+
# Stage 2: Run the app
9+
FROM --platform=linux/amd64 eclipse-temurin:21-jre
10+
WORKDIR /app
11+
COPY --from=maven_build /build/target/*.jar app.jar
12+
EXPOSE 8080
13+
ENTRYPOINT ["java", "-jar", "app.jar"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: backend-ingress
5+
namespace: financial
6+
annotations:
7+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
8+
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
9+
spec:
10+
tls:
11+
- hosts:
12+
- oracledatabase-financial.org
13+
secretName: oracledatabase-financial-tls
14+
rules:
15+
- host: oracledatabase-financial.org
16+
http:
17+
paths:
18+
- path: /
19+
pathType: Prefix
20+
backend:
21+
service:
22+
name: backend-springboot
23+
port:
24+
number: 8090
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: account-springboot
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: account
10+
template:
11+
metadata:
12+
labels:
13+
app: account
14+
spec:
15+
volumes:
16+
- name: creds
17+
secret:
18+
secretName: financialdb-wallet-secret
19+
defaultMode: 420
20+
containers:
21+
- name: account-springboot
22+
image: eu-frankfurt-1.ocir.io/oradbclouducm/financial/bank-account:0.1.1748547465
23+
imagePullPolicy: Always
24+
ports:
25+
- containerPort: 443
26+
env:
27+
- name: DB_USER
28+
value: financial
29+
- name: DB_URL
30+
value: jdbc:oracle:thin:@financialdb_high?TNS_ADMIN=/oraclefinancial/creds
31+
- name: DB_PASSWORD
32+
value: Welcome12345
33+
- name: spring.datasource.username
34+
value: financial
35+
- name: spring.datasource.url
36+
value: jdbc:oracle:thin:@financialdb_high?TNS_ADMIN=/oraclefinancial/creds
37+
- name: spring.datasource.password
38+
value: Welcome12345
39+
resources: {}
40+
volumeMounts:
41+
- name: creds
42+
mountPath: /oraclefinancial/creds
43+
restartPolicy: Always
44+
# imagePullSecrets:
45+
# - name: regcred
46+
# schedulerName: default-scheduler
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: account-springboot
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: account
10+
template:
11+
metadata:
12+
labels:
13+
app: account
14+
spec:
15+
volumes:
16+
- name: creds
17+
secret:
18+
secretName: financialdb-wallet-secret
19+
defaultMode: 420
20+
containers:
21+
- name: account-springboot
22+
image: IMAGE_PLACEHOLDER
23+
imagePullPolicy: Always
24+
ports:
25+
- containerPort: 443
26+
env:
27+
- name: DB_USER
28+
value: financial
29+
- name: DB_URL
30+
value: jdbc:oracle:thin:@financialdb_high?TNS_ADMIN=/oraclefinancial/creds
31+
- name: DB_PASSWORD
32+
value: Welcome12345
33+
- name: spring.datasource.username
34+
value: financial
35+
- name: spring.datasource.url
36+
value: jdbc:oracle:thin:@financialdb_high?TNS_ADMIN=/oraclefinancial/creds
37+
- name: spring.datasource.password
38+
value: Welcome12345
39+
resources: {}
40+
volumeMounts:
41+
- name: creds
42+
mountPath: /oraclefinancial/creds
43+
restartPolicy: Always
44+
# imagePullSecrets:
45+
# - name: regcred
46+
# schedulerName: default-scheduler
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: account
5+
spec:
6+
type: ClusterIP
7+
selector:
8+
app: account
9+
ports:
10+
- protocol: TCP
11+
port: 8080 # External
12+
targetPort: 8080
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
export TAG=0.1.$(date +%s)
4+
echo TAG = $TAG
5+
6+
export IMAGE_NAME=bank-account
7+
export IMAGE_VERSION=$TAG
8+
if [ -z "$DOCKER_REGISTRY" ]; then
9+
echo "Error: DOCKER_REGISTRY env variable needs to be set!"
10+
exit 1
11+
fi
12+
export IMAGE=${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_VERSION}
13+
echo ${IMAGE}
14+
15+
16+
17+
./build.sh
18+
./deploy.sh
19+
echo logpod account
20+
logpod account
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
export IMAGE_VERSION=$TAG
4+
5+
if [ -z "$DOCKER_REGISTRY" ]; then
6+
echo "Error: DOCKER_REGISTRY env variable needs to be set!"
7+
exit 1
8+
fi
9+
10+
export IMAGE=${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_VERSION}
11+
echo ${IMAGE}
12+
13+
mvn clean package
14+
15+
echo about to build...
16+
podman buildx build --platform linux/amd64 -t $IMAGE .
17+
18+
19+
echo about to push ${IMAGE} $IMAGE...
20+
podman push --format docker "$IMAGE"
21+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
## Copyright (c) 2025 Oracle and/or its affiliates.
3+
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
4+
5+
#kubectl apply -f account-springboot-service-ClusterIP.yaml -n financial
6+
kubectl delete deployment account-springboot -n financial
7+
8+
cp account-springboot-deployment_template.yaml account-springboot-deployment.yaml
9+
sed -i '' "s|IMAGE_PLACEHOLDER|$IMAGE|g" account-springboot-deployment.yaml
10+
kubectl apply -f account-springboot-deployment.yaml -n financial

0 commit comments

Comments
 (0)