Skip to content

Instantly share code, notes, and snippets.

@GetMapping("/discounts")
@HystrixCommand(fallbackMethod = "getDefaultDiscount", commandKey = "getDefaultDiscount")
public ResponseEntity<WSDiscount> getProductDiscount(@RequestParam("id") String id) {
ResponseEntity<WSDiscount> responseEntity =
baseRestOutboundProcessor.get("https://discount-service.com?id=" + id, null, WSDiscount.class, new HashMap<>());
return ResponseEntity.ok(responseEntity.getBody());
}
public ResponseEntity<WSDiscount> getDefaultDiscount(String id) {
WSDiscount discount = new WSDiscount();
package com.minikube.sample.rest.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
C:\Users\eresh.gorantla\apps\minikube-sample (master -> origin)
λ mvn clean package -DskipTests=true
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.minikube.sample:minikube-sample >-----------------
[INFO] Building minikube-sample 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ minikube-sample ---
[INFO] Deleting C:\Users\eresh.gorantla\apps\minikube-sample\target
FROM openjdk:8-jdk-alpine
VOLUME /c/Users/eresh.gorantla/
COPY ./target/minikube-sample-0.0.1-SNAPSHOT.jar app.jar
ENV JAVA_OPTS=""
ENTRYPOINT exec java -jar app.jar --debug
apiVersion: apps/v1
kind: Deployment
metadata:
name: minikube-sample
spec:
selector:
matchLabels:
app: minikube-sample
replicas: 1
C:\Users\eresh.gorantla\apps\minikube-sample (master -> origin)
λ mvn clean package -DskipTests=true
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.minikube.sample:minikube-sample >-----------------
[INFO] Building minikube-sample 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] -
package com.eresh.spring.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
/**
kind: Service
apiVersion: v1
metadata:
name: discovery-client
spec:
selector:
app: discovery-client
ports:
- protocol: TCP
port: 8081
package com.eresh.spring.persistence.repository;
import com.eresh.spring.persistence.entity.Author;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
package com.eresh.spring.persistence.entity;
import lombok.Data;
import org.springframework.data.mongodb.core.index.TextIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* Created By Gorantla, Eresh on 12/Dec/2019
**/