This repository has been archived on 2022-07-05. You can view files and clone it, but cannot push or open issues/pull-requests.
steleks_backend/events/src/main/java/ba/steleks/EventsApplication.java

48 lines
1.4 KiB
Java
Raw Normal View History

2017-03-22 21:52:00 +00:00
package ba.steleks;
2017-03-28 19:34:24 +00:00
import org.springframework.beans.factory.annotation.Value;
2017-03-22 21:52:00 +00:00
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
2017-03-28 19:34:24 +00:00
import org.springframework.cloud.context.config.annotation.RefreshScope;
2017-04-01 12:00:40 +00:00
import org.springframework.web.bind.annotation.PathVariable;
2017-03-28 19:34:24 +00:00
import org.springframework.web.bind.annotation.RequestMapping;
2017-04-01 12:00:40 +00:00
import org.springframework.web.bind.annotation.RequestMethod;
2017-03-28 19:34:24 +00:00
import org.springframework.web.bind.annotation.RestController;
2017-03-22 21:52:00 +00:00
@SpringBootApplication
public class EventsApplication {
public static void main(String[] args) {
SpringApplication.run(EventsApplication.class, args);
}
}
2017-03-28 19:34:24 +00:00
@RefreshScope
@RestController
class MessageRestController {
@Value("${message:Hello default}")
private String message;
2017-04-01 12:00:40 +00:00
@Value("${user.password}")
private String password;
2017-03-28 19:34:24 +00:00
@RequestMapping("/message")
String getMessage() {
return this.message;
}
2017-04-01 12:00:40 +00:00
//@RequestMapping(path ="/temp", value = "/{id}", method = RequestMethod.GET)
//String getTemp(@PathVariable("id") Long id){
// return "temp " + Long.toString(id);
//}
2017-04-01 14:04:20 +00:00
@RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET)
2017-04-01 12:00:40 +00:00
public String whoami(@PathVariable("username") String username) {
return String.format("Hello! You're %s and you'll become a(n) root, " +
"but only if your password is '%s'!\n",
username, password);
}
}