decryption

master
dizda13 2017-04-16 20:57:13 +02:00
parent e48c97b804
commit f29c553ec9
4 changed files with 23 additions and 3 deletions

2
config

@ -1 +1 @@
Subproject commit 75a784ba6ed8f6e70ee91808d3752443e3a04d1d Subproject commit 74863b5222f054ae8f394f986f4524f29178b40b

View File

@ -2,14 +2,17 @@ package ba.steleks;
import ba.steleks.storage.StorageProperties; import ba.steleks.storage.StorageProperties;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -27,9 +30,26 @@ public class SteleksServiceApplication {
@RestController @RestController
class ServiceInstanceRestController { class ServiceInstanceRestController {
@Autowired
private DiscoveryClient discoveryClient; private DiscoveryClient discoveryClient;
@Autowired
public ServiceInstanceRestController(DiscoveryClient discoveryClient) {
this.discoveryClient=discoveryClient;
}
@Value("${user.password}")
private String password;
@RequestMapping(
value = "/whoami/{username}",
method = RequestMethod.GET,
produces = MediaType.TEXT_PLAIN_VALUE)
public String whoami(@PathVariable("username") String username) {
return String.format("Hello! You're %s and you'll become Developer, " +
"but only if your password is '%s'!\n", username, password);
}
@RequestMapping("/service-instances/{applicationName}") @RequestMapping("/service-instances/{applicationName}")
public List<ServiceInstance> serviceInstancesByApplicationName( public List<ServiceInstance> serviceInstancesByApplicationName(
@PathVariable String applicationName) { @PathVariable String applicationName) {