Skip to content

Backend Setup

Maria Martinez edited this page Sep 21, 2026 · 3 revisions

Backend Local Setup Guide

This guide details how to configure, run, and debug the Java backend services (backend/, legacy/, and processor/) on your local machine.


Prerequisites

  • Java Development Kit (JDK): JDK 17, 21, or 25 (Adoptium / Eclipse Temurin or GraalVM recommended). Baseline compatibility targets Java 17 for backend and processor and Java 21 for legacy, with CI tests and native image builds executing on JDK 25.
  • Apache Maven: Version 3.9+ installed and added to your PATH.
  • Running Databases: Ensure PostgreSQL and Oracle services are started via docker compose up -d database legacydb legacyflyway.

Developer Profiles (dev-<name>)

Each developer maintains an isolated configuration profile so local settings and credentials are never checked into Git. Create an application-dev-<yourname>.yml (e.g., application-dev-jsmith.yml) in the config/ directory of each service.

Note

The examples below use the safe local container defaults defined in docker-compose.yml (postgres/default and THE/default). Never commit production credentials, secret tokens, or private network hosts to Git configuration files.

1. Main Backend API (backend/config/application-dev-<yourname>.yml)

ca:
  bc:
    gov:
      nrs:
        # PostgreSQL Connection Details (local container)
        postgres:
          database: ${POSTGRESQL_DATABASE:postgres}
          host: ${POSTGRESQL_HOST:localhost}:5432
          username: ${POSTGRESQL_USER:postgres}
          password: ${POSTGRESQL_PASSWORD:default}

        # Frontend URL for CORS
        frontend:
          url: ${FRONTEND_URL:http://localhost:3000}

        # Legacy Oracle service endpoint
        legacy:
          url: http://localhost:9000

        # CHES (Common Hosted Email Service) Mock / Stub URL
        ches:
          uri: http://127.0.0.1:10010/chess/uri
          tokenUrl: http://127.0.0.1:10010/token/uri
          clientId: dev-client
          clientSecret: dev-secret
          scope: openid

        # BC Registry Sandboxed API
        bcregistry:
          uri: https://bcregistry-sandbox.apigee.net
          apiKey: dev-key
          accountId: account dev-account

2. Legacy Oracle Service (legacy/config/application-dev-<yourname>.yml)

# Override TCPS/SSL with standard TCP R2DBC URL to connect to local container
spring:
  r2dbc:
    url: r2dbc:oracle://${ca.bc.gov.nrs.oracle.host}:${ca.bc.gov.nrs.oracle.port}/${ca.bc.gov.nrs.oracle.service}

ca:
  bc:
    gov:
      nrs:
        # Oracle Connection Details (local container legacydb)
        oracle:
          host: localhost
          port: 1521
          service: FREEPDB1
          database: FREEPDB1
          schema: THE
          username: THE
          password: default

3. Background Processor (processor/config/application-dev-<yourname>.yml)

ca:
  bc:
    gov:
      nrs:
        # PostgreSQL Connection Details (local container)
        postgres:
          database: ${POSTGRESQL_DATABASE:postgres}
          host: ${POSTGRESQL_HOST:localhost}:5432
          username: ${POSTGRESQL_USER:postgres}
          password: ${POSTGRESQL_PASSWORD:default}

        # Main Backend API endpoint
        backend:
          uri: http://localhost:8080/api

        # Legacy Oracle service endpoint
        legacy:
          uri: http://localhost:9000/api

Running Services via Command Line

Run the desired service with your active profile:

# 1. Main Backend Service (port 8080)
cd backend
mvn spring-boot:run -Dspring-boot.run.profiles=dev-<yourname>

# 2. Legacy Oracle Connector (port 9000)
cd legacy
mvn spring-boot:run -Dspring-boot.run.profiles=dev-<yourname>

# 3. Background Submission Processor
cd processor
mvn spring-boot:run -Dspring-boot.run.profiles=dev-<yourname>

IDE Setup

IntelliJ IDEA Configuration

  1. Google Java Code Style:

    • Open Settings / Preferences (Ctrl+Alt+S or Cmd+,).
    • Navigate to Editor > Code Style > Java.
    • Click the gear icon next to Scheme and select Import Scheme > CheckStyle Configuration.
    • Select backend/docs/google_checks.xml.
  2. Run / Debug Configurations:

    • Open ca.bc.gov.app.BootApplication.java.
    • In the run configuration, set Active Profiles to dev-<yourname>.
    • Ensure the JDK is set to Java 17 or 21.

Eclipse Configuration

  1. Google Style Formatter:

  2. Project Lombok:

    • If using Eclipse, install Project Lombok by executing:
      java -jar ~/.m2/repository/org/projectlombok/lombok/<version>/lombok-<version>.jar
    • Follow installer prompts, select your Eclipse executable, and restart the IDE.

Clone this wiki locally