![JAR search and dependency download from the Maven repository](/logo.png)
com.marcosbarbero.tests.InMemoryApplication Maven / Gradle / Ivy
package com.marcosbarbero.tests;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Marcos Barbero
* @since 2017-06-26
*/
@EnableZuulProxy
@SpringCloudApplication
public class InMemoryApplication {
public static void main(String... args) {
SpringApplication.run(InMemoryApplication.class, args);
}
@RestController
public class ServiceController {
public static final String RESPONSE_BODY = "ResponseBody";
@GetMapping("/serviceA")
public ResponseEntity serviceA() {
return ResponseEntity.ok(RESPONSE_BODY);
}
@GetMapping("/serviceB")
public ResponseEntity serviceB() {
return ResponseEntity.ok(RESPONSE_BODY);
}
@GetMapping("/serviceC")
public ResponseEntity serviceC() {
return ResponseEntity.ok(RESPONSE_BODY);
}
@GetMapping("/serviceD/{paramName}")
public ResponseEntity serviceD(@PathVariable String paramName) {
return ResponseEntity.ok(RESPONSE_BODY + " " + paramName);
}
@GetMapping("/serviceE")
public ResponseEntity serviceE() throws InterruptedException {
Thread.sleep(1100);
return ResponseEntity.ok(RESPONSE_BODY);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy