Created
December 15, 2014 17:33
-
-
Save wonderb0lt/3c28bdd6c1eabab5ed6d to your computer and use it in GitHub Desktop.
The Java app for the cfn/docker sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lt.wonderb0.example; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.annotation.ComponentScan; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.ResponseBody; | |
@Configuration | |
@ComponentScan | |
@Controller | |
@EnableAutoConfiguration | |
public class Application { | |
@Autowired | |
private ApplicationContext applicationContext; | |
@Autowired | |
private ApplicationSetup setup; | |
@RequestMapping("/hello") | |
@ResponseBody | |
public String sayHello() { | |
return setup.getGreeting(); | |
} | |
public static void main(String[] args) { | |
SpringApplication.run(Application.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lt.wonderb0.example; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class ApplicationSetup { | |
@Value("${echoservice.greeting:Hello, World!}") | |
private String greeting; | |
public String getGreeting() { | |
return greeting; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment