14 |
15 | ID -
16 | Reservation Name
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/bootcamp/src/test/java/bootiful/ApplicationTests.java:
--------------------------------------------------------------------------------
1 | package bootiful;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.test.context.web.WebAppConfiguration;
7 | import org.springframework.boot.test.SpringApplicationConfiguration;
8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9 |
10 | @RunWith(SpringJUnit4ClassRunner.class)
11 | @SpringApplicationConfiguration(classes = Application.class)
12 | @WebAppConfiguration
13 | public class ApplicationTests {
14 | @Test
15 | public void contextLoads() {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/configuration/code/.gitignore:
--------------------------------------------------------------------------------
1 | *iml
2 | target
3 | .idea
4 | .gitignore~
--------------------------------------------------------------------------------
/configuration/code/README.asc:
--------------------------------------------------------------------------------
1 | # Configuring Micorservices
2 |
3 | This lab will look at the various approaches to configuring a Spring based application.
4 |
5 | == Spring Framework
6 | We'll start with the http://spring.io/projects/spring-framework[Spring Framework], which provides the `Environment` abstraction, a concept of _profiles_ and the `@PropertySource` annotation.
7 |
8 | You can see them in action in the `basics` module.
9 |
10 | * the Spring `Environment` abstraction provides a way to let Spring ask questions about their environment. You can see it working in `basics/src/main/java/boot/env/Application.java`. It's a little bit of indirection between a running Spring app and it's environment. It provides a way to read configuration values from the environment and property values from _property sources_.
11 |
12 | == Spring Boot
13 |
14 | Spring Boot provides next-level support for configuration. Spring Boot normalizes external configuration (like `-D` arguments and environment variables) and even goes as far as canonicalizing external configuration properties such that, for example, the shell variable `SERVER_PORT` is the same as `-Dserver.port`, which is the same as putting `server.port` in a `.properties` file. Spring Boot also adds novel support for `.yml` configuration files. Spring Boot will, by convention, look for `src/main/resources/application.properties` and `src/main/resources/application.yml`, too.
15 |
16 | * you can see it working in the `basics/src/main/java/boot/Application.java`.
17 |
18 | == Spring Cloud
19 | Then, we look at how Spring Cloud supports cloud-native applications and operational requirements by supporting journaled, centralized configuration for multiple applications and services through the Spring Cloud config server. The Spring Cloud config server is backed by a http://en.wikipedia.org/wiki/Git_%28software%29[Git]. This promotes traceability and easier updates to configuration since there's no need to re-push an application just to change its configuration. Additionally, Spring Cloud supports _refreshing_ configuration for beans _in-situ_ through the `/refresh` Actuator endpoint and through the Spring Cloud event bus (which uses RabbitMQ as a message bus to propagate configuration changes to all connected applications or services).
20 |
21 | * you can see it working in the `config-client` and `config-server` modules.
22 | * Start the `config-server` first. It will proxy configuration from a Git repository and make it available to other services that have the `org.springframework.cloud:spring-cloud-config-client` on their CLASSPATH.
23 | * you can see that working in the `config-client` where we depend on configuration.
24 |
--------------------------------------------------------------------------------
/configuration/code/basics/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |