This guide covers the configuration of all services in the StreamLine Logistics platform, including Spring Boot properties, database connections, and service discovery.
Configuration Overview
StreamLine Logistics uses Spring Boot’s YAML-based configuration. Each microservice has its own application.yml or application.properties file located in src/main/resources/.
Project Configuration
Maven Configuration (pom.xml)
The root pom.xml defines project-wide settings:
< properties >
< project.build.sourceEncoding > UTF-8 </ project.build.sourceEncoding >
< maven.compiler.release > 17 </ maven.compiler.release >
< org.mapstruct.version > 1.5.5.Final </ org.mapstruct.version >
< org.projectlombok.version > 1.18.28 </ org.projectlombok.version >
< lombok-mapstruct-binding.version > 0.2.0 </ lombok-mapstruct-binding.version >
</ properties >
Key Dependencies:
Spring Boot : 4.0.2
Spring Cloud : 2025.1.0
Java Version : 17
Lombok : 1.18.28
MapStruct : 1.5.5.Final
JaCoCo : 0.8.14 (code coverage)
All microservices inherit from spring-boot-starter-parent version 4.0.2.
Eureka Server Configuration
Service discovery and registration server.
Application Configuration
File: microservice-eureka/src/main/resources/application.yml
server :
port : 8761
spring :
application :
name : msvc-eureka
config :
import : "optional:configserver:http://localhost:8888"
eureka :
instance :
hostname : eureka-server
client :
register-with-eureka : false
fetch-registry : false
server-url :
defaultZone : http://${eureka.instance.hostname}:${server.port}/eureka/
Configuration Breakdown
Property Value Description server.port8761 Eureka dashboard and API port spring.application.namemsvc-eureka Service identifier eureka.client.register-with-eurekafalse Don’t register with itself eureka.client.fetch-registryfalse Don’t fetch registry (standalone) eureka.instance.hostnameeureka-server Container hostname
Accessing Eureka Dashboard
# Local
http://localhost:8761
# Inside Docker network
http://eureka-server:8761
Order Service Configuration
Handles order management with PostgreSQL database.
Application Configuration
File: microservice-order/src/main/resources/application.yml
server :
port : 8090
spring :
application :
name : msvc-order
datasource :
driver-class-name : org.postgresql.Driver
url : jdbc:postgresql://order_db:5432/orderdb
username : postgres
password : password
jpa :
hibernate :
ddl-auto : create
database : postgresql
database-platform : org.hibernate.dialect.PostgreSQLDialect
config :
import : "optional:configserver:http://localhost:8888"
eureka :
instance :
hostname : eureka-server
client :
service-url :
defaultZone : http://${eureka.instance.hostname}:8761/eureka/
Configuration Breakdown
Server Configuration
Property Value Description server.port8090 REST API port spring.application.namemsvc-order Service name in Eureka
Database Configuration
Property Value Description spring.datasource.driver-class-nameorg.postgresql.Driver PostgreSQL JDBC driver spring.datasource.urljdbc:postgresql://order_db:5432/orderdb Database connection URL spring.datasource.usernamepostgres Database user spring.datasource.passwordpassword Database password
The hibernate.ddl-auto: create setting drops and recreates tables on startup. Change to update or validate in production.
JPA Configuration
Property Value Description spring.jpa.hibernate.ddl-autocreate Schema generation strategy spring.jpa.databasepostgresql Database type spring.jpa.database-platformorg.hibernate.dialect.PostgreSQLDialect Hibernate dialect
Eureka Client Configuration
Property Value Description eureka.client.service-url.defaultZonehttp://eureka-server:8761/eureka/ Eureka server URL
Dependencies (pom.xml)
< dependencies >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-actuator </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-data-jpa </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-webmvc </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-config </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-netflix-eureka-client </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-openfeign </ artifactId >
</ dependency >
< dependency >
< groupId > org.postgresql </ groupId >
< artifactId > postgresql </ artifactId >
< scope > runtime </ scope >
</ dependency >
</ dependencies >
Inventory Service Configuration
Manages inventory with MySQL database.
Application Configuration
File: microservice-inventory/src/main/resources/application.yml
server :
port : 9090
spring :
application :
name : msvc-inventory
datasource :
driver-class-name : com.mysql.cj.jdbc.Driver
url : jdbc:mysql://inventory_db:3306/inventorydb
username : root
password : password
jpa :
hibernate :
ddl-auto : create
database : mysql
database-platform : org.hibernate.dialect.MySQLDialect
config :
import : "optional:configserver:http://localhost:8888"
eureka :
instance :
hostname : eureka-server
client :
service-url :
defaultZone : http://${eureka.instance.hostname}:8761/eureka/
Configuration Breakdown
Server Configuration
Property Value Description server.port9090 REST API port spring.application.namemsvc-inventory Service name in Eureka
Database Configuration
Property Value Description spring.datasource.driver-class-namecom.mysql.cj.jdbc.Driver MySQL JDBC driver spring.datasource.urljdbc:mysql://inventory_db:3306/inventorydb Database connection URL spring.datasource.usernameroot Database user spring.datasource.passwordpassword Database password
JPA Configuration
Property Value Description spring.jpa.hibernate.ddl-autocreate Schema generation strategy spring.jpa.databasemysql Database type spring.jpa.database-platformorg.hibernate.dialect.MySQLDialect Hibernate dialect
Dependencies (pom.xml)
< dependencies >
<!-- Spring Boot Starters -->
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-actuator </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-data-jpa </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-webmvc </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-validation </ artifactId >
</ dependency >
<!-- Spring Cloud -->
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-config </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-netflix-eureka-client </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-openfeign </ artifactId >
</ dependency >
<!-- Database -->
< dependency >
< groupId > com.mysql </ groupId >
< artifactId > mysql-connector-j </ artifactId >
< scope > runtime </ scope >
</ dependency >
<!-- Documentation -->
< dependency >
< groupId > org.springdoc </ groupId >
< artifactId > springdoc-openapi-starter-webmvc-ui </ artifactId >
< version > 3.0.2 </ version >
</ dependency >
</ dependencies >
Tracking Service Configuration
Tracks shipments using MongoDB.
Application Configuration
File: microservice-tracking/src/main/resources/application.yml
server :
port : 8091
mongodb :
user : root
password : password
database : trakcingdb
spring :
application :
name : msvc-tracking
data :
mongodb :
uri : mongodb://${mongodb.user}:${mongodb.password}@localhost:27017/${mongodb.database}
jpa :
hibernate :
ddl-auto : create
database : postgresql
database-platform : org.hibernate.dialect.PostgreSQLDialect
config :
import : "optional:configserver:http://localhost:8888"
eureka :
instance :
hostname : eureka-server
client :
service-url :
defaultZone : http://${eureka.instance.hostname}:8761/eureka/
There’s a typo in the database name: trakcingdb should be trackingdb. Also note the MongoDB URI uses localhost but should use tracking_db when running in Docker.
Configuration Breakdown
Server Configuration
Property Value Description server.port8091 REST API port spring.application.namemsvc-tracking Service name in Eureka
MongoDB Configuration
Property Value Description mongodb.userroot MongoDB username mongodb.passwordpassword MongoDB password mongodb.databasetrakcingdb Database name spring.data.mongodb.urimongodb://… Full connection URI
For Docker deployment, change the MongoDB URI to use tracking_db instead of localhost: uri : mongodb://${mongodb.user}:${mongodb.password}@tracking_db:27017/${mongodb.database}
Dependencies (pom.xml)
< dependencies >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-actuator </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-data-mongodb </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-webmvc </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-config </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-netflix-eureka-client </ artifactId >
</ dependency >
< dependency >
< groupId > org.springframework.cloud </ groupId >
< artifactId > spring-cloud-starter-openfeign </ artifactId >
</ dependency >
</ dependencies >
Gateway Configuration
API Gateway for routing requests to microservices.
File: microservice-gateway/src/main/resources/application.properties
spring.application.name =microservice-gateway
The Gateway service has minimal configuration. Additional routing rules should be added based on requirements.
Config Server Configuration
Centralized configuration management.
File: microservice-config/src/main/resources/application.properties
spring.application.name =microservice-config
The Config Server should be configured with a Git repository or file system location for centralized configurations.
Environment-Specific Configuration
Using Spring Profiles
Create environment-specific configuration files:
application-dev.yml
application-prod.yml
spring :
jpa :
show-sql : true
hibernate :
ddl-auto : create-drop
datasource :
url : jdbc:postgresql://localhost:5432/orderdb
logging :
level :
root : DEBUG
Activate profiles:
Command Line
docker-compose.yml
application.yml
java -jar order-service.jar --spring.profiles.active=dev
Actuator Configuration
All services include Spring Boot Actuator for monitoring and management.
Default Endpoints
Endpoint URL Description Health /actuator/health Application health status Info /actuator/info Application information Metrics /actuator/metrics Application metrics Loggers /actuator/loggers Logger configuration
Enable All Actuator Endpoints
Add to application.yml:
management :
endpoints :
web :
exposure :
include : "*"
endpoint :
health :
show-details : always
In production, restrict actuator endpoints and enable security.
Logging Configuration
logging :
level :
root : INFO
com.microservice : DEBUG
org.springframework.web : DEBUG
org.hibernate : INFO
pattern :
console : "%d{yyyy-MM-dd HH:mm:ss} - %msg%n"
file :
name : logs/application.log
max-size : 10MB
max-history : 30
Logback Configuration
Create logback-spring.xml in src/main/resources/:
<? xml version = "1.0" encoding = "UTF-8" ?>
< configuration >
< appender name = "STDOUT" class = "ch.qos.logback.core.ConsoleAppender" >
< encoder >
< pattern > %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n </ pattern >
</ encoder >
</ appender >
< appender name = "FILE" class = "ch.qos.logback.core.rolling.RollingFileAppender" >
< file > logs/application.log </ file >
< rollingPolicy class = "ch.qos.logback.core.rolling.TimeBasedRollingPolicy" >
< fileNamePattern > logs/application-%d{yyyy-MM-dd}.log </ fileNamePattern >
< maxHistory > 30 </ maxHistory >
</ rollingPolicy >
< encoder >
< pattern > %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n </ pattern >
</ encoder >
</ appender >
< root level = "INFO" >
< appender-ref ref = "STDOUT" />
< appender-ref ref = "FILE" />
</ root >
</ configuration >
Database Schema Management
Hibernate DDL Auto Options
Value Description Use Case createDrop and recreate schema Development only create-dropCreate on start, drop on stop Testing updateUpdate schema to match entities Development validateValidate schema, no changes Production noneNo action Use with Flyway/Liquibase
Never use create or create-drop in production as it will delete all data.
Using Flyway for Migrations
Add Flyway dependency:
< dependency >
< groupId > org.flywaydb </ groupId >
< artifactId > flyway-core </ artifactId >
</ dependency >
Configure in application.yml:
spring :
flyway :
enabled : true
baseline-on-migrate : true
locations : classpath:db/migration
jpa :
hibernate :
ddl-auto : validate
Security Configuration
Basic Authentication (Example)
Add Spring Security:
< dependency >
< groupId > org.springframework.boot </ groupId >
< artifactId > spring-boot-starter-security </ artifactId >
</ dependency >
Configure in application.yml:
spring :
security :
user :
name : admin
password : ${ADMIN_PASSWORD:changeme}
Configuration Best Practices
Use environment variables for secrets
Never commit passwords to version control: spring :
datasource :
password : ${DB_PASSWORD:default_dev_password}
Externalize configuration
Use Config Server or environment variables: export SPRING_DATASOURCE_PASSWORD = secure_password
java -jar service.jar
Use appropriate ddl-auto settings
Development: create-drop or update
Production: validate with migration tools
Enable health checks
Configure comprehensive health indicators: management :
health :
db :
enabled : true
diskspace :
enabled : true
Configure timeouts
Set appropriate connection and read timeouts: spring :
datasource :
hikari :
connection-timeout : 30000
maximum-pool-size : 10
eureka :
client :
registry-fetch-interval-seconds : 30
Quick Reference
Service Ports
Service Port URL Eureka Server 8761 http://localhost:8761 Order Service 8090 http://localhost:8090 Tracking Service 8091 http://localhost:8091 Inventory Service 9090 http://localhost:9090 Config Server 8888 http://localhost:8888
Database Connections
Database Host Port Database User Password PostgreSQL order_db 5432 orderdb postgres password MySQL inventory_db 3306 inventorydb root password MongoDB tracking_db 27017 trakcingdb root password
Configuration Files
Service Configuration File Eureka microservice-eureka/src/main/resources/application.yml Order microservice-order/src/main/resources/application.yml Inventory microservice-inventory/src/main/resources/application.yml Tracking microservice-tracking/src/main/resources/application.yml Gateway microservice-gateway/src/main/resources/application.properties Config microservice-config/src/main/resources/application.properties
Next Steps
Explore API endpoints for each service
Set up monitoring with Actuator and Prometheus
Configure centralized logging
Implement security and authentication
Set up CI/CD pipelines