https://github.com/ravening/image-microservices-spring-boot
Microservices in Java implemented using Spring boot and Spring Cloud
https://github.com/ravening/image-microservices-spring-boot
hysterix java jwt jwt-authentication microservices restful-webservices resttemplate sleuth spring-boot spring-cloud spring-cloud-config spring-cloud-eureka spring-cloud-netflix zuul-server
Last synced: 3 months ago
JSON representation
Microservices in Java implemented using Spring boot and Spring Cloud
- Host: GitHub
- URL: https://github.com/ravening/image-microservices-spring-boot
- Owner: ravening
- Created: 2019-10-24T08:49:56.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-25T11:56:31.000Z (almost 6 years ago)
- Last Synced: 2025-02-01T22:13:25.262Z (8 months ago)
- Topics: hysterix, java, jwt, jwt-authentication, microservices, restful-webservices, resttemplate, sleuth, spring-boot, spring-cloud, spring-cloud-config, spring-cloud-eureka, spring-cloud-netflix, zuul-server
- Language: Java
- Size: 65.4 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Image microservices using Java
This is a sample image microservice developed using Spring Boot Spring Cloud and Java
## Description
This contains an image service which stores the IMDB images.\
The gallery service fetches the details from image service.\
Authentication service provides authentication and authorization using JWT
Zuul service provides client side load balancing.For more details, refer to https://medium.com/omarelgabrys-blog/microservices-with-spring-boot-intro-to-microservices-part-1-c0d24cd422c3
## Getting started
1 . Clone the respository
2 . Start the below services in order
```
Start the eureka server
cd eureka-server
./mvnw spring-boot:runStart the image service
cd image-service
./mvnw spring-boot:runYou can start multiple instance of image service using
java -jar -Dserver.port=<> target/image-service-*.jarStart the gallery service
cd gallery-service
./mvnw spring-boot:runYou can start the second instance of gallery service using
java -jar -Dserver.port=8300 target/gallery-service-*.jarStart the auth service
cd auth-service
./mvnw spring-boot:runFinally start the zuul-server
cd zuul-server
./mvnw spring-boot:run
```3 . Once all the services are started successfully, make sure they are registered with\
eureka server by navigating to
```
http://localhost:8761
```4 . In order to access the service, first you need to get the JWT by providing your credentials\
I have stored two users in the file ```UserDetailsServiceImpl.java```.\
Send a POST request to below link with the following body
```
http://localhost:8762/auth
```Body should be
```
{
"username": ""
"password": "password for that user"
}
```If you are authenticated successfully, you should receive a JWT in the header.\
Copy just the encrypted token without including "Bearer" keyword.5 . Now to access the endpoints you need to pass this encrypted token in the header
6 . In postman create a new get request for the below end point
```
http://localhost:8762/gallery/1
```Authorization should be "Bearer Token" and paste the above copied token in the "Token" field
## Built With
* [Maven](https://maven.apache.org/) - Dependency Management
## Authors
* **Rakesh Venkatesh** - [rakgenius](https://github.com/rakgenius)