This is a Spring Boot application that leverages several powerful technologies to provide a robust microservices architecture. The stack includes:
- Spring Framework
- Spring Gateway
- Hibernate/JPA with MySQL
- Netflix OpenFeign (include automatic load balancing)
- Eureka Discovery Server
- Microservices Architecture: Decoupled services that can be independently developed, deployed, and scaled.
- Service Discovery: Eureka server for automatic registration and discovery of services.
- Load Balancing: Ribbon for client-side load balancing.
- Declarative REST Clients: OpenFeign for making REST calls to other services.
- API Gateway: Spring Gateway for routing and filtering requests.
- Persistence: Hibernate/JPA for ORM and MySQL as the database.
- Java 21
- Maven 3.6.0
- MySQL 8.0 or
git clone https://github.com/MovinduLochana/JavaSpringQuizApp.git
cd JavaSpringQuizAppspring.datasource.url=jdbc:mysql://localhost:3306/your-database
spring.datasource.username=your-username
spring.datasource.password=your-password
spring.jpa.hibernate.ddl-auto=update
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.gateway.discovery.locator.lower-case-service-id=true
- Running API-Gateway and Discovery server first is recommended
- You can run the application either via a IDE or using Maven wrapper to make a jar file for each service
- You can change server port number in properties file
server.port=<PORT>
- Or configure VM Options and run multiple instances of a service
-Dserver.port=8082
- Use maven wrapper to build the application
- Go inside a service and run maven builder
cd <service>
mvn spring-boot:run
-
Do this for all services and you'll get final jars for Run
-
Configure VM options after build
java -jar -Dserver.port=8082 event-service.jar //