├── livelessons-data ├── livelessons-data-elasticsearch │ ├── .gitignore │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── CarRepository.java │ │ │ └── Car.java │ └── pom.xml ├── livelessons-data-flyway │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── db │ │ │ │ └── migration │ │ │ │ ├── V2__add-color.sql │ │ │ │ └── V1__init.sql │ │ │ └── java │ │ │ └── demo │ │ │ ├── CarRepository.java │ │ │ ├── DataFlywayApplication.java │ │ │ └── Car.java │ ├── README.adoc │ └── pom.xml ├── livelessons-data-redis │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── demo │ │ │ ├── SlowService.java │ │ │ └── DataRedisApplication.java │ └── pom.xml ├── livelessons-data-jdbc │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── schema.sql │ │ │ ├── data.sql │ │ │ └── application-mysql.properties │ │ │ └── java │ │ │ └── demo │ │ │ ├── DataJdbcApplication.java │ │ │ ├── CarRepository.java │ │ │ └── Car.java │ ├── README.adoc │ └── pom.xml ├── livelessons-data-jpa │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── CarRepository.java │ │ │ ├── Car.java │ │ │ └── DataJpaApplication.java │ ├── README.adoc │ └── pom.xml ├── livelessons-data-rest │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── CarRepository.java │ │ │ ├── DataRestApplication.java │ │ │ └── Car.java │ └── README.adoc ├── livelessons-data-mongodb │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ └── CarRepository.java │ ├── pom.xml │ └── README.adoc ├── README.adoc └── pom.xml ├── livelessons-security ├── basic │ ├── src │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.properties │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── BasicApplicationTests.java │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.properties │ │ │ └── maven-wrapper.jar │ └── .gitignore ├── livelessons-security-sso-ui │ ├── src │ │ └── main │ │ │ ├── wro │ │ │ ├── main.less │ │ │ ├── wro.properties │ │ │ └── wro.xml │ │ │ └── resources │ │ │ ├── static │ │ │ ├── home.html │ │ │ └── index.html │ │ │ └── application.yml │ └── TODO.txt ├── livelessons-security-basic │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ │ └── java │ │ │ └── basic │ │ │ └── GreetingsRestController.java │ └── TODO.txt ├── auth-service │ ├── src │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.properties │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── AuthServiceApplicationTests.java │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.properties │ │ │ └── maven-wrapper.jar │ └── .gitignore ├── greetings-service │ ├── src │ │ ├── main │ │ │ └── resources │ │ │ │ └── application.properties │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── GreetingsServiceApplicationTests.java │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.properties │ │ │ └── maven-wrapper.jar │ └── .gitignore ├── x509 │ └── src │ │ └── main │ │ └── resources │ │ ├── rod.p12 │ │ ├── sample.jks │ │ ├── server.jks │ │ └── application.properties ├── edge-service │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.properties │ │ │ └── maven-wrapper.jar │ ├── .gitignore │ └── src │ │ ├── main │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── EdgeServiceApplicationTests.java ├── livelessons-security-https │ ├── TODO.txt │ └── src │ │ └── main │ │ ├── resources │ │ ├── rod.p12 │ │ ├── sample.jks │ │ ├── server.jks │ │ ├── data.sql │ │ ├── schema.sql │ │ └── application.yml │ │ └── java │ │ └── demo │ │ ├── BasicHttpsSecurityApplication.java │ │ └── GreetingsRestController.java ├── livelessons-security-sso-resource │ ├── TODO.txt │ └── src │ │ └── main │ │ └── resources │ │ └── application.properties ├── livelessons-security-sso-auth-server │ ├── TODO.txt │ └── src │ │ └── main │ │ ├── resources │ │ ├── application.properties │ │ ├── data.sql │ │ └── schema.sql │ │ └── java │ │ └── demo │ │ └── SecurityConfig.java └── README.adoc ├── livelessons-web ├── livelessons-web-resources │ ├── .gitignore │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── static │ │ │ │ └── lib │ │ │ │ │ └── jquery │ │ │ │ │ ├── src │ │ │ │ │ ├── outro.js │ │ │ │ │ ├── selector.js │ │ │ │ │ ├── var │ │ │ │ │ │ ├── arr.js │ │ │ │ │ │ ├── rnotwhite.js │ │ │ │ │ │ ├── strundefined.js │ │ │ │ │ │ ├── push.js │ │ │ │ │ │ ├── slice.js │ │ │ │ │ │ ├── class2type.js │ │ │ │ │ │ ├── concat.js │ │ │ │ │ │ ├── indexOf.js │ │ │ │ │ │ ├── pnum.js │ │ │ │ │ │ ├── hasOwn.js │ │ │ │ │ │ ├── toString.js │ │ │ │ │ │ └── support.js │ │ │ │ │ ├── ajax │ │ │ │ │ │ ├── var │ │ │ │ │ │ │ ├── rquery.js │ │ │ │ │ │ │ └── nonce.js │ │ │ │ │ │ ├── parseJSON.js │ │ │ │ │ │ └── parseXML.js │ │ │ │ │ ├── css │ │ │ │ │ │ ├── var │ │ │ │ │ │ │ ├── rmargin.js │ │ │ │ │ │ │ ├── cssExpand.js │ │ │ │ │ │ │ ├── rnumnonpx.js │ │ │ │ │ │ │ ├── isHidden.js │ │ │ │ │ │ │ └── getStyles.js │ │ │ │ │ │ ├── hiddenVisibleSelectors.js │ │ │ │ │ │ ├── addGetHookIf.js │ │ │ │ │ │ └── swap.js │ │ │ │ │ ├── manipulation │ │ │ │ │ │ ├── var │ │ │ │ │ │ │ └── rcheckableType.js │ │ │ │ │ │ └── _evalUrl.js │ │ │ │ │ ├── data │ │ │ │ │ │ ├── var │ │ │ │ │ │ │ ├── data_priv.js │ │ │ │ │ │ │ └── data_user.js │ │ │ │ │ │ └── accepts.js │ │ │ │ │ ├── core │ │ │ │ │ │ └── var │ │ │ │ │ │ │ └── rsingleTag.js │ │ │ │ │ ├── traversing │ │ │ │ │ │ └── var │ │ │ │ │ │ │ └── rneedsContext.js │ │ │ │ │ ├── event │ │ │ │ │ │ ├── support.js │ │ │ │ │ │ └── ajax.js │ │ │ │ │ ├── attributes.js │ │ │ │ │ ├── deprecated.js │ │ │ │ │ ├── effects │ │ │ │ │ │ └── animatedSelector.js │ │ │ │ │ ├── selector-sizzle.js │ │ │ │ │ ├── queue │ │ │ │ │ │ └── delay.js │ │ │ │ │ ├── jquery.js │ │ │ │ │ └── exports │ │ │ │ │ │ └── global.js │ │ │ │ │ ├── bower.json │ │ │ │ │ └── .bower.json │ │ │ ├── resources │ │ │ │ └── css │ │ │ │ │ └── style.css │ │ │ └── public │ │ │ │ ├── favicon.ico │ │ │ │ ├── index.html │ │ │ │ ├── bower.html │ │ │ │ └── webjars.html │ │ │ └── java │ │ │ └── demo │ │ │ └── WebResourcesApplication.java │ ├── .bowerrc │ ├── bower.json │ └── pom.xml ├── livelessons-web-templates │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── static │ │ │ │ ├── img │ │ │ │ │ └── logo.jpg │ │ │ │ └── css │ │ │ │ │ └── page.css │ │ │ └── templates │ │ │ │ └── layout.html │ │ │ └── java │ │ │ └── demo │ │ │ └── WebTemplatesApplication.java │ └── pom.xml ├── livelessons-web-transforms │ ├── src │ │ └── main │ │ │ └── resources │ │ │ ├── static │ │ │ ├── css │ │ │ │ ├── email.css │ │ │ │ ├── layout.css │ │ │ │ ├── popups.css │ │ │ │ ├── social.css │ │ │ │ ├── widgets.css │ │ │ │ └── page.css │ │ │ └── img │ │ │ │ └── logo.jpg │ │ │ ├── application.properties │ │ │ └── templates │ │ │ └── layout.html │ └── pom.xml ├── livelessons-web-resources-angular │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── static │ │ │ │ └── js │ │ │ │ ├── core.js │ │ │ │ └── services │ │ │ │ └── todos.js │ │ │ └── java │ │ │ └── demo │ │ │ ├── WebResourcesRestApplication.java │ │ │ └── ToDo.java │ └── README.adoc ├── README.adoc └── pom.xml ├── livelessons-testing ├── livelessons-testing-spring │ └── src │ │ ├── test │ │ └── resources │ │ │ ├── .gitignore │ │ │ ├── demo │ │ │ └── service │ │ │ │ └── vehicledetails.json │ │ │ └── data.sql │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ ├── domain │ │ └── UserRepository.java │ │ └── service │ │ └── VehicleDetailsService.java ├── livelessons-testing-wiremock │ └── src │ │ ├── test │ │ └── resources │ │ │ ├── .gitignore │ │ │ ├── demo │ │ │ └── service │ │ │ │ └── vehicledetails.json │ │ │ └── data.sql │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ └── service │ │ └── VehicleDetailsService.java └── pom.xml ├── livelessons-bootstrap ├── livelessons-bootstrap-gradle │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ └── java │ │ │ │ └── demo │ │ │ │ └── DemoApplication.java │ │ └── test │ │ │ └── java │ │ │ └── demo │ │ │ └── DemoApplicationTests.java │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── README.adoc │ └── build.gradle ├── livelessons-bootstrap-autoconfiguration │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ │ └── java │ │ │ └── demo │ │ │ ├── BootstrapAutoConfigureApplication.java │ │ │ └── LogTomcatVersionAutoConfiguration.java │ └── pom.xml ├── livelessons-bootstrap-cli │ ├── example.groovy │ └── README.adoc ├── README.adoc ├── livelessons-bootstrap-maven │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── ExampleController.java │ │ │ └── BootstrapMavenApplication.java │ └── README.adoc ├── livelessons-bootstrap-autoconfiguration-jetty │ └── src │ │ └── main │ │ └── java │ │ └── demo │ │ └── BootstrapAutoConfigureJettyApplication.java └── pom.xml ├── livelessons-cloud ├── livelessons-cloud-session │ ├── manifest.yml │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ ├── CloudSessionApplication.java │ │ └── ExampleController.java ├── livelessons-cloud-connectors │ ├── manifest.yml │ └── src │ │ └── main │ │ ├── resources │ │ ├── application.properties │ │ ├── schema.sql │ │ └── data.sql │ │ └── java │ │ └── demo │ │ ├── CloudConnectorsApplication.java │ │ └── ExampleController.java ├── livelessons-cloud-services │ ├── manifest.yml │ └── src │ │ └── main │ │ ├── resources │ │ ├── schema.sql │ │ ├── data.sql │ │ └── application.properties │ │ └── java │ │ └── demo │ │ ├── CloudServicesApplication.java │ │ └── ExampleController.java ├── livelessons-cloud-s3 │ └── src │ │ └── main │ │ └── resources │ │ └── application.properties ├── livelessons-cloud-docker │ ├── Dockerfile │ └── src │ │ └── main │ │ └── java │ │ └── demo │ │ ├── ExampleController.java │ │ └── CloudDockerApplication.java ├── livelessons-cloud-heroku │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── ExampleController.java │ │ │ └── CloudHerokuApplication.java │ └── README.adoc ├── livelessons-cloud-cloudfoundry │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── ExampleController.java │ │ │ └── CloudCloudFoundryApplication.java │ ├── README.adoc │ └── pom.xml ├── README.adoc └── pom.xml ├── livelessons-integration ├── livelessons-integration-dataflow-service │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ ├── .DS_Store │ │ │ └── java │ │ │ │ ├── .DS_Store │ │ │ │ └── demo │ │ │ │ ├── .DS_Store │ │ │ │ └── DataflowServiceApplication.java │ │ └── .DS_Store │ ├── .DS_Store │ └── pom.xml ├── livelessons-integration-and-batch │ └── src │ │ └── main │ │ ├── resources │ │ ├── application.properties │ │ └── schema.sql │ │ └── java │ │ └── com │ │ └── example │ │ └── DataApplication.java ├── README.adoc ├── livelessons-integration-batch │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── data.csv │ │ │ └── schema.sql │ │ │ └── java │ │ │ └── demo │ │ │ └── BatchApplication.java │ └── pom.xml ├── livelessons-integration-producer │ └── src │ │ └── main │ │ └── resources │ │ ├── data.csv │ │ └── schema.sql ├── livelessons-integration-eai │ └── src │ │ └── main │ │ ├── resources │ │ ├── application.properties │ │ └── static │ │ │ └── index.html │ │ └── java │ │ └── demo │ │ ├── EchoService.java │ │ └── EchoServiceApplication.java ├── livelessons-integration-consumer │ └── src │ │ ├── main │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── ConsumerApplicationTests.java └── livelessons-integration-basic-messaging │ └── src │ └── main │ └── java │ └── demo │ ├── Consumer.java │ └── Notification.java ├── livelessons-ide-and-tooling ├── livelessons-ide-and-tooling-metadata │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ ├── ConnectionType.java │ │ ├── Application.java │ │ └── MyProperties.java ├── livelessons-ide-and-tooling-devtools │ └── src │ │ └── main │ │ ├── resources │ │ ├── application.properties │ │ └── templates │ │ │ └── hello.html │ │ ├── docker │ │ └── Dockerfile │ │ └── java │ │ └── demo │ │ └── Application.java └── pom.xml ├── livelessons-choreography ├── livelessons-choreography-gateway │ └── src │ │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── demo │ │ ├── ContactClient.java │ │ ├── BookmarkClient.java │ │ ├── Bookmark.java │ │ ├── Passport.java │ │ └── Contact.java ├── livelessons-choreography-hystrix │ └── src │ │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── demo │ │ ├── ContactClient.java │ │ ├── BookmarkClient.java │ │ ├── CircuitBreakerApplication.java │ │ ├── PassportRestController.java │ │ ├── Bookmark.java │ │ ├── Passport.java │ │ └── Contact.java ├── livelessons-choreography-bookmark-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── demo │ │ ├── BookmarkRepository.java │ │ └── Bookmark.java ├── livelessons-choreography-hystrix-dashboard-service │ └── src │ │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── demo │ │ └── HystrixDashboardApplication.java ├── livelessons-choreography-ribbon-and-eureka │ └── src │ │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── demo │ │ ├── ContactClient.java │ │ ├── ServiceDiscoveryApplication.java │ │ ├── BookmarkClient.java │ │ ├── FeignExample.java │ │ ├── Bookmark.java │ │ └── Contact.java ├── livelessons-choreography-contact-service │ └── src │ │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── demo │ │ └── ContactRepository.java ├── livelessons-choreography-eureka-service │ └── src │ │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── demo │ │ └── EurekaServerApplication.java └── README.adoc ├── livelessons-edge ├── livelessons-edge-greetings-service │ └── src │ │ └── main │ │ └── resources │ │ └── application.properties ├── livelessons-edge-greetings-client │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── .DS_Store ├── README.adoc └── livelessons-edge-eureka-service │ ├── src │ └── main │ │ └── java │ │ └── demo │ │ └── EurekaServiceApplication.java │ └── pom.xml ├── livelessons-rest ├── scripts │ ├── troll.jpg │ └── upload_photo.sh ├── README.adoc ├── livelessons-rest-basic │ └── src │ │ └── main │ │ ├── resources │ │ └── data.sql │ │ └── java │ │ └── demo │ │ ├── PersonRepository.java │ │ ├── SimpleRepositoryRestMvcConfiguration.java │ │ ├── Application.java │ │ ├── Person.java │ │ └── PersonResourceProcessor.java ├── livelessons-rest-errors │ └── src │ │ └── main │ │ ├── resources │ │ └── data.sql │ │ └── java │ │ └── demo │ │ ├── PersonNotFoundException.java │ │ ├── PersonRepository.java │ │ ├── SimpleRepositoryRestMvcConfiguration.java │ │ ├── Person.java │ │ ├── Application.java │ │ └── PersonResourceProcessor.java └── pom.xml ├── livelessons-configuration ├── livelessons-configuration-basic │ └── src │ │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── demo │ │ └── ConfigurationProjectProperties.java ├── livelessons-configuration-cloudserver │ └── src │ │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── demo │ │ └── Application.java ├── livelessons-configuration-cloudclient │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── bootstrap.yml │ │ │ └── java │ │ │ └── demo │ │ │ ├── Application.java │ │ │ └── ProjectNameRestController.java │ └── .gitignore ├── README.adoc └── pom.xml ├── .gitignore ├── livelessons-operations ├── livelessons-operations-logging │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── demo │ │ │ └── OperationsLoggingApplication.java │ └── pom.xml ├── livelessons-operations-actuator │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ ├── ExampleController.java │ │ └── OperationsActuatorApplication.java ├── livelessons-operations-cloud-metrics │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ └── ExampleController.java ├── livelessons-operations-monitoring │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── demo │ │ ├── ExampleController.java │ │ ├── OperationsMonitoringApplication.java │ │ ├── ExampleHealthAgregator.java │ │ └── ExampleHealthIndicator.java ├── livelessons-operations-actuator-extensions │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── ExampleController.java │ │ │ ├── WeatherEndpoint.java │ │ │ ├── OperationsActuatorExtensionsApplication.java │ │ │ └── WeatherMvcEndpoint.java │ └── pom.xml ├── livelessons-operations-cloud-monitoring │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── OperationsCloudMonitoringApplication.java │ │ │ ├── ExampleHealthIndicator.java │ │ │ └── ExampleController.java │ └── pom.xml ├── livelessons-operations-metrics │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── demo │ │ │ ├── ExampleController.java │ │ │ ├── ExamplePublicMetrics.java │ │ │ ├── OperationsMetricsApplication.java │ │ │ └── ExampleService.java │ └── pom.xml └── README.adoc └── livelessons-extending ├── livelessons-extending-autoconfigure └── src │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── pom.xml └── livelessons-extending-sample └── src └── main └── java └── demo └── mapper └── Customer.java /livelessons-data/livelessons-data-elasticsearch/.gitignore: -------------------------------------------------------------------------------- 1 | data 2 | -------------------------------------------------------------------------------- /livelessons-security/basic/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/src/main/wro/main.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-spring/src/test/resources/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-wiremock/src/test/resources/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build 3 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-basic/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-session/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | - ll-redis-session 4 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/outro.js: -------------------------------------------------------------------------------- 1 | })); 2 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "src/main/resources/static/lib" 3 | } 4 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-connectors/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | - ll-car-sql-database 4 | 5 | 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-templates/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.thymeleaf.cache=false 2 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9393 -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto=validate 2 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-autoconfiguration/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | log-tomcat-version=false 2 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-connectors/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.continue-on-error=true 2 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-services/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | - ll-car-sql-database 4 | - ll-car-sql-database2 5 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-metadata/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | myapp.type=fail-fast 2 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/selector.js: -------------------------------------------------------------------------------- 1 | define([ "./selector-sizzle" ]); 2 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: gateway -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: hystrix -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-and-batch/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.batch.job.enabled=false -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/css/email.css: -------------------------------------------------------------------------------- 1 | /* Just an example, nothing actually here */ 2 | 3 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/css/layout.css: -------------------------------------------------------------------------------- 1 | /* Just an example, nothing actually here */ 2 | 3 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/css/popups.css: -------------------------------------------------------------------------------- 1 | /* Just an example, nothing actually here */ 2 | 3 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/css/social.css: -------------------------------------------------------------------------------- 1 | /* Just an example, nothing actually here */ 2 | 3 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/css/widgets.css: -------------------------------------------------------------------------------- 1 | /* Just an example, nothing actually here */ 2 | 3 | -------------------------------------------------------------------------------- /livelessons-edge/livelessons-edge-greetings-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name = greetings-service 2 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/arr.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return []; 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-session/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # spring.redis.host= cloud.services.redis.connection.host 2 | -------------------------------------------------------------------------------- /livelessons-rest/scripts/troll.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-rest/scripts/troll.jpg -------------------------------------------------------------------------------- /livelessons-security/auth-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9191 2 | security.sessions=never 3 | server.context-path=/uaa -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | application.version=1_0_0 2 | application.devmode=false 3 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-basic/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | configuration: 2 | projectName : Spring Boot 3 | 4 | 5 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-devtools/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.devtools.remote.secret=mysecret 2 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/ajax/var/rquery.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/\?/); 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/rnotwhite.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/\S+/g); 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-bookmark-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: bookmark-service -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix-dashboard-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | 3 | server: 4 | port: ${PORT:9903} 5 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: ribbon-and-eureka -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudserver/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: config-service 4 | -------------------------------------------------------------------------------- /livelessons-edge/livelessons-edge-greetings-client/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name = greetings-client 2 | server.port=9999 -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-and-batch/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | create table PEOPLE( FIRST VARCHAR , LAST VARCHAR , EMAIL VARCHAR ); -------------------------------------------------------------------------------- /livelessons-security/greetings-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | security.oauth2.resource.user-info-uri=http://localhost:9191/uaa/user 2 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-spring/src/test/resources/demo/service/vehicledetails.json: -------------------------------------------------------------------------------- 1 | { 2 | "make" : "Honda", 3 | "model" : "Civic" 4 | } 5 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-wiremock/src/test/resources/demo/service/vehicledetails.json: -------------------------------------------------------------------------------- 1 | { 2 | "make" : "Honda", 3 | "model" : "Civic" 4 | } 5 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources-angular/src/main/resources/static/js/core.js: -------------------------------------------------------------------------------- 1 | angular.module('scotchTodo', ['todoController', 'todoService']); 2 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/resources/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | @IMPORT url("component.css"); 3 | @IMPORT url("default.css"); 4 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/var/rmargin.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/^margin/); 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-contact-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: contact-service 4 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-spring/src/test/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO USER(ID, USERNAME, VIN) values (123, 'mickey', '01234567890123456'); 2 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-wiremock/src/test/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO USER(ID, USERNAME, VIN) values (123, 'mickey', '01234567890123456'); 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *iml 2 | .eclipse 3 | .settings 4 | .project 5 | .classpath 6 | .springBeans 7 | .idea 8 | target 9 | *-secrets.properties 10 | .factorypath 11 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-s3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=secrets 2 | livelessons.s3.bucket=livelessons-spring-boot 3 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/strundefined.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return typeof undefined; 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-rest/scripts/upload_photo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | uri=http://127.0.0.1:8080/people/$1/photo 5 | resp=`curl -F "file=@$2" $uri` 6 | echo $resp 7 | 8 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-logging/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | logging.level.org.springframework.boot: DEBUG 2 | 3 | logging.file: myapp.log 4 | -------------------------------------------------------------------------------- /livelessons-security/basic/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip 2 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/push.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.push; 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/slice.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.slice; 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-security/x509/src/main/resources/rod.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/x509/src/main/resources/rod.p12 -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/class2type.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | // [[Class]] -> type pairs 3 | return {}; 4 | }); 5 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/concat.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.concat; 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/indexOf.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.indexOf; 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | shell.auth.simple.user.name=livelessons 2 | shell.auth.simple.user.password=livelessons 3 | -------------------------------------------------------------------------------- /livelessons-security/auth-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip 2 | -------------------------------------------------------------------------------- /livelessons-security/edge-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip 2 | -------------------------------------------------------------------------------- /livelessons-security/x509/src/main/resources/sample.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/x509/src/main/resources/sample.jks -------------------------------------------------------------------------------- /livelessons-security/x509/src/main/resources/server.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/x509/src/main/resources/server.jks -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/var/cssExpand.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return [ "Top", "Right", "Bottom", "Left" ]; 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/manipulation/var/rcheckableType.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/^(?:checkbox|radio)$/i); 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/pnum.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 3 | }); 4 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-redis/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # spring.redis.host= 2 | # spring.redis.password= 3 | # spring.redis.port= 4 | # spring.redis.database= 5 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-cloud-metrics/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=secrets 2 | logging.level.org.coursera.metrics.datadog=DEBUG 3 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-monitoring/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | endpoints.health.sensitive=false 2 | endpoints.health.mapping.OUT_OF_SERVICE=i-am-a-teapot 3 | -------------------------------------------------------------------------------- /livelessons-security/basic/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/basic/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /livelessons-security/greetings-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip 2 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-basic/TODO.txt: -------------------------------------------------------------------------------- 1 | https://github.com/SpringOne2GX-2014/microservice-security/blob/master/certs/src/test/java/sample/tomcat/X509ApplicationTests.java 2 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/TODO.txt: -------------------------------------------------------------------------------- 1 | https://github.com/SpringOne2GX-2014/microservice-security/blob/master/certs/src/test/java/sample/tomcat/X509ApplicationTests.java 2 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/TODO.txt: -------------------------------------------------------------------------------- 1 | https://github.com/SpringOne2GX-2014/microservice-security/blob/master/certs/src/test/java/sample/tomcat/X509ApplicationTests.java 2 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/src/main/wro/wro.properties: -------------------------------------------------------------------------------- 1 | #List of preProcessors 2 | preProcessors=lessCssImport 3 | #List of postProcessors 4 | postProcessors=less4j,jsMin -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/ajax/var/nonce.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../core" 3 | ], function( jQuery ) { 4 | return jQuery.now(); 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/data/var/data_priv.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../Data" 3 | ], function( Data ) { 4 | return new Data(); 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/data/var/data_user.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../Data" 3 | ], function( Data ) { 4 | return new Data(); 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-integration/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 6: Dealing With Integration and Batch Processing 3 | 4 | _Connect Microservices using Spring Integration and Spring Batch._ 5 | 6 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-resource/TODO.txt: -------------------------------------------------------------------------------- 1 | https://github.com/SpringOne2GX-2014/microservice-security/blob/master/certs/src/test/java/sample/tomcat/X509ApplicationTests.java 2 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/src/main/resources/db/migration/V2__add-color.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE car ADD COLUMN (color varchar(200)); 2 | 3 | UPDATE car SET COLOR = 'Red' WHERE color is null; 4 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-auth-server/TODO.txt: -------------------------------------------------------------------------------- 1 | https://github.com/SpringOne2GX-2014/microservice-security/blob/master/certs/src/test/java/sample/tomcat/X509ApplicationTests.java 2 | -------------------------------------------------------------------------------- /livelessons-security/auth-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/auth-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /livelessons-security/edge-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/edge-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/hasOwn.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./class2type" 3 | ], function( class2type ) { 4 | return class2type.hasOwnProperty; 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/toString.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./class2type" 3 | ], function( class2type ) { 4 | return class2type.toString; 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE car ( 2 | id bigint NOT NULL, 3 | make varchar(100), 4 | model varchar(100), 5 | year int, 6 | PRIMARY KEY (id) 7 | ); 8 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/core/var/rsingleTag.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | // Match a standalone tag 3 | return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); 4 | }); 5 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/var/support.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | // All support tests are defined in their respective modules. 3 | return {}; 4 | }); 5 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-autoconfiguration/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | demo.LogTomcatVersionAutoConfiguration 3 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-cli/example.groovy: -------------------------------------------------------------------------------- 1 | @RestController 2 | public class Example { 3 | 4 | @RequestMapping("/") 5 | String hello() { 6 | return "Hello World!" 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-connectors/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE car ( 2 | id bigint NOT NULL, 3 | make varchar(100), 4 | model varchar(100), 5 | year int, 6 | PRIMARY KEY (id) 7 | ); 8 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-services/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE car ( 2 | id bigint NOT NULL, 3 | make varchar(100), 4 | model varchar(100), 5 | year int, 6 | PRIMARY KEY (id) 7 | ); 8 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudclient/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: config-client 4 | cloud: 5 | config: 6 | uri: http://localhost:8888 -------------------------------------------------------------------------------- /livelessons-security/greetings-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/greetings-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-metadata/src/main/java/demo/ConnectionType.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public enum ConnectionType { 4 | 5 | NORMAL, 6 | 7 | FAIL_FAST; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-resource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port: 9000 2 | server.address: 127.0.0.1 3 | security.oauth2.resource.userInfoUri: http://localhost:9999/uaa/user 4 | -------------------------------------------------------------------------------- /livelessons-edge/livelessons-edge-greetings-client/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-edge/livelessons-edge-greetings-client/src/main/java/.DS_Store -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-integration/livelessons-integration-dataflow-service/.DS_Store -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/resources/rod.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/livelessons-security-https/src/main/resources/rod.p12 -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-integration/livelessons-integration-dataflow-service/src/.DS_Store -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/resources/sample.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/livelessons-security-https/src/main/resources/sample.jks -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/resources/server.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-security/livelessons-security-https/src/main/resources/server.jks -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-auth-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9999 2 | server.contextPath=/uaa 3 | security.user.password=password 4 | logging.level.org.springframework.security=DEBUG -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO car VALUES (0, 'Honda', 'Civic', 1997); 2 | INSERT INTO car VALUES (1, 'Honda', 'Accord', 2003); 3 | INSERT INTO car VALUES (2, 'Ford', 'Escort', 1985); 4 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-batch/src/main/resources/data.csv: -------------------------------------------------------------------------------- 1 | Phil,Webb,pwebb@email.com 2 | Josh,Long,jlong@email.com 3 | Dave,Syer,dsyer@email.com 4 | Spencer,Gibb,sgibb@email.com 5 | Juergen,Hoeller,jhoeller@email.com -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-web/livelessons-web-resources/src/main/resources/public/favicon.ico -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/var/rnumnonpx.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../var/pnum" 3 | ], function( pnum ) { 4 | return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 5 | }); 6 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-templates/src/main/resources/static/img/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-web/livelessons-web-templates/src/main/resources/static/img/logo.jpg -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-services/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO car VALUES (0, 'Honda', 'Civic', 1997); 2 | INSERT INTO car VALUES (1, 'Honda', 'Accord', 2003); 3 | INSERT INTO car VALUES (2, 'Ford', 'Escort', 1985); 4 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-integration/livelessons-integration-dataflow-service/src/main/.DS_Store -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-producer/src/main/resources/data.csv: -------------------------------------------------------------------------------- 1 | Phil,Webb,pwebb@email.com 2 | Josh,Long,jlong@email.com 3 | Dave,Syer,dsyer@email.com 4 | Spencer,Gibb,sgibb@email.com 5 | Juergen,Hoeller,jhoeller@email.com -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/img/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-web/livelessons-web-transforms/src/main/resources/static/img/logo.jpg -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-bootstrap/livelessons-bootstrap-gradle/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-connectors/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO car VALUES (0, 'Honda', 'Civic', 1997); 2 | INSERT INTO car VALUES (1, 'Honda', 'Accord', 2003); 3 | INSERT INTO car VALUES (2, 'Ford', 'Escort', 1985); 4 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dockerfile/java:oracle-java8 2 | EXPOSE 8080 3 | CMD java -jar /livelessons-cloud-docker.jar 4 | ADD target/livelessons-cloud-docker-1.0.0-SNAPSHOT.jar /livelessons-cloud-docker.jar 5 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/traversing/var/rneedsContext.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../core", 3 | "../../selector" 4 | ], function( jQuery ) { 5 | return jQuery.expr.match.needsContext; 6 | }); 7 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-services/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.continue-on-error=true 2 | spring.datasource.url=${cloud.services.ll-car-sql-database.connection.jdbcurl} 3 | spring.datasource.max-active=1 4 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-integration/livelessons-integration-dataflow-service/src/main/java/.DS_Store -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-basic/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | -- users in system 2 | insert into account(account_name , password) values('jlong', 'spring'); 3 | insert into account(account_name , password) values('pwebb', 'boot'); 4 | 5 | 6 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-spring/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/cars?autoReconnect=true&useSSL=false 2 | spring.datasource.username=cars 3 | spring.datasource.password=cars 4 | 5 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-wiremock/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/cars?autoReconnect=true&useSSL=false 2 | spring.datasource.username=cars 3 | spring.datasource.password=cars 4 | 5 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/src/main/java/demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livelessons-spring/building-microservices/HEAD/livelessons-integration/livelessons-integration-dataflow-service/src/main/java/demo/.DS_Store -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/event/support.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../var/support" 3 | ], function( support ) { 4 | 5 | support.focusinBubbles = "onfocusin" in window; 6 | 7 | return support; 8 | 9 | }); 10 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudclient/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .gitignore support plugin (hsz.mobi) 2 | ### Maven template 3 | target/ 4 | pom.xml.tag 5 | pom.xml.releaseBackup 6 | pom.xml.versionsBackup 7 | pom.xml.next 8 | release.properties 9 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-batch/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE contact IF EXISTS; 2 | 3 | CREATE TABLE contact( 4 | id IDENTITY primary key, 5 | email VARCHAR (20), 6 | first_name VARCHAR(20), 7 | last_name VARCHAR(20) 8 | ); -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-producer/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE contact IF EXISTS; 2 | 3 | CREATE TABLE contact( 4 | id IDENTITY primary key, 5 | email VARCHAR (20), 6 | first_name VARCHAR(20), 7 | last_name VARCHAR(20) 8 | ); -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-eai/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #spring.rabbitmq.password kBUeh7ro9AT5durrguN5e5okAMKxcuHZ 2 | #spring.rabbitmq.username ihylfihe 3 | #spring.rabbitmq.host turtle.rmq.cloudamqp.com 4 | #spring.rabbitmq.virtualHost ihylfihe -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | server: 3 | port: ${PORT:9023} 4 | 5 | eureka: 6 | client: 7 | serviceUrl: 8 | defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ 9 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.cloud.stream.bindings.input.destination = greetings 2 | spring.cloud.stream.bindings.input.group = greetings-group 3 | spring.cloud.stream.bindings.input.durableSubscription = true -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudserver/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | 4 | spring: 5 | cloud: 6 | config: 7 | server: 8 | git : 9 | uri: https://github.com/joshlong/microservices-lab-configuration 10 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-eai/src/main/java/demo/EchoService.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | @Service 6 | class EchoService { 7 | 8 | public String echo(String input) { 9 | return "Echo: " + input; 10 | } 11 | } -------------------------------------------------------------------------------- /livelessons-rest/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 5: Giving Your Microservice a REST 3 | 4 | _Why the web is a existence proof of the HTTP architecture and how to build 5 | services that exploit that._ 6 | 7 | - link:livelessons-rest-basic[Basic] 8 | - link:livelessons-rest-sync[Sync] 9 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-eureka-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | 3 | server: 4 | port: ${PORT:8761} 5 | 6 | 7 | 8 | eureka: 9 | client: 10 | registerWithEureka: false 11 | fetchRegistry: false 12 | server: 13 | waitTimeInMsWhenSyncEmpty: 0 14 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | -- users in system 2 | insert into account(account_name , password) values('jlong', 'N/A'); 3 | insert into account(account_name , password) values('pwebb', 'N/A'); 4 | insert into account(account_name , password) values('rod', 'N/A'); 5 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/src/main/java/demo/CarRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | public interface CarRepository extends CrudRepository { 6 | 7 | Iterable findByMakeIgnoringCase(String make); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jpa/src/main/java/demo/CarRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | public interface CarRepository extends CrudRepository { 6 | 7 | Iterable findByMakeIgnoringCase(String make); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/src/main/resources/static/home.html: -------------------------------------------------------------------------------- 1 |

Greeting

2 |
3 |

The ID is {{greeting.id}}

4 |

The content is {{greeting.content}}

5 |
6 |
7 |

Login to see your greeting

8 |
9 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-devtools/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | ADD spring-boot-app-0.0.1-SNAPSHOT.jar app.jar 3 | RUN bash -c 'touch /app.jar' 4 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Xdebug","-Xrunjdwp:server=y,transport=dt_socket,suspend=n","-jar","/app.jar"] 5 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-basic/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE account if EXISTS ; 2 | 3 | create table account ( ACCOUNT_NAME varchar(255) not null, 4 | PASSWORD varchar(255 ) not null, 5 | ID serial, 6 | ENABLED bool default true) ; 7 | 8 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE account if EXISTS ; 2 | 3 | create table account ( ACCOUNT_NAME varchar(255) not null, 4 | PASSWORD varchar(255 ) not null, 5 | ID serial, 6 | ENABLED bool default true) ; 7 | 8 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Feb 13 17:45:43 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip 7 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/src/main/resources/application-mysql.properties: -------------------------------------------------------------------------------- 1 | # Demo connecting to local database 2 | # Assumes username of 'root' with no password 3 | # Use `create database cars;` from the CLI to create the empty DB 4 | 5 | spring.datasource.url=jdbc:mysql://localhost/cars 6 | spring.datasource.username=root 7 | 8 | -------------------------------------------------------------------------------- /livelessons-security/x509/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | server.ssl.key-store=classpath:server.jks 3 | server.ssl.key-store-password = password 4 | 5 | server.ssl.trust-store = classpath:server.jks 6 | server.ssl.trust-store-password = password 7 | 8 | server.ssl.client-auth=need 9 | server.ssl.key-alias=servercert 10 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/attributes.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "./attributes/attr", 4 | "./attributes/prop", 5 | "./attributes/classes", 6 | "./attributes/val" 7 | ], function( jQuery ) { 8 | 9 | // Return jQuery for attributes-only inclusion 10 | return jQuery; 11 | }); 12 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-basic/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | insert into person( name, email) values ( 'josh', 'josh@email.com'); 2 | insert into person( name, email) values ( 'john', 'john@email.com'); 3 | insert into person( name, email) values ( 'yoana', 'yoana@email.com'); 4 | insert into person( name, email) values ( 'emo', 'emo@email.com'); -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-elasticsearch/src/main/java/demo/CarRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 4 | 5 | public interface CarRepository extends ElasticsearchRepository { 6 | 7 | Iterable findByMakeIgnoringCase(String make); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "livelessons-web-resources", 3 | "version": "1.0.0.SNAPSHOT", 4 | "private": true, 5 | "ignore": [ 6 | "**/.*", 7 | "node_modules", 8 | "bower_components", 9 | "test", 10 | "tests" 11 | ], 12 | "dependencies": { 13 | "jquery": "~2.1.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LiveLessons 5 | 6 | 7 |

LiveLessons

8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /livelessons-security/basic/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .classpath 6 | .factorypath 7 | .project 8 | .settings 9 | .springBeans 10 | 11 | ### IntelliJ IDEA ### 12 | .idea 13 | *.iws 14 | *.iml 15 | *.ipr 16 | 17 | ### NetBeans ### 18 | nbproject/private/ 19 | build/ 20 | nbbuild/ 21 | dist/ 22 | nbdist/ 23 | .nb-gradle/ -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | ssl: 3 | keyStore: classpath:server.jks 4 | trustStore: classpath:server.jks 5 | keyStorePassword: password 6 | trustStorePassword: password 7 | keyAlias: servercert 8 | clientAuth: NEED 9 | logging: 10 | level: 11 | org.springframework.security: DEBUG -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/ajax/parseJSON.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Support: Android 2.3 6 | // Workaround failure to string-cast null input 7 | jQuery.parseJSON = function( data ) { 8 | return JSON.parse( data + "" ); 9 | }; 10 | 11 | return jQuery.parseJSON; 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/deprecated.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "./traversing" 4 | ], function( jQuery ) { 5 | 6 | // The number of elements contained in the matched element set 7 | jQuery.fn.size = function() { 8 | return this.length; 9 | }; 10 | 11 | jQuery.fn.andSelf = jQuery.fn.addBack; 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /livelessons-security/auth-service/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .classpath 6 | .factorypath 7 | .project 8 | .settings 9 | .springBeans 10 | 11 | ### IntelliJ IDEA ### 12 | .idea 13 | *.iws 14 | *.iml 15 | *.ipr 16 | 17 | ### NetBeans ### 18 | nbproject/private/ 19 | build/ 20 | nbbuild/ 21 | dist/ 22 | nbdist/ 23 | .nb-gradle/ -------------------------------------------------------------------------------- /livelessons-security/edge-service/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .classpath 6 | .factorypath 7 | .project 8 | .settings 9 | .springBeans 10 | 11 | ### IntelliJ IDEA ### 12 | .idea 13 | *.iws 14 | *.iml 15 | *.ipr 16 | 17 | ### NetBeans ### 18 | nbproject/private/ 19 | build/ 20 | nbbuild/ 21 | dist/ 22 | nbdist/ 23 | .nb-gradle/ -------------------------------------------------------------------------------- /livelessons-edge/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 9: Developing Web Applications 3 | 4 | _Basics of developing web applications to consume your Microservices._ 5 | 6 | - link:livelessons-web-resources[Resources] 7 | - link:livelessons-web-resources-angular[Resources (Angular)] 8 | - link:livelessons-web-templates[Templating] 9 | - link:livelessons-web-transforms[Transforms] 10 | -------------------------------------------------------------------------------- /livelessons-security/greetings-service/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .classpath 6 | .factorypath 7 | .project 8 | .settings 9 | .springBeans 10 | 11 | ### IntelliJ IDEA ### 12 | .idea 13 | *.iws 14 | *.iml 15 | *.ipr 16 | 17 | ### NetBeans ### 18 | nbproject/private/ 19 | build/ 20 | nbbuild/ 21 | dist/ 22 | nbdist/ 23 | .nb-gradle/ -------------------------------------------------------------------------------- /livelessons-web/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 9: Developing Web Applications 3 | 4 | _Basics of developing web applications to consume your Microservices._ 5 | 6 | - link:livelessons-web-resources[Resources] 7 | - link:livelessons-web-resources-angular[Resources (Angular)] 8 | - link:livelessons-web-templates[Templating] 9 | - link:livelessons-web-transforms[Transforms] 10 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/effects/animatedSelector.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../selector", 4 | "../effects" 5 | ], function( jQuery ) { 6 | 7 | jQuery.expr.filters.animated = function( elem ) { 8 | return jQuery.grep(jQuery.timers, function( fn ) { 9 | return elem === fn.elem; 10 | }).length; 11 | }; 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /livelessons-configuration/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 2: Using ``Twelve-Factor'' Style Configuration 3 | 4 | _The 12 factor manifesto, external configuration and how these concepts are 5 | supported in Spring._ 6 | 7 | - link:livelesson-configuration-basic[Basic] 8 | - link:livelesson-configuration-cloudclient[Cloud Client] 9 | - link:livelesson-configuration-cloudserver[Cloud Server] 10 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/src/main/resources/db/migration/V1__init.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE car ( 2 | id bigint NOT NULL, 3 | make varchar(100), 4 | model varchar(100), 5 | year int, 6 | PRIMARY KEY (id) 7 | ); 8 | 9 | INSERT INTO car VALUES (0, 'Honda', 'Civic', 1997); 10 | INSERT INTO car VALUES (1, 'Honda', 'Accord', 2003); 11 | INSERT INTO car VALUES (2, 'Ford', 'Escort', 1985); 12 | -------------------------------------------------------------------------------- /livelessons-bootstrap/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 1: Bootstrapping (Spring Boot 101) 3 | 4 | _Take your first steps with Spring Boot._ 5 | 6 | - link:livelessons-bootstrap-cli[Spring Boot CLI] 7 | - link:livelessons-bootstrap-maven[Using Maven] 8 | - link:livelessons-bootstrap-gradle[Using Gradle] 9 | - link:livelessons-bootstrap-maven[Understanding Auto-configuration] 10 | 11 | TODO Jetty docs ac 12 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-docker/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-heroku/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | insert into person( name, email) values ( 'josh', 'josh@email.com'); 2 | insert into person( name, email) values ( 'john', 'john@email.com'); 3 | insert into person( name, email) values ( 'yoana', 'yoana@email.com'); 4 | insert into person( name, email) values ( 'phil', 'phil@email.com'); 5 | insert into person( name, email) values ( 'emo', 'emo@email.com'); -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-templates/src/main/resources/static/css/page.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | width: 100%; 6 | } 7 | 8 | h1 { 9 | padding: 20px; 10 | } 11 | 12 | p { 13 | padding: 10px; 14 | } 15 | 16 | div.banner { 17 | background: #fe690b; 18 | padding: 10px 20px; 19 | margin: 0 auto; 20 | } 21 | 22 | .footer { 23 | color: #AAAAAA; 24 | } 25 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-maven/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-cloudfoundry/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-security/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 10: Securing Microservices With Spring Security 3 | 4 | _How to apply security to your microservices._ 5 | 6 | - link:livelessons-security-basic[Basic Security] 7 | - link:livelessons-security-sso-auth-server[Single Sign On (Server)] 8 | - link:livelessons-security-sso-resource[Single Sign On (Resource)] 9 | - link:livelessons-security-https[HTTPS (TSL/SSL)] 10 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/manipulation/_evalUrl.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../ajax" 3 | ], function( jQuery ) { 4 | 5 | jQuery._evalUrl = function( url ) { 6 | return jQuery.ajax({ 7 | url: url, 8 | type: "GET", 9 | dataType: "script", 10 | async: false, 11 | global: false, 12 | "throws": true 13 | }); 14 | }; 15 | 16 | return jQuery._evalUrl; 17 | 18 | }); 19 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 1: Bootstrapping (Using Gradle) 3 | 4 | == Introduction 5 | This example shows how Spring Boot with Gradle. 6 | 7 | == Building and running the sample 8 | Use the following commands to build run the application: 9 | 10 | ``` 11 | $ ./gradlew build 12 | $ java -jar build/libs/livelessons-bootstrap-gradle-0.0.1-SNAPSHOT.jar 13 | ``` 14 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-maven/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 1: Bootstrapping (Using Maven) 3 | 4 | == Introduction 5 | This example shows how Spring Boot works with Maven. 6 | 7 | == Building and running the sample 8 | Use the following commands to build run the application: 9 | 10 | ``` 11 | $ mvn clean package 12 | $ java -jar target/livelessons-bootstrap-maven-1.0.0-SNAPSHOT.jar 13 | ``` 14 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-cloud-metrics/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-monitoring/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-security/edge-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | security.oauth2.resource.user-info-uri=http://localhost:9191/uaa/user 2 | 3 | server.port=8082 4 | 5 | security.oauth2.client.access-token-uri=http://localhost:9191/uaa/oauth/token 6 | security.oauth2.client.user-authorization-uri=http://localhost:9191/uaa/oauth/authorize 7 | security.oauth2.client.client-id=html5 8 | security.oauth2.client.client-secret=secret -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator-extensions/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | @RequestMapping("/") 10 | public String hello() { 11 | return "Hello World!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-contact-service/src/main/java/demo/ContactRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | public interface ContactRepository extends JpaRepository { 8 | 9 | List findByUserId(String userId); 10 | 11 | Contact findByUserIdAndId(String userId, Long id); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | server: 3 | port: ${PORT:9023} 4 | 5 | 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ 10 | 11 | --- 12 | spring: 13 | profiles: cloud 14 | eureka: 15 | instance: 16 | hostname: ${APPLICATION_DOMAIN} 17 | nonSecurePort: 80 18 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-devtools/src/main/java/demo/Application.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/src/main/java/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-bookmark-service/src/main/java/demo/BookmarkRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | public interface BookmarkRepository extends JpaRepository { 8 | 9 | List findByUserId(String userId); 10 | 11 | Bookmark findByUserIdAndId(String userId, Long id); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | server: 3 | port: ${PORT:9023} 4 | 5 | 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ 10 | 11 | --- 12 | spring: 13 | profiles: cloud 14 | eureka: 15 | instance: 16 | hostname: ${APPLICATION_DOMAIN} 17 | nonSecurePort: 80 18 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-docker/src/main/java/demo/CloudDockerApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CloudDockerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CloudDockerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-heroku/src/main/java/demo/CloudHerokuApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CloudHerokuApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CloudHerokuApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/java/demo/PersonNotFoundException.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class PersonNotFoundException extends RuntimeException { 4 | 5 | private Long personId; 6 | 7 | public Long getPersonId() { 8 | return personId; 9 | } 10 | 11 | public PersonNotFoundException(Long personId) { 12 | super("person# " + personId + " was not found"); 13 | this.personId = personId; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-and-batch/src/main/java/com/example/DataApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DataApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DataApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/java/demo/WebResourcesApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WebResourcesApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WebResourcesApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/selector-sizzle.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "sizzle" 4 | ], function( jQuery, Sizzle ) { 5 | 6 | jQuery.find = Sizzle; 7 | jQuery.expr = Sizzle.selectors; 8 | jQuery.expr[":"] = jQuery.expr.pseudos; 9 | jQuery.unique = Sizzle.uniqueSort; 10 | jQuery.text = Sizzle.getText; 11 | jQuery.isXMLDoc = Sizzle.isXML; 12 | jQuery.contains = Sizzle.contains; 13 | 14 | }); 15 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-services/src/main/java/demo/CloudServicesApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CloudServicesApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CloudServicesApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/src/main/wro/wro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | webjar:bootstrap/3.2.0/less/bootstrap.less 4 | file:${project.basedir}/src/main/wro/main.less 5 | webjar:jquery/2.1.1/jquery.min.js 6 | webjar:angularjs/1.3.8/angular.min.js 7 | webjar:angularjs/1.3.8/angular-route.min.js 8 | 9 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-connectors/src/main/java/demo/CloudConnectorsApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CloudConnectorsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CloudConnectorsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-cloudfoundry/src/main/java/demo/CloudCloudFoundryApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CloudCloudFoundryApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CloudCloudFoundryApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-security/basic/src/test/java/com/example/BasicApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class BasicApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources-angular/src/main/java/demo/WebResourcesRestApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WebResourcesRestApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WebResourcesRestApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/event/ajax.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../event" 4 | ], function( jQuery ) { 5 | 6 | // Attach a bunch of functions for handling common AJAX events 7 | jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { 8 | jQuery.fn[ type ] = function( fn ) { 9 | return this.on( type, fn ); 10 | }; 11 | }); 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator/src/main/java/demo/OperationsActuatorApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OperationsActuatorApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(OperationsActuatorApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-rest/src/main/java/demo/CarRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | import org.springframework.data.repository.query.Param; 5 | import org.springframework.data.rest.core.annotation.RestResource; 6 | 7 | public interface CarRepository extends CrudRepository { 8 | 9 | @RestResource(path = "find") 10 | Iterable findByMakeIgnoringCase(@Param("make") String make); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-monitoring/src/main/java/demo/OperationsMonitoringApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OperationsMonitoringApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(OperationsMonitoringApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-security/auth-service/src/test/java/com/example/AuthServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class AuthServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-security/edge-service/src/test/java/com/example/EdgeServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class EdgeServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-bookmark-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | server: 3 | port: ${PORT:0} 4 | 5 | spring: 6 | jpa: 7 | generate-ddl: true 8 | 9 | 10 | eureka: 11 | client: 12 | serviceUrl: 13 | defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ 14 | 15 | --- 16 | spring: 17 | profiles: cloud 18 | eureka: 19 | instance: 20 | hostname: ${APPLICATION_DOMAIN} 21 | nonSecurePort: 80 22 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-contact-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | server: 3 | port: ${PORT:0} 4 | 5 | spring: 6 | jpa: 7 | generate-ddl: true 8 | 9 | 10 | eureka: 11 | client: 12 | serviceUrl: 13 | defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/ 14 | 15 | --- 16 | spring: 17 | profiles: cloud 18 | eureka: 19 | instance: 20 | hostname: ${APPLICATION_DOMAIN} 21 | nonSecurePort: 80 22 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-consumer/src/test/java/com/example/ConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator-extensions/src/main/java/demo/WeatherEndpoint.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.actuate.endpoint.AbstractEndpoint; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class WeatherEndpoint extends AbstractEndpoint { 8 | 9 | public WeatherEndpoint() { 10 | super("weather"); 11 | } 12 | 13 | @Override 14 | public String invoke() { 15 | return "frightful"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /livelessons-security/greetings-service/src/test/java/com/example/GreetingsServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class GreetingsServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/var/isHidden.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../core", 3 | "../../selector" 4 | // css is assumed 5 | ], function( jQuery ) { 6 | 7 | return function( elem, el ) { 8 | // isHidden might be called from jQuery#filter function; 9 | // in that case, element will be second argument 10 | elem = el || elem; 11 | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); 12 | }; 13 | }); 14 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-cloud-monitoring/src/main/java/demo/OperationsCloudMonitoringApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OperationsCloudMonitoringApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(OperationsCloudMonitoringApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-redis/src/main/java/demo/SlowService.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.cache.annotation.Cacheable; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class SlowService { 10 | 11 | @Cacheable("slow") 12 | public String execute(String arg) { 13 | try { 14 | Thread.sleep(2000); 15 | } 16 | catch (InterruptedException ex) { 17 | } 18 | return UUID.randomUUID().toString(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator-extensions/src/main/java/demo/OperationsActuatorExtensionsApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OperationsActuatorExtensionsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(OperationsActuatorExtensionsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudserver/src/main/java/demo/Application.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.config.server.EnableConfigServer; 6 | 7 | @SpringBootApplication 8 | @EnableConfigServer 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Application.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-mongodb/src/main/java/demo/CarRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.data.geo.Distance; 4 | import org.springframework.data.geo.GeoResults; 5 | import org.springframework.data.geo.Point; 6 | import org.springframework.data.mongodb.repository.MongoRepository; 7 | 8 | public interface CarRepository extends MongoRepository { 9 | 10 | Iterable findByMakeIgnoringCase(String make); 11 | 12 | GeoResults findByPositionNear(Point p, Distance d); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-basic/src/main/java/demo/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.repository.query.Param; 7 | import org.springframework.data.rest.core.annotation.RepositoryRestResource; 8 | 9 | @RepositoryRestResource(path = "people") 10 | interface PersonRepository extends JpaRepository { 11 | 12 | Collection findByEmail(@Param("email") String e); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/java/demo/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.repository.query.Param; 7 | import org.springframework.data.rest.core.annotation.RepositoryRestResource; 8 | 9 | @RepositoryRestResource(path = "people") 10 | interface PersonRepository extends JpaRepository { 11 | 12 | Collection findByEmail(@Param("email") String email); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/hiddenVisibleSelectors.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../selector" 4 | ], function( jQuery ) { 5 | 6 | jQuery.expr.filters.hidden = function( elem ) { 7 | // Support: Opera <= 12.12 8 | // Opera reports offsetWidths and offsetHeights less than zero on some elements 9 | return elem.offsetWidth <= 0 && elem.offsetHeight <= 0; 10 | }; 11 | jQuery.expr.filters.visible = function( elem ) { 12 | return !jQuery.expr.filters.hidden( elem ); 13 | }; 14 | 15 | }); 16 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-monitoring/src/main/java/demo/ExampleHealthAgregator.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.actuate.health.OrderedHealthAggregator; 4 | import org.springframework.boot.actuate.health.Status; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class ExampleHealthAgregator extends OrderedHealthAggregator { 9 | 10 | public ExampleHealthAgregator() { 11 | setStatusOrder(Status.OUT_OF_SERVICE, Status.DOWN, Status.UP, Status.UNKNOWN); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources-angular/src/main/resources/static/js/services/todos.js: -------------------------------------------------------------------------------- 1 | angular.module('todoService', []) 2 | 3 | // super simple service 4 | // each function returns a promise object 5 | .factory('Todos', ['$http',function($http) { 6 | return { 7 | get : function() { 8 | return $http.get('/api/todos'); 9 | }, 10 | create : function(todoData) { 11 | return $http.post('/api/todos', todoData); 12 | }, 13 | delete : function(id) { 14 | return $http.delete('/api/todos/' + id); 15 | } 16 | } 17 | }]); -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/var/getStyles.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return function( elem ) { 3 | // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 4 | // IE throws on elements created in popups 5 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6 | if ( elem.ownerDocument.defaultView.opener ) { 7 | return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); 8 | } 9 | 10 | return window.getComputedStyle( elem, null ); 11 | }; 12 | }); 13 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/data/accepts.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | /** 6 | * Determines whether an object can have data 7 | */ 8 | jQuery.acceptData = function( owner ) { 9 | // Accepts only: 10 | // - Node 11 | // - Node.ELEMENT_NODE 12 | // - Node.DOCUMENT_NODE 13 | // - Object 14 | // - Any 15 | /* jshint -W018 */ 16 | return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 17 | }; 18 | 19 | return jQuery.acceptData; 20 | }); 21 | -------------------------------------------------------------------------------- /livelessons-edge/livelessons-edge-eureka-service/src/main/java/demo/EurekaServiceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | @EnableEurekaServer 8 | @SpringBootApplication 9 | public class EurekaServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(EurekaServiceApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-eureka-service/src/main/java/demo/EurekaServerApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | @SpringBootApplication 8 | @EnableEurekaServer 9 | public class EurekaServerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(EurekaServerApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/src/main/java/demo/DataflowServiceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.dataflow.server.EnableDataFlowServer; 6 | 7 | @EnableDataFlowServer 8 | @SpringBootApplication 9 | public class DataflowServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(DataflowServiceApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-auth-server/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | -- users in system 2 | insert into account(account_name , password) values('jlong', 'spring'); 3 | insert into account(account_name , password) values('pwebb', 'boot'); 4 | 5 | 6 | 7 | -- oauth client details 8 | insert into client_details( client_id, client_secret, resource_ids, scopes, grant_types, authorities) 9 | values( 'acme' , 'acmesecret', null, 'openid,read', 'authorization_code,refresh_token,password', null ); -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-session/src/main/java/demo/CloudSessionApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; 6 | 7 | @SpringBootApplication 8 | @EnableRedisHttpSession 9 | public class CloudSessionApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(CloudSessionApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /livelessons-data/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 4: Working With Data 3 | 4 | _How to design microservices that store and consume data in traditional 5 | relational databases and newer NoSQL stores._ 6 | 7 | - link:livelessons-data-jpa[Relational Database with JPA] 8 | - link:livelessons-data-jdbc[Relational Database with JDBC] 9 | - link:livelessons-data-flyway[Flyway Migration] 10 | - link:livelessons-data-redis[Redis] 11 | - link:livelessons-data-mongodb[MongoDB] 12 | - link:livelessons-data-elasticsearch[Elasticsearch] 13 | - link:livelessons-data-rest[Spring Data REST] 14 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-logging/src/main/java/demo/OperationsLoggingApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OperationsLoggingApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication application = new SpringApplication( 11 | OperationsLoggingApplication.class); 12 | application.setWebEnvironment(false); 13 | application.run(args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-autoconfiguration/src/main/java/demo/BootstrapAutoConfigureApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | @EnableAutoConfiguration 9 | public class BootstrapAutoConfigureApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(BootstrapAutoConfigureApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-metrics/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | private final ExampleService service; 10 | 11 | public ExampleController(ExampleService service) { 12 | this.service = service; 13 | } 14 | 15 | @RequestMapping("/") 16 | public String hello() { 17 | this.service.call(); 18 | return "Hello World!"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-operations/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 7: Creating Operations-Friendly Microservices 3 | 4 | _Learn how to build production-ready Microservices._ 5 | 6 | - link:livelessons-operations-logging[Logging] 7 | - link:livelessons-operations-actuator[Actuator] 8 | - link:livelessons-operations-monitoring[Monitoring] 9 | - link:livelessons-operations-cloud-monitoring[Monitoring in the Cloud] 10 | - link:livelessons-operations-metrics[Metrics] 11 | - link:livelessons-operations-cloud-metrics[Metrics in the Cloud] 12 | - link:livelessons-operations-actuator-extensions[Extending Actuator] 13 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/static/css/page.css: -------------------------------------------------------------------------------- 1 | @IMPORT url("/css/layout.css"); 2 | @IMPORT url("/css/email.css"); 3 | @IMPORT url("/css/widgets.css"); 4 | @IMPORT url("/css/social.css"); 5 | @IMPORT url("/css/popups.css"); 6 | 7 | body { 8 | margin: 0; 9 | padding: 0; 10 | font-family: sans-serif; 11 | width: 100%; 12 | } 13 | 14 | h1 { 15 | padding: 20px; 16 | } 17 | 18 | p { 19 | padding: 10px; 20 | } 21 | 22 | div.banner { 23 | background: #fe690b; 24 | padding: 10px 20px; 25 | margin: 0 auto; 26 | } 27 | 28 | .footer { 29 | color: #AAAAAA; 30 | } 31 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty/src/main/java/demo/BootstrapAutoConfigureJettyApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | @EnableAutoConfiguration 9 | public class BootstrapAutoConfigureJettyApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(BootstrapAutoConfigureJettyApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-basic/src/main/java/demo/ConfigurationProjectProperties.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties("configuration") 8 | public class ConfigurationProjectProperties { 9 | 10 | private String projectName; 11 | 12 | public String getProjectName() { 13 | return projectName; 14 | } 15 | 16 | public void setProjectName(String projectName) { 17 | this.projectName = projectName; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-cli/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 1: Bootstrapping (Spring Boot CLI) 3 | 4 | == Introduction 5 | This example shows how you can use the Spring Boot CLI to compile, run and jar Groovy 6 | code. 7 | 8 | == Prerequisites 9 | You need the Spring CLI installed. See http://spring.io/spring-boot[spring.io/spring-boot]. 10 | 11 | == Running the sample 12 | Use the following commands to run the application: 13 | 14 | ``` 15 | $ spring run example.groovy 16 | ``` 17 | 18 | If you want to generate a jar: 19 | 20 | ``` 21 | $ spring jar example.jar example.groovy 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-maven/src/main/java/demo/BootstrapMavenApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.context.annotation.ComponentScan; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | @EnableAutoConfiguration 10 | @ComponentScan 11 | public class BootstrapMavenApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(BootstrapMavenApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /livelessons-cloud/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 3: Reaching For The Clouds 3 | 4 | _How to build and deploy applications that exploit the capabilities of cloud 5 | platforms such as Cloud Foundry and Heroku._ 6 | 7 | - link:livelessons-cloud-heroku[Heroku] 8 | - link:livelessons-cloud-cloudfoundry[Cloud Foundry] 9 | - link:livelessons-cloud-docker[Docker] 10 | - link:livelessons-cloud-services[Consume Cloud Services using Environment Variables] 11 | - link:livelessons-cloud-connectors[Consume Cloud Services using Cloud Connectors] 12 | - link:livelessons-cloud-session[Spring Session] 13 | - link:livelessons-cloud-s3[Amazon S3] 14 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "2.1.3", 4 | "main": "dist/jquery.js", 5 | "license": "MIT", 6 | "ignore": [ 7 | "**/.*", 8 | "build", 9 | "speed", 10 | "test", 11 | "*.md", 12 | "AUTHORS.txt", 13 | "Gruntfile.js", 14 | "package.json" 15 | ], 16 | "devDependencies": { 17 | "sizzle": "2.1.1-jquery.2.1.2", 18 | "requirejs": "2.1.10", 19 | "qunit": "1.14.0", 20 | "sinon": "1.8.1" 21 | }, 22 | "keywords": [ 23 | "jquery", 24 | "javascript", 25 | "library" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-cloudfoundry/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 3: Reaching For The Clouds (Cloud Foundry) 3 | 4 | == Introduction 5 | This example shows how you can push a Spring Boot application to Cloud Foundry. You 6 | will need a https://run.pivotal.io/[Cloud Foundry account] and the 7 | http://docs.cloudfoundry.org/devguide/installcf/[`cf` command line tool] installed. 8 | 9 | == Pushing to Cloud Foundry 10 | You can build and push the application as follows: 11 | 12 | ``` 13 | $ mvn clean package 14 | $ cf push -p target/livelessons-cloud-cloudfoundry-1.0.0-SNAPSHOT.jar 15 | ``` 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/src/test/java/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.test.context.web.WebAppConfiguration; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | @RunWith(SpringJUnit4ClassRunner.class) 10 | @SpringApplicationConfiguration(classes = DemoApplication.class) 11 | @WebAppConfiguration 12 | public class DemoApplicationTests { 13 | 14 | @Test 15 | public void contextLoads() { 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-monitoring/src/main/java/demo/ExampleHealthIndicator.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.actuate.health.Health; 4 | import org.springframework.boot.actuate.health.HealthIndicator; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class ExampleHealthIndicator implements HealthIndicator { 9 | 10 | @Override 11 | public Health health() { 12 | if ((int) (System.currentTimeMillis() / 1000) % 2 == 0) { 13 | return Health.outOfService().withDetail("time", "is running out").build(); 14 | } 15 | return Health.up().build(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/ContactClient.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient("contact-service") 11 | interface ContactClient { 12 | 13 | @RequestMapping(method = RequestMethod.GET, value = "/{userId}/contacts") 14 | Collection getContacts(@PathVariable("userId") String userId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-services/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.jdbc.core.JdbcTemplate; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class ExampleController { 9 | 10 | private final JdbcTemplate jdbc; 11 | 12 | public ExampleController(JdbcTemplate jdbc) { 13 | this.jdbc = jdbc; 14 | } 15 | 16 | @RequestMapping("/") 17 | public String hello() { 18 | return jdbc.queryForObject("select model from car where id = 1", String.class); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-basic/src/main/java/demo/SimpleRepositoryRestMvcConfiguration.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.data.rest.core.config.RepositoryRestConfiguration; 5 | import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; 6 | 7 | @Configuration 8 | public class SimpleRepositoryRestMvcConfiguration extends RepositoryRestMvcConfiguration { 9 | 10 | @Override 11 | protected void configureRepositoryRestConfiguration( 12 | RepositoryRestConfiguration config) { 13 | config.exposeIdsFor(Person.class); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/java/demo/SimpleRepositoryRestMvcConfiguration.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.data.rest.core.config.RepositoryRestConfiguration; 5 | import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; 6 | 7 | @Configuration 8 | public class SimpleRepositoryRestMvcConfiguration extends RepositoryRestMvcConfiguration { 9 | 10 | @Override 11 | protected void configureRepositoryRestConfiguration( 12 | RepositoryRestConfiguration config) { 13 | config.exposeIdsFor(Person.class); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/java/demo/ContactClient.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient("contact-service") 11 | public interface ContactClient { 12 | 13 | @RequestMapping(method = RequestMethod.GET, value = "/{userId}/contacts") 14 | Collection getContacts(@PathVariable("userId") String userId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-devtools/src/main/resources/templates/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Hello 6 | 7 | 8 | 9 |
Hello
10 |
My Index Is
11 |
0
12 |
Uptime:
13 |
14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-auth-server/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE account if EXISTS ; 2 | DROP TABLE client_details if EXISTS ; 3 | 4 | create table account ( ACCOUNT_NAME varchar(255) not null, 5 | PASSWORD varchar(255 ) not null, 6 | ID serial, 7 | ENABLED bool default true) ; 8 | 9 | create table client_details( 10 | CLIENT_ID VARCHAR (255) not null unique , 11 | CLIENT_SECRET VARCHAR (255) not null , 12 | RESOURCE_IDS VARCHAR (255) null , 13 | SCOPES VARCHAR (255) null , 14 | GRANT_TYPES VARCHAR (255) null , 15 | AUTHORITIES VARCHAR (255) null 16 | ); -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/BookmarkClient.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient("bookmark-service") 11 | public interface BookmarkClient { 12 | 13 | @RequestMapping(method = RequestMethod.GET, value = "/{userId}/bookmarks") 14 | Collection getBookmarks(@PathVariable("userId") String userId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-session/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.UUID; 4 | 5 | import javax.servlet.http.HttpSession; 6 | 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | public class ExampleController { 12 | 13 | @RequestMapping("/") 14 | public String hello(HttpSession session) { 15 | UUID uid = (UUID) session.getAttribute("uid"); 16 | if (uid == null) { 17 | uid = UUID.randomUUID(); 18 | } 19 | session.setAttribute("uid", uid); 20 | return uid.toString(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-templates/src/main/resources/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Layout 6 | 7 | 8 | 9 |
10 | 13 | Hello 14 |

15 |
16 |
17 |
18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/java/demo/BookmarkClient.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient("bookmark-service") 11 | public interface BookmarkClient { 12 | 13 | @RequestMapping(method = RequestMethod.GET, value = "/{userId}/bookmarks") 14 | public Collection getBookmarks(@PathVariable("userId") String userId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/java/demo/ContactClient.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient("contact-service") 11 | public interface ContactClient { 12 | 13 | @RequestMapping(method = RequestMethod.GET, value = "/{userId}/contacts") 14 | Collection getContacts(@PathVariable("userId") String userId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/java/demo/ServiceDiscoveryApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 6 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 7 | 8 | @SpringBootApplication 9 | @EnableEurekaClient 10 | @EnableFeignClients 11 | public class ServiceDiscoveryApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(ServiceDiscoveryApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/java/demo/BookmarkClient.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.cloud.netflix.feign.FeignClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | @FeignClient("bookmark-service") 11 | public interface BookmarkClient { 12 | 13 | @RequestMapping(method = RequestMethod.GET, value = "/{userId}/bookmarks") 14 | Collection getBookmarks(@PathVariable("userId") String userId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/java/demo/BasicHttpsSecurityApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * This example is lifted from Dr. Dave Syer's example on microservice security. 10 | */ 11 | @SpringBootApplication 12 | public class BasicHttpsSecurityApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(BasicHttpsSecurityApplication.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudclient/src/main/java/demo/Application.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.core.env.Environment; 7 | 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | @Autowired 12 | void setEnvironment(Environment e) { 13 | System.out.println(e.getProperty("configuration.projectName")); 14 | } 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(Application.class, args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-metrics/src/main/java/demo/ExamplePublicMetrics.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Random; 6 | 7 | import org.springframework.boot.actuate.endpoint.PublicMetrics; 8 | import org.springframework.boot.actuate.metrics.Metric; 9 | import org.springframework.stereotype.Component; 10 | 11 | @Component 12 | public class ExamplePublicMetrics implements PublicMetrics { 13 | 14 | private final Random random = new Random(); 15 | 16 | @Override 17 | public Collection> metrics() { 18 | return Arrays.asList(new Metric<>("example.public", random.nextInt())); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/addGetHookIf.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | 3 | function addGetHookIf( conditionFn, hookFn ) { 4 | // Define the hook, we'll check on the first run if it's really needed. 5 | return { 6 | get: function() { 7 | if ( conditionFn() ) { 8 | // Hook not needed (or it's not possible to use it due 9 | // to missing dependency), remove it. 10 | delete this.get; 11 | return; 12 | } 13 | 14 | // Hook needed; redefine it so that the support test is not executed again. 15 | return (this.get = hookFn).apply( this, arguments ); 16 | } 17 | }; 18 | } 19 | 20 | return addGetHookIf; 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /livelessons-configuration/livelessons-configuration-cloudclient/src/main/java/demo/ProjectNameRestController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.cloud.context.config.annotation.RefreshScope; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | @RefreshScope 10 | public class ProjectNameRestController { 11 | 12 | @Value("${configuration.projectName}") 13 | private String projectName; 14 | 15 | @RequestMapping("/project-name") 16 | public String projectName() { 17 | return this.projectName; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/ajax/parseXML.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Cross-browser xml parsing 6 | jQuery.parseXML = function( data ) { 7 | var xml, tmp; 8 | if ( !data || typeof data !== "string" ) { 9 | return null; 10 | } 11 | 12 | // Support: IE9 13 | try { 14 | tmp = new DOMParser(); 15 | xml = tmp.parseFromString( data, "text/xml" ); 16 | } catch ( e ) { 17 | xml = undefined; 18 | } 19 | 20 | if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 21 | jQuery.error( "Invalid XML: " + data ); 22 | } 23 | return xml; 24 | }; 25 | 26 | return jQuery.parseXML; 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-basic-messaging/src/main/java/demo/Consumer.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 4 | import org.springframework.messaging.Message; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class Consumer { 9 | 10 | @RabbitListener(queues = MessagingApplication.NOTIFICATIONS) 11 | public void onNotification(Message notification) { 12 | System.out.println("received " + notification.toString()); 13 | System.out.println("received payload " + notification.getPayload()); 14 | System.out.println("received headers " + notification.getHeaders().toString()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/src/main/resources/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Layout 6 | 7 | 8 | 9 | 10 |
11 | 14 |

15 |
16 |
17 |
18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-extending/livelessons-extending-autoconfigure/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Auto-configuration 2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 3 | com.example.autoconfigure.modelmapper.ModelMapperAutoConfiguration 4 | 5 | # Listeners 6 | org.springframework.context.ApplicationListener=\ 7 | com.example.autoconfigure.listener.ExampleApplicationListener 8 | 9 | # Initializers 10 | org.springframework.context.ApplicationContextInitializer=\ 11 | com.example.autoconfigure.initializer.ExampleApplicationContextInitializer 12 | 13 | # Failure Analyzers 14 | org.springframework.boot.diagnostics.FailureAnalyzer=\ 15 | com.example.autoconfigure.failureanalyzer.ModelMapConfigurationFailureAnalyzer 16 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/src/main/java/demo/DataJdbcApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | @SpringBootApplication 9 | public class DataJdbcApplication { 10 | 11 | @Bean 12 | public CommandLineRunner exampleQuery(CarRepository repository) { 13 | return args -> repository.findByMakeIgnoringCase("HONDA") 14 | .forEach(System.err::println); 15 | } 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(DataJdbcApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-basic/src/main/java/basic/GreetingsRestController.java: -------------------------------------------------------------------------------- 1 | package basic; 2 | 3 | import java.security.Principal; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.UUID; 7 | 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | public class GreetingsRestController { 13 | 14 | @RequestMapping("/hi") 15 | public Map hi(Principal principal) { 16 | Map result = new HashMap<>(); 17 | result.put("id", UUID.randomUUID().toString()); 18 | result.put("content", "Hello, " + principal.getName()); 19 | return result; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-https/src/main/java/demo/GreetingsRestController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.security.Principal; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.UUID; 7 | 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | public class GreetingsRestController { 13 | 14 | @RequestMapping("/hi") 15 | public Map hi(Principal principal) { 16 | Map result = new HashMap<>(); 17 | result.put("id", UUID.randomUUID().toString()); 18 | result.put("content", "Hello, " + principal.getName()); 19 | return result; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/src/main/java/demo/DataFlywayApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | @SpringBootApplication 9 | public class DataFlywayApplication { 10 | 11 | @Bean 12 | public CommandLineRunner exampleQuery(CarRepository repository) { 13 | return args -> repository.findByMakeIgnoringCase("HONDA") 14 | .forEach(System.err::println); 15 | } 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(DataFlywayApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/src/main/java/demo/CarRepository.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.jdbc.core.JdbcTemplate; 6 | import org.springframework.stereotype.Repository; 7 | 8 | @Repository 9 | public class CarRepository { 10 | 11 | private final JdbcTemplate jdbc; 12 | 13 | public CarRepository(JdbcTemplate jdbc) { 14 | this.jdbc = jdbc; 15 | } 16 | 17 | public List findByMakeIgnoringCase(String make) { 18 | return this.jdbc.query( 19 | "select * from car " + "where UPPER(car.make) = UPPER(?) order by id", 20 | (rs, i) -> new Car(rs.getInt("id"), rs.getString("make"), 21 | rs.getString("model"), rs.getInt("year")), 22 | make); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/queue/delay.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../queue", 4 | "../effects" // Delay is optional because of this dependency 5 | ], function( jQuery ) { 6 | 7 | // Based off of the plugin by Clint Helfers, with permission. 8 | // http://blindsignals.com/index.php/2009/07/jquery-delay/ 9 | jQuery.fn.delay = function( time, type ) { 10 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 11 | type = type || "fx"; 12 | 13 | return this.queue( type, function( next, hooks ) { 14 | var timeout = setTimeout( next, time ); 15 | hooks.stop = function() { 16 | clearTimeout( timeout ); 17 | }; 18 | }); 19 | }; 20 | 21 | return jQuery.fn.delay; 22 | }); 23 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-cloud-monitoring/src/main/java/demo/ExampleHealthIndicator.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.actuate.health.AbstractHealthIndicator; 4 | import org.springframework.boot.actuate.health.Health.Builder; 5 | import org.springframework.boot.actuate.health.Status; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ExampleHealthIndicator extends AbstractHealthIndicator { 10 | 11 | private boolean up = true; 12 | 13 | public void setUp(boolean up) { 14 | this.up = up; 15 | } 16 | 17 | @Override 18 | protected void doHealthCheck(Builder builder) throws Exception { 19 | builder.status(this.up ? Status.UP : Status.DOWN); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/src/main/java/demo/Car.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Car { 4 | 5 | private long id; 6 | 7 | private String make; 8 | 9 | private String model; 10 | 11 | private int year; 12 | 13 | Car(long id, String make, String model, int year) { 14 | this.id = id; 15 | this.make = make; 16 | this.model = model; 17 | this.year = year; 18 | } 19 | 20 | long getId() { 21 | return id; 22 | } 23 | 24 | public String getMake() { 25 | return make; 26 | } 27 | 28 | public String getModel() { 29 | return model; 30 | } 31 | 32 | public int getYear() { 33 | return year; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return make + " " + model + " " + year; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/CircuitBreakerApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 7 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 8 | 9 | @SpringBootApplication 10 | @EnableEurekaClient 11 | @EnableFeignClients 12 | @EnableCircuitBreaker 13 | public class CircuitBreakerApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(CircuitBreakerApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources-angular/src/main/java/demo/ToDo.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | 6 | public class ToDo { 7 | 8 | @JsonProperty("_id") 9 | private int id; 10 | 11 | private final String text; 12 | 13 | @JsonCreator 14 | public ToDo(@JsonProperty("text") String text) { 15 | this.text = text; 16 | } 17 | 18 | private ToDo(String text, int id) { 19 | this.text = text; 20 | this.id = id; 21 | } 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public String getText() { 28 | return this.text; 29 | } 30 | 31 | public ToDo withId(int id) { 32 | return new ToDo(this.text, id); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/css/swap.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // A method for quickly swapping in/out CSS properties to get correct calculations. 6 | jQuery.swap = function( elem, options, callback, args ) { 7 | var ret, name, 8 | old = {}; 9 | 10 | // Remember the old values, and insert the new ones 11 | for ( name in options ) { 12 | old[ name ] = elem.style[ name ]; 13 | elem.style[ name ] = options[ name ]; 14 | } 15 | 16 | ret = callback.apply( elem, args || [] ); 17 | 18 | // Revert the old values 19 | for ( name in options ) { 20 | elem.style[ name ] = old[ name ]; 21 | } 22 | 23 | return ret; 24 | }; 25 | 26 | return jQuery.swap; 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-metadata/src/main/java/demo/Application.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 6 | 7 | @SpringBootApplication 8 | @EnableConfigurationProperties(MyProperties.class) 9 | public class Application { 10 | 11 | public Application(MyProperties properties) { 12 | System.out.println(properties.getAddress()); 13 | System.out.println(properties.getPort()); 14 | System.out.println(properties.getType()); 15 | } 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(Application.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/public/bower.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LiveLessons - Bower 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

LiveLessons

13 |

Bower

14 |

Spring Boot

15 |
16 |
17 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-templates/src/main/java/demo/WebTemplatesApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 7 | 8 | @SpringBootApplication 9 | public class WebTemplatesApplication extends WebMvcConfigurerAdapter { 10 | 11 | @Override 12 | public void addViewControllers(ViewControllerRegistry registry) { 13 | registry.addViewController("/").setViewName("index"); 14 | } 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(WebTemplatesApplication.class, args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/public/webjars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LiveLessons - WebJars 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

LiveLessons

13 |

WebJars

14 |

Spring Boot

15 |
16 |
17 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-eai/src/main/java/demo/EchoServiceApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.integration.annotation.IntegrationComponentScan; 6 | import org.springframework.integration.config.EnableIntegration; 7 | 8 | /** 9 | * the goal here is to demonstrate that Spring Integration can act as a processor for a 10 | * lot of different types of services. 11 | */ 12 | @SpringBootApplication 13 | @EnableIntegration 14 | @IntegrationComponentScan 15 | public class EchoServiceApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(EchoServiceApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator-extensions/src/main/java/demo/WeatherMvcEndpoint.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter; 4 | import org.springframework.http.MediaType; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | @Component 10 | public class WeatherMvcEndpoint extends EndpointMvcAdapter { 11 | 12 | public WeatherMvcEndpoint() { 13 | super(new WeatherEndpoint()); 14 | } 15 | 16 | @RequestMapping(produces = MediaType.TEXT_HTML_VALUE) 17 | @ResponseBody 18 | public String invokeHtml() { 19 | return "

" + getDelegate().invoke() + "

"; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-rest/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-rest 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-rest-basic 18 | livelessons-rest-errors 19 | 20 | 21 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/jquery.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "./selector", 4 | "./traversing", 5 | "./callbacks", 6 | "./deferred", 7 | "./core/ready", 8 | "./data", 9 | "./queue", 10 | "./queue/delay", 11 | "./attributes", 12 | "./event", 13 | "./event/alias", 14 | "./manipulation", 15 | "./manipulation/_evalUrl", 16 | "./wrap", 17 | "./css", 18 | "./css/hiddenVisibleSelectors", 19 | "./serialize", 20 | "./ajax", 21 | "./ajax/xhr", 22 | "./ajax/script", 23 | "./ajax/jsonp", 24 | "./ajax/load", 25 | "./event/ajax", 26 | "./effects", 27 | "./effects/animatedSelector", 28 | "./offset", 29 | "./dimensions", 30 | "./deprecated", 31 | "./exports/amd", 32 | "./exports/global" 33 | ], function( jQuery ) { 34 | 35 | return jQuery; 36 | 37 | }); 38 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/PassportRestController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.PathVariable; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | class PassportRestController { 9 | 10 | private final IntegrationClient integrationClient; 11 | 12 | public PassportRestController(IntegrationClient integrationClient) { 13 | this.integrationClient = integrationClient; 14 | } 15 | 16 | @RequestMapping("/{userId}/passport") 17 | Passport passport(@PathVariable String userId) { 18 | return new Passport(userId, this.integrationClient.getContacts(userId), 19 | this.integrationClient.getBookmarks(userId)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-redis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-data 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-data-redis 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-redis 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-metrics/src/main/java/demo/OperationsMetricsApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.actuate.metrics.rich.InMemoryRichGaugeRepository; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Primary; 8 | 9 | @SpringBootApplication 10 | public class OperationsMetricsApplication { 11 | 12 | @Bean 13 | @Primary 14 | public InMemoryRichGaugeRepository inMemoryRichGaugeRepository() { 15 | return new InMemoryRichGaugeRepository(); 16 | } 17 | 18 | public static void main(String[] args) { 19 | SpringApplication.run(OperationsMetricsApplication.class, args); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-testing/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-testing 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-testing-spring 18 | livelessons-testing-wiremock 19 | 20 | 21 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-gradle/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { springBootVersion = '1.4.1.RELEASE' } 3 | repositories { mavenCentral() } 4 | dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } 5 | } 6 | 7 | apply plugin: 'java' 8 | apply plugin: 'eclipse' 9 | apply plugin: 'idea' 10 | apply plugin: 'spring-boot' 11 | 12 | jar { 13 | baseName = 'livelessons-bootstrap-gradle' 14 | version = '0.0.1-SNAPSHOT' 15 | } 16 | 17 | sourceCompatibility = 1.8 18 | targetCompatibility = 1.8 19 | 20 | repositories { mavenCentral() } 21 | 22 | 23 | dependencies { 24 | compile("org.springframework.boot:spring-boot-starter-web") 25 | testCompile("org.springframework.boot:spring-boot-starter-test") 26 | } 27 | 28 | task wrapper(type: Wrapper) { gradleVersion = '1.12' } 29 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-mongodb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-data 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-data-mongodb 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-data-mongodb 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-rest/src/main/java/demo/DataRestApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.beans.factory.InitializingBean; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | @SpringBootApplication 9 | public class DataRestApplication { 10 | 11 | @Bean 12 | InitializingBean seedDatabase(CarRepository repository) { 13 | return () -> { 14 | repository.save(new Car("Honda", "Civic", 1997)); 15 | repository.save(new Car("Honda", "Accord", 2003)); 16 | repository.save(new Car("Ford", "Escort", 1985)); 17 | }; 18 | } 19 | 20 | public static void main(String[] args) { 21 | SpringApplication.run(DataRestApplication.class, args); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-redis/src/main/java/demo/DataRedisApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.data.redis.cache.RedisCacheManager; 8 | import org.springframework.data.redis.core.StringRedisTemplate; 9 | 10 | @SpringBootApplication 11 | @EnableCaching 12 | public class DataRedisApplication { 13 | 14 | @Bean 15 | RedisCacheManager cacheManager(StringRedisTemplate template) { 16 | return new RedisCacheManager(template); 17 | } 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(DataRedisApplication.class, args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jpa/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 4: Working With Data (Relational Database with JPA) 3 | 4 | == Introduction 5 | This example shows how you can access a classic relational database using Spring Data 6 | and JPA. 7 | 8 | == Building and running the sample 9 | Use the following commands to build run the application: 10 | 11 | ``` 12 | $ mvn clean package 13 | $ java -jar target/livelessons-data-jpa-1.0.0-SNAPSHOT.jar 14 | ``` 15 | 16 | == Understanding the code 17 | This demo uses an embedded database to store data. The `Car` class provides the basic 18 | entity and the `CarRepository` interface provides access. Notice that the 19 | `findByMakeIgnoringCase` method is all that is needed to create the OQL query. 20 | 21 | When the application starts mock data is added and then a single query is executed. 22 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix-dashboard-service/src/main/java/demo/HystrixDashboardApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | @Controller 10 | @EnableHystrixDashboard 11 | @SpringBootApplication 12 | public class HystrixDashboardApplication { 13 | 14 | @RequestMapping("/") 15 | public String home() { 16 | return "forward:/hystrix/index.html"; 17 | } 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(HystrixDashboardApplication.class, args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-elasticsearch/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-data 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-data-elasticsearch 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-data-elasticsearch 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-basic-messaging/src/main/java/demo/Notification.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class Notification implements Serializable { 7 | 8 | private String id; 9 | 10 | private final String message; 11 | 12 | private final Date date; 13 | 14 | public Notification(String id, String message, Date date) { 15 | this.message = message; 16 | this.id = id; 17 | this.date = date; 18 | } 19 | 20 | public String getId() { 21 | return id; 22 | } 23 | 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | public Date getDate() { 29 | return date; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "Notification{" + "message='" + message + '\'' + ", date=" + date + '}'; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-logging/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-operations 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-operations-logging 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-cloud-monitoring/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class ExampleController { 8 | 9 | private final ExampleHealthIndicator indicator; 10 | 11 | public ExampleController(ExampleHealthIndicator indicator) { 12 | this.indicator = indicator; 13 | } 14 | 15 | @RequestMapping("/") 16 | public String hello() { 17 | return "Hello World!"; 18 | } 19 | 20 | @RequestMapping("/up") 21 | public String up() { 22 | this.indicator.setUp(true); 23 | return "now up"; 24 | } 25 | 26 | @RequestMapping("/down") 27 | public String down() { 28 | this.indicator.setUp(false); 29 | return "now down"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | debug: 2 | security: 3 | user: 4 | password: password 5 | zuul: 6 | routes: 7 | resource: 8 | path: /resource/** 9 | url: http://localhost:9000 10 | user: 11 | path: /user/** 12 | url: http://localhost:9999/uaa/user 13 | security: 14 | oauth2: 15 | sso: 16 | home: 17 | secure: false 18 | path: /,/**/*.html 19 | client: 20 | accessTokenUri: http://localhost:9999/uaa/oauth/token 21 | userAuthorizationUri: http://localhost:9999/uaa/oauth/authorize 22 | clientId: acme 23 | clientSecret: acmesecret 24 | resource: 25 | userInfoUri: http://localhost:9999/uaa/user 26 | 27 | logging: 28 | level: 29 | org.springframework.security: DEBUG 30 | org.springframework.web: DEBUG 31 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-eai/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Time over WebSocket 5 | 6 | 18 | 19 | 20 |
Starting...
21 | 22 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/src/exports/global.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../var/strundefined" 4 | ], function( jQuery, strundefined ) { 5 | 6 | var 7 | // Map over jQuery in case of overwrite 8 | _jQuery = window.jQuery, 9 | 10 | // Map over the $ in case of overwrite 11 | _$ = window.$; 12 | 13 | jQuery.noConflict = function( deep ) { 14 | if ( window.$ === jQuery ) { 15 | window.$ = _$; 16 | } 17 | 18 | if ( deep && window.jQuery === jQuery ) { 19 | window.jQuery = _jQuery; 20 | } 21 | 22 | return jQuery; 23 | }; 24 | 25 | // Expose jQuery and $ identifiers, even in AMD 26 | // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 27 | // and CommonJS for browser emulators (#13566) 28 | if ( typeof noGlobal === strundefined ) { 29 | window.jQuery = window.$ = jQuery; 30 | } 31 | 32 | }); 33 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/java/demo/Person.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | 7 | @Entity 8 | public class Person { 9 | 10 | @Id 11 | @GeneratedValue 12 | private Long id; 13 | 14 | private String name; 15 | 16 | private String email; 17 | 18 | Person() { 19 | } 20 | 21 | public Person(String name, String email) { 22 | this.name = name; 23 | this.email = email; 24 | } 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public String getEmail() { 35 | return email; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Person{" + "id=" + id + ", name='" + name + '\'' + ", email='" + email 41 | + '\'' + '}'; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jpa/src/main/java/demo/Car.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | 7 | @Entity 8 | public class Car { 9 | 10 | @Id 11 | @GeneratedValue 12 | private long id; 13 | 14 | private String make; 15 | 16 | private String model; 17 | 18 | private int year; 19 | 20 | Car() { 21 | } 22 | 23 | public Car(String make, String model, int year) { 24 | super(); 25 | this.make = make; 26 | this.model = model; 27 | this.year = year; 28 | } 29 | 30 | public String getMake() { 31 | return make; 32 | } 33 | 34 | public String getModel() { 35 | return model; 36 | } 37 | 38 | public int getYear() { 39 | return year; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return make + " " + model + " " + year; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-rest/src/main/java/demo/Car.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | 7 | @Entity 8 | public class Car { 9 | 10 | @Id 11 | @GeneratedValue 12 | private long id; 13 | 14 | private String make; 15 | 16 | private String model; 17 | 18 | private int year; 19 | 20 | Car() { 21 | } 22 | 23 | public Car(String make, String model, int year) { 24 | super(); 25 | this.make = make; 26 | this.model = model; 27 | this.year = year; 28 | } 29 | 30 | public String getMake() { 31 | return make; 32 | } 33 | 34 | public String getModel() { 35 | return model; 36 | } 37 | 38 | public int getYear() { 39 | return year; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return make + " " + model + " " + year; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-basic/src/main/java/demo/Application.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.springframework.boot.CommandLineRunner; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | @SpringBootApplication 11 | public class Application { 12 | 13 | @Bean 14 | CommandLineRunner commandLineRunner(PersonRepository personRepository) { 15 | return args -> { 16 | Arrays.asList("Phil", "Josh").forEach(name -> personRepository 17 | .save(new Person(name, (name + "@email.com").toLowerCase()))); 18 | personRepository.findAll().forEach(System.out::println); 19 | }; 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(Application.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-autoconfiguration/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-bootstrap 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-bootstrap-autoconfiguration 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | provided 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-basic/src/main/java/demo/Person.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | 7 | @Entity 8 | public class Person { 9 | 10 | @Id 11 | @GeneratedValue 12 | private Long id; 13 | 14 | private String name; 15 | 16 | private String email; 17 | 18 | Person() { 19 | } 20 | 21 | public Person(String name, String email) { 22 | this.name = name; 23 | this.email = email; 24 | } 25 | 26 | public Long getId() { 27 | return this.id; 28 | } 29 | 30 | public String getName() { 31 | return this.name; 32 | } 33 | 34 | public String getEmail() { 35 | return this.email; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Person{" + "id=" + id + ", name='" + name + '\'' + ", email='" + email 41 | + '\'' + '}'; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/java/demo/Application.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.springframework.boot.CommandLineRunner; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | @SpringBootApplication 11 | public class Application { 12 | 13 | @Bean 14 | public CommandLineRunner commandLineRunner(PersonRepository personRepository) { 15 | return args -> { 16 | Arrays.asList("Phil", "Josh").forEach(name -> personRepository 17 | .save(new Person(name, (name + "@email.com").toLowerCase()))); 18 | personRepository.findAll().forEach(System.out::println); 19 | }; 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(Application.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /livelessons-extending/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-extending 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-extending-dependencies 18 | livelessons-extending-autoconfigure 19 | livelessons-extending-sample 20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-metrics/src/main/java/demo/ExampleService.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Random; 4 | 5 | import org.springframework.boot.actuate.metrics.CounterService; 6 | import org.springframework.boot.actuate.metrics.GaugeService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class ExampleService { 11 | 12 | private final Random random = new Random(); 13 | 14 | private final CounterService counterService; 15 | 16 | private final GaugeService gaugeService; 17 | 18 | public ExampleService(CounterService counterService, GaugeService gaugeService) { 19 | this.counterService = counterService; 20 | this.gaugeService = gaugeService; 21 | } 22 | 23 | public void call() { 24 | this.counterService.increment("example.counter"); 25 | this.gaugeService.submit("example.gauge", this.random.nextDouble()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /livelessons-bootstrap/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-bootstrap 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-bootstrap-maven 18 | livelessons-bootstrap-autoconfiguration 19 | livelessons-bootstrap-autoconfiguration-jetty 20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-configuration/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-configuration 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-configuration-basic 18 | livelessons-configuration-cloudclient 19 | livelessons-configuration-cloudserver 20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/java/demo/FeignExample.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.core.annotation.Order; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Order(3) 8 | @Component 9 | public class FeignExample implements CommandLineRunner { 10 | 11 | private final ContactClient contactClient; 12 | 13 | private final BookmarkClient bookmarkClient; 14 | 15 | public FeignExample(ContactClient contactClient, BookmarkClient bookmarkClient) { 16 | this.contactClient = contactClient; 17 | this.bookmarkClient = bookmarkClient; 18 | } 19 | 20 | @Override 21 | public void run(String... strings) throws Exception { 22 | this.bookmarkClient.getBookmarks("jlong").forEach(System.out::println); 23 | this.contactClient.getContacts("jlong").forEach(System.out::println); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-ui/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello AngularJS 5 | 8 | 13 | 14 | 15 | 16 |
17 | 22 |
23 |
24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-ide-and-tooling 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-ide-and-tooling-devtools 18 | livelessons-ide-and-tooling-metadata 19 | livelessons-ide-and-tooling-initializr 20 | 21 | 22 | -------------------------------------------------------------------------------- /livelessons-web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-web 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-web-resources 18 | livelessons-web-resources-angular 19 | livelessons-web-templates 20 | livelessons-web-transforms 21 | 22 | 23 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/java/demo/Bookmark.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Bookmark { 4 | 5 | private Long id; 6 | 7 | private String href; 8 | 9 | private String label; 10 | 11 | private String description; 12 | 13 | private String userId; 14 | 15 | public Bookmark() { 16 | } 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public String getHref() { 23 | return href; 24 | } 25 | 26 | public String getLabel() { 27 | return label; 28 | } 29 | 30 | public String getDescription() { 31 | return description; 32 | } 33 | 34 | public String getUserId() { 35 | return userId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Bookmark{" + "id=" + id + ", href='" + href + '\'' + ", label='" + label 41 | + '\'' + ", description='" + description + '\'' + ", userId='" + userId 42 | + '\'' + '}'; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/Bookmark.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Bookmark { 4 | 5 | private Long id; 6 | 7 | private String href; 8 | 9 | private String label; 10 | 11 | private String description; 12 | 13 | private String userId; 14 | 15 | public Bookmark() { 16 | } 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public String getHref() { 23 | return href; 24 | } 25 | 26 | public String getLabel() { 27 | return label; 28 | } 29 | 30 | public String getDescription() { 31 | return description; 32 | } 33 | 34 | public String getUserId() { 35 | return userId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Bookmark{" + "id=" + id + ", href='" + href + '\'' + ", label='" + label 41 | + '\'' + ", description='" + description + '\'' + ", userId='" + userId 42 | + '\'' + '}'; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 4: Working With Data (Flyway Migration) 3 | 4 | == Introduction 5 | This example shows how you can use flyway to upgrade a live database. 6 | 7 | == Building and running the sample 8 | Use the following commands to build run the application: 9 | 10 | ``` 11 | $ mvn clean package 12 | $ java -jar target/livelessons-flyway-1.0.0-SNAPSHOT.jar 13 | ``` 14 | 15 | == Understanding the code 16 | Building on the earlier JPA example this demo shows how a new `color` column could be 17 | added to the database. The additional `flyway` dependency in the `pom.xml` along with 18 | scripts in `src/main/db/migration` is all that's needed. 19 | 20 | Two scripts are provided. The first creates the initial structure and the second upgrades 21 | it. Flyway adds an additional meta-table that tracks when an update has been applied and 22 | prevents it from running multiple times. 23 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jpa/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-data 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-data-jpa 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-data-jpa 18 | 19 | 20 | com.h2database 21 | h2 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/java/demo/Bookmark.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Bookmark { 4 | 5 | private Long id; 6 | 7 | private String href; 8 | 9 | private String label; 10 | 11 | private String description; 12 | 13 | private String userId; 14 | 15 | public Bookmark() { 16 | } 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public String getHref() { 23 | return href; 24 | } 25 | 26 | public String getLabel() { 27 | return label; 28 | } 29 | 30 | public String getDescription() { 31 | return description; 32 | } 33 | 34 | public String getUserId() { 35 | return userId; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Bookmark{" + "id=" + id + ", href='" + href + '\'' + ", label='" + label 41 | + '\'' + ", description='" + description + '\'' + ", userId='" + userId 42 | + '\'' + '}'; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/Passport.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | class Passport { 6 | 7 | private String userId; 8 | 9 | private Collection bookmarks; 10 | 11 | private Collection contacts; 12 | 13 | public Passport(String userId, Collection contacts, 14 | Collection bookmarks) { 15 | this.userId = userId; 16 | this.contacts = contacts; 17 | this.bookmarks = bookmarks; 18 | } 19 | 20 | public String getUserId() { 21 | return userId; 22 | } 23 | 24 | public Collection getContacts() { 25 | return contacts; 26 | } 27 | 28 | public Collection getBookmarks() { 29 | return bookmarks; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "Passport{" + "userId='" + userId + '\'' + ", bookmarks=" + bookmarks 35 | + ", contacts=" + contacts + '}'; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/java/demo/Passport.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import java.util.Collection; 4 | 5 | public class Passport { 6 | 7 | private String userId; 8 | 9 | private Collection contacts; 10 | 11 | private Collection bookmarks; 12 | 13 | public Passport(String userId, Collection contacts, 14 | Collection bookmarks) { 15 | this.userId = userId; 16 | this.contacts = contacts; 17 | this.bookmarks = bookmarks; 18 | } 19 | 20 | public String getUserId() { 21 | return userId; 22 | } 23 | 24 | public Collection getContacts() { 25 | return contacts; 26 | } 27 | 28 | public Collection getBookmarks() { 29 | return bookmarks; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "Passport{" + "userId='" + userId + '\'' + ", bookmarks=" + bookmarks 35 | + ", contacts=" + contacts + '}'; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-connectors/src/main/java/demo/ExampleController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.cloud.app.ApplicationInstanceInfo; 4 | import org.springframework.jdbc.core.JdbcTemplate; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class ExampleController { 10 | 11 | private final JdbcTemplate jdbc; 12 | 13 | private final ApplicationInstanceInfo info; 14 | 15 | public ExampleController(JdbcTemplate jdbc, ApplicationInstanceInfo info) { 16 | this.jdbc = jdbc; 17 | this.info = info; 18 | } 19 | 20 | @RequestMapping("/") 21 | public String hello() { 22 | return this.jdbc.queryForObject("select model from car where id = 1", 23 | String.class); 24 | } 25 | 26 | @RequestMapping("/cloudinfo") 27 | public ApplicationInstanceInfo info() { 28 | return this.info; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-elasticsearch/src/main/java/demo/Car.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.data.annotation.Id; 4 | import org.springframework.data.elasticsearch.annotations.Document; 5 | 6 | @Document(indexName = "car", type = "car", shards = 1, replicas = 0, refreshInterval = "-1") 7 | public class Car { 8 | 9 | @Id 10 | private Long id; 11 | 12 | private String make; 13 | 14 | private String model; 15 | 16 | private int year; 17 | 18 | Car() { 19 | } 20 | 21 | public Car(String make, String model, int year) { 22 | super(); 23 | this.make = make; 24 | this.model = model; 25 | this.year = year; 26 | } 27 | 28 | public String getMake() { 29 | return make; 30 | } 31 | 32 | public String getModel() { 33 | return model; 34 | } 35 | 36 | public int getYear() { 37 | return year; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return make + " " + model + " " + year; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-batch/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-integration 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-integration-batch 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-batch 18 | 19 | 20 | com.h2database 21 | h2 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-heroku/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 3: Reaching For The Clouds (Heroku) 3 | 4 | == Introduction 5 | This example shows how you can push a Spring Boot application to Heroku. You 6 | will need a https://heroku.com/[Heroku account] and the 7 | https://devcenter.heroku.com/articles/getting-started-with-java#set-up[`heroku` command 8 | line toolbelt] installed. This sample uses the `heroku-maven-plugin` to directly push 9 | the build application jar. 10 | 11 | == Prerequisites 12 | Ensure that you have logged into Heroku and created an application: 13 | 14 | ``` 15 | $ heroku login 16 | $ heroku create -n 17 | ``` 18 | 19 | You will need the name of the created application later. 20 | 21 | == Pushing to Heroku 22 | To build an push the application use the following command: 23 | 24 | ``` 25 | $ mvn clean package heroku:deploy -Dheroku.appName= 26 | ``` 27 | 28 | NOTE: The upload to Heroku can take some time to complete. 29 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/src/main/resources/static/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "2.1.3", 4 | "main": "dist/jquery.js", 5 | "license": "MIT", 6 | "ignore": [ 7 | "**/.*", 8 | "build", 9 | "speed", 10 | "test", 11 | "*.md", 12 | "AUTHORS.txt", 13 | "Gruntfile.js", 14 | "package.json" 15 | ], 16 | "devDependencies": { 17 | "sizzle": "2.1.1-jquery.2.1.2", 18 | "requirejs": "2.1.10", 19 | "qunit": "1.14.0", 20 | "sinon": "1.8.1" 21 | }, 22 | "keywords": [ 23 | "jquery", 24 | "javascript", 25 | "library" 26 | ], 27 | "homepage": "https://github.com/jquery/jquery", 28 | "_release": "2.1.3", 29 | "_resolution": { 30 | "type": "version", 31 | "tag": "2.1.3", 32 | "commit": "8f2a9d9272d6ed7f32d3a484740ab342c02541e0" 33 | }, 34 | "_source": "git://github.com/jquery/jquery.git", 35 | "_target": "~2.1.3", 36 | "_originalSource": "jquery" 37 | } -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-basic/src/main/java/demo/PersonResourceProcessor.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.hateoas.Link; 4 | import org.springframework.hateoas.Resource; 5 | import org.springframework.hateoas.ResourceProcessor; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.web.servlet.support.ServletUriComponentsBuilder; 8 | import org.springframework.web.util.UriComponents; 9 | 10 | @Component 11 | public class PersonResourceProcessor implements ResourceProcessor> { 12 | 13 | @Override 14 | public Resource process(Resource resource) { 15 | String id = Long.toString(resource.getContent().getId()); 16 | UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentContextPath() 17 | .path("/people/{id}/photo").buildAndExpand(id); 18 | String uri = uriComponents.toUriString(); 19 | resource.add(new Link(uri, "photo")); 20 | return resource; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /livelessons-rest/livelessons-rest-errors/src/main/java/demo/PersonResourceProcessor.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.hateoas.Link; 4 | import org.springframework.hateoas.Resource; 5 | import org.springframework.hateoas.ResourceProcessor; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.web.servlet.support.ServletUriComponentsBuilder; 8 | import org.springframework.web.util.UriComponents; 9 | 10 | @Component 11 | public class PersonResourceProcessor implements ResourceProcessor> { 12 | 13 | @Override 14 | public Resource process(Resource resource) { 15 | String id = Long.toString(resource.getContent().getId()); 16 | UriComponents uriComponents = ServletUriComponentsBuilder.fromCurrentContextPath() 17 | .path("/people/{id}/photo").buildAndExpand(id); 18 | String uri = uriComponents.toUriString(); 19 | resource.add(new Link(uri, "photo")); 20 | return resource; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-web 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-web-resources 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.webjars 21 | jquery 22 | 2.1.1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-templates/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-web 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-web-templates 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-thymeleaf 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-transforms/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-web 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-web-transforms 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-thymeleaf 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-cloud/livelessons-cloud-cloudfoundry/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-cloud 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-cloud-cloudfoundry 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-actuator 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-spring/src/main/java/demo/domain/UserRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package demo.domain; 18 | 19 | import org.springframework.data.repository.Repository; 20 | 21 | public interface UserRepository extends Repository { 22 | 23 | User findByUsername(String username); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-metrics/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-operations 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-operations-metrics 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-actuator 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-wiremock/src/main/java/demo/service/VehicleDetailsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package demo.service; 18 | 19 | public interface VehicleDetailsService { 20 | 21 | VehicleDetails getVehicleDetails(VehicleIdentificationNumber vin) 22 | throws VehicleIdentificationNumberNotFoundException; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /livelessons-extending/livelessons-extending-sample/src/main/java/demo/mapper/Customer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package demo.mapper; 18 | 19 | public class Customer { 20 | 21 | private Name name; 22 | 23 | public Name getName() { 24 | return this.name; 25 | } 26 | 27 | public void setName(Name name) { 28 | this.name = name; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-batch/src/main/java/demo/BatchApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * This demonstrates the Spring Batch Java configuration DSL. Spring Batch automatically 9 | * runs jobs that are in the context for you (the poster example for the 10 | * {@link org.springframework.boot.CommandLineRunner}. Spring Batch emits events (via the 11 | * usual Spring {@link org.springframework.context.ApplicationEventPublisher} mechanism) 12 | * when a Spring Batch {@link org.springframework.batch.core.Job} is finished executing. 13 | */ 14 | @SpringBootApplication 15 | @EnableBatchProcessing 16 | public class BatchApplication { 17 | 18 | public static void main(String[] args) { 19 | SpringApplication.run(BatchApplication.class, args); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-cloud-monitoring/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-operations 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-operations-cloud-monitoring 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-actuator 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-rest/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 4: Working With Data (Spring Data REST) 3 | 4 | == Introduction 5 | This example shows how you can expose a Spring Data Repoistory over REST. 6 | 7 | == Building and running the sample 8 | Use the following commands to build run the application: 9 | 10 | ``` 11 | $ mvn clean package 12 | $ java -jar target/livelessons-data-rest-1.0.0-SNAPSHOT.jar 13 | ``` 14 | 15 | == Understanding the code 16 | This is exactly the same code as the JPA example, except we have an additional 17 | `spring-boot-starter-data-rest` dependency. The `CarRepository` also includes a couple 18 | of new annotations. The `@RestResource(path="find")` provides a nicer name for the search 19 | URL and `@Param("make")` is used to indicate the name of the query parameter. 20 | 21 | Once running you can open a browser to http://localhost:8080/cars to navigate the 22 | elements. To perform a search you can use URLs in the form 23 | http://localhost:8080/cars/search/find?make=honda. 24 | -------------------------------------------------------------------------------- /livelessons-operations/livelessons-operations-actuator-extensions/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-operations 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-operations-actuator-extensions 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-actuator 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /livelessons-edge/livelessons-edge-eureka-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-edge 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-edge-eureka-service 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.cloud 17 | spring-cloud-starter-eureka-server 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-test 23 | test 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /livelessons-bootstrap/livelessons-bootstrap-autoconfiguration/src/main/java/demo/LogTomcatVersionAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.annotation.PostConstruct; 4 | 5 | import org.apache.catalina.startup.Tomcat; 6 | import org.apache.commons.logging.Log; 7 | import org.apache.commons.logging.LogFactory; 8 | 9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 11 | import org.springframework.context.annotation.Configuration; 12 | 13 | @Configuration 14 | @ConditionalOnClass(Tomcat.class) 15 | @ConditionalOnProperty(name = "log-tomcat-version", matchIfMissing = true) 16 | public class LogTomcatVersionAutoConfiguration { 17 | 18 | private static Log logger = LogFactory 19 | .getLog(LogTomcatVersionAutoConfiguration.class); 20 | 21 | @PostConstruct 22 | public void logTomcatVersion() { 23 | logger.info("\n\n\nTomcat v" 24 | + Tomcat.class.getPackage().getImplementationVersion() + "\n\n"); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /livelessons-web/livelessons-web-resources-angular/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 9: Developing Web Applications (Resources) 3 | 4 | == Introduction 5 | Takes https://scotch.io/tutorials/creating-a-single-page-todo-app-with-node-and-angular[a popular TODO tutorial] 6 | and serves it from Spring Boot. 7 | 8 | == Building and running the sample 9 | Use the following commands to build run the application: 10 | 11 | ``` 12 | $ mvn clean package 13 | $ java -jar target/livelessons-web-resources-angular-1.0.0-SNAPSHOT.jar 14 | ``` 15 | 16 | == Understanding the code 17 | Angular and Bootstrap are served from WebJars and the application JavaScript source is 18 | contained in `src/main/resources/static`. 19 | 20 | This example also shows how you can call a rest service from Angular. This is fairly 21 | typical in a microservice where the rich web application calls a REST edge service which 22 | ultimately coordinates different microservices. In this example we just call a dummy 23 | endpoint which has been mocked up in the `ToDoController` class. 24 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/src/main/java/demo/Car.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | 7 | @Entity 8 | public class Car { 9 | 10 | @Id 11 | @GeneratedValue 12 | private long id; 13 | 14 | private String make; 15 | 16 | private String model; 17 | 18 | private int year; 19 | 20 | private String color; 21 | 22 | Car() { 23 | } 24 | 25 | public Car(String make, String model, int year, String color) { 26 | super(); 27 | this.make = make; 28 | this.model = model; 29 | this.year = year; 30 | this.color = color; 31 | } 32 | 33 | public String getMake() { 34 | return make; 35 | } 36 | 37 | public String getModel() { 38 | return model; 39 | } 40 | 41 | public int getYear() { 42 | return year; 43 | } 44 | 45 | public String getColor() { 46 | return color; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return make + " " + model + " " + year + " " + this.color; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-mongodb/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 4: Working With Data (MongoDB) 3 | 4 | == Introduction 5 | This example shows how you can use the MongoDB document store. 6 | 7 | == Building and running the sample 8 | Use the following commands to build run the application: 9 | 10 | ``` 11 | $ mvn clean package 12 | $ java -jar target/livelessons-data-mongodb-1.0.0-SNAPSHOT.jar 13 | ``` 14 | 15 | == Understanding the code 16 | The same domain to the JPA sample is used with this demo. Rather than being a `@Entity` 17 | the `Car` here is a `@Document`. It has also been updated with a `position` (the 18 | geo-location where the car is stored). 19 | 20 | The `CarRepository` works in the same way as any Spring Data repository and has the 21 | familiar `findByMakeIgnoringCase` method. The demo also includes a `findByPositionNear` 22 | method which shows how you can use MongoDB's geo features. 23 | 24 | The `DataMongoDBApplication` show how queries are executed and how you can also use 25 | MongoDB's GridFS to store blob data. 26 | -------------------------------------------------------------------------------- /livelessons-data/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-data 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-data-jpa 18 | livelessons-data-jdbc 19 | livelessons-data-flyway 20 | livelessons-data-redis 21 | livelessons-data-mongodb 22 | livelessons-data-elasticsearch 23 | livelessons-data-rest 24 | 25 | 26 | -------------------------------------------------------------------------------- /livelessons-ide-and-tooling/livelessons-ide-and-tooling-metadata/src/main/java/demo/MyProperties.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties(prefix = "myapp") 6 | public class MyProperties { 7 | 8 | /** 9 | * The remote address. 10 | */ 11 | private String address = "localhost"; 12 | 13 | /** 14 | * The connection port. 15 | */ 16 | private int port = 9000; 17 | 18 | /** 19 | * The connection type. 20 | */ 21 | private ConnectionType type = ConnectionType.NORMAL; 22 | 23 | public String getAddress() { 24 | return this.address; 25 | } 26 | 27 | public void setAddress(String address) { 28 | this.address = address; 29 | } 30 | 31 | public int getPort() { 32 | return this.port; 33 | } 34 | 35 | public void setPort(int port) { 36 | this.port = port; 37 | } 38 | 39 | public ConnectionType getType() { 40 | return this.type; 41 | } 42 | 43 | public void setType(ConnectionType type) { 44 | this.type = type; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /livelessons-testing/livelessons-testing-spring/src/main/java/demo/service/VehicleDetailsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package demo.service; 18 | 19 | import demo.domain.VehicleIdentificationNumber; 20 | 21 | public interface VehicleDetailsService { 22 | 23 | VehicleDetails getVehicleDetails(VehicleIdentificationNumber vin) 24 | throws VehicleIdentificationNumberNotFoundException; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-gateway/src/main/java/demo/Contact.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Contact { 4 | 5 | private Long id; 6 | 7 | private String relationship; 8 | 9 | private String userId; 10 | 11 | private String firstName; 12 | 13 | private String lastName; 14 | 15 | private String email; 16 | 17 | public Long getId() { 18 | return id; 19 | } 20 | 21 | public String getRelationship() { 22 | return relationship; 23 | } 24 | 25 | public String getUserId() { 26 | return userId; 27 | } 28 | 29 | public String getFirstName() { 30 | return firstName; 31 | } 32 | 33 | public String getLastName() { 34 | return lastName; 35 | } 36 | 37 | public String getEmail() { 38 | return email; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "Contact{" + "id=" + id + ", relationship='" + relationship + '\'' 44 | + ", userId='" + userId + '\'' + ", firstName='" + firstName + '\'' 45 | + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + '}'; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-hystrix/src/main/java/demo/Contact.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Contact { 4 | 5 | private Long id; 6 | 7 | private String relationship; 8 | 9 | private String userId; 10 | 11 | private String firstName; 12 | 13 | private String lastName; 14 | 15 | private String email; 16 | 17 | public Long getId() { 18 | return id; 19 | } 20 | 21 | public String getRelationship() { 22 | return relationship; 23 | } 24 | 25 | public String getUserId() { 26 | return userId; 27 | } 28 | 29 | public String getFirstName() { 30 | return firstName; 31 | } 32 | 33 | public String getLastName() { 34 | return lastName; 35 | } 36 | 37 | public String getEmail() { 38 | return email; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "Contact{" + "id=" + id + ", relationship='" + relationship + '\'' 44 | + ", userId='" + userId + '\'' + ", firstName='" + firstName + '\'' 45 | + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + '}'; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-bookmark-service/src/main/java/demo/Bookmark.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | 7 | @Entity 8 | public class Bookmark { 9 | 10 | @Id 11 | @GeneratedValue 12 | private Long id; 13 | 14 | private String userId; 15 | 16 | private String href; 17 | 18 | private String description; 19 | 20 | private String label; 21 | 22 | Bookmark() { 23 | } 24 | 25 | public Bookmark(String userId, String href, String description, String label) { 26 | this.userId = userId; 27 | this.href = href; 28 | this.description = description; 29 | this.label = label; 30 | } 31 | 32 | public Long getId() { 33 | return id; 34 | } 35 | 36 | public String getUserId() { 37 | return userId; 38 | } 39 | 40 | public String getDescription() { 41 | return description; 42 | } 43 | 44 | public String getHref() { 45 | return href; 46 | } 47 | 48 | public String getLabel() { 49 | return label; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /livelessons-cloud/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-parent 8 | 1.0.0-SNAPSHOT 9 | ../livelessons-parent 10 | 11 | livelessons-cloud 12 | pom 13 | 14 | .. 15 | 16 | 17 | livelessons-cloud-heroku 18 | livelessons-cloud-cloudfoundry 19 | livelessons-cloud-docker 20 | livelessons-cloud-services 21 | livelessons-cloud-connectors 22 | livelessons-cloud-session 23 | livelessons-cloud-s3 24 | 25 | 26 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-flyway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-data 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-data-flyway 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-data-jpa 18 | 19 | 20 | org.flywaydb 21 | flyway-core 22 | 23 | 24 | com.h2database 25 | h2 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 4: Working With Data (Relational Database with JDBC) 3 | 4 | == Introduction 5 | This example shows how you can access a classic relational database using Spring JDBC. 6 | 7 | == Building and running the sample 8 | Use the following commands to build run the application: 9 | 10 | ``` 11 | $ mvn clean package 12 | $ java -jar target/livelessons-data-jdbc-1.0.0-SNAPSHOT.jar 13 | ``` 14 | 15 | == Understanding the code 16 | This demo provides the same domain as the JPA sample but this time the `Car` class is 17 | a POJO and isn't managed by JPA. The `CarRepository` implements the access logic and 18 | maps returned rows to the actual object. 19 | 20 | This sample also uses `src/main/resources/schema.sql` and `src/main/resources/data.sql` 21 | scripts (picked up by convention) to create and populate the database. 22 | 23 | If you want to try the application with a real MySQL server rather than an in-memory 24 | database you can uncomment the entries in `src/main/resources/application.properties`. 25 | -------------------------------------------------------------------------------- /livelessons-integration/livelessons-integration-dataflow-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-integration 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-integration-dataflow-service 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.cloud 17 | spring-cloud-starter-dataflow-server-local 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-test 23 | test 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /livelessons-choreography/livelessons-choreography-ribbon-and-eureka/src/main/java/demo/Contact.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | public class Contact { 4 | 5 | private Long id; 6 | 7 | private String relationship; 8 | 9 | private String userId; 10 | 11 | private String firstName; 12 | 13 | private String lastName; 14 | 15 | private String email; 16 | 17 | public Long getId() { 18 | return id; 19 | } 20 | 21 | public String getRelationship() { 22 | return relationship; 23 | } 24 | 25 | public String getUserId() { 26 | return userId; 27 | } 28 | 29 | public String getFirstName() { 30 | return firstName; 31 | } 32 | 33 | public String getLastName() { 34 | return lastName; 35 | } 36 | 37 | public String getEmail() { 38 | return email; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "Contact{" + "id=" + id + ", relationship='" + relationship + '\'' 44 | + ", userId='" + userId + '\'' + ", firstName='" + firstName + '\'' 45 | + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + '}'; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /livelessons-choreography/README.adoc: -------------------------------------------------------------------------------- 1 | :compat-mode: 2 | = Lesson 8: Choreographing Microservices 3 | 4 | _Understand how to build robust and failure-tolerant Microservices._ 5 | 6 | 7 | 8 | This section demonstrates: 9 | 10 | - how to handle service registration using Eureka (though Consul is also supported). 11 | - how to use Ribbon client-side load-balancing to dispatch calls in various ways using `DiscoveryClient`, using a blessed `RestTemplate` instance, and using the Feign & Spring MVC integration. Start everything up and then run `PassportServiceApplication` to see this working. 12 | - how to use Hystrix and the Hystrix dashboard to manage problematic service-to-service calls. You can see this in action by now disabling the `PhotoServiceApplication` (if you're in IntelliJ, remember to click the 'Exit' button which is the fifth one down from the top left - an arrow pointing to a door, under the camera icon and _not_ the 'Stop' or 'Pause' ones) and then re-running the `PassportServiceApplication`. 13 | - How to use Zuul to expose and aggregate backend microservices via an edge gateway. 14 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jdbc/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | livelessons 7 | livelessons-data 8 | 1.0.0-SNAPSHOT 9 | 10 | livelessons-data-jdbc 11 | 12 | ../.. 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-jdbc 18 | 19 | 20 | com.h2database 21 | h2 22 | 23 | 24 | mysql 25 | mysql-connector-java 26 | runtime 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /livelessons-data/livelessons-data-jpa/src/main/java/demo/DataJpaApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.beans.factory.InitializingBean; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | @SpringBootApplication 10 | public class DataJpaApplication { 11 | 12 | @Bean 13 | public InitializingBean seedDatabase(CarRepository repository) { 14 | return () -> { 15 | repository.save(new Car("Honda", "Civic", 1997)); 16 | repository.save(new Car("Honda", "Accord", 2003)); 17 | repository.save(new Car("Ford", "Escort", 1985)); 18 | }; 19 | } 20 | 21 | @Bean 22 | public CommandLineRunner exampleQuery(CarRepository repository) { 23 | return args -> repository.findByMakeIgnoringCase("HONDA") 24 | .forEach(System.err::println); 25 | } 26 | 27 | public static void main(String[] args) { 28 | SpringApplication.run(DataJpaApplication.class, args); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /livelessons-security/livelessons-security-sso-auth-server/src/main/java/demo/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 5 | import org.springframework.security.config.annotation.authentication.configuration.EnableGlobalAuthentication; 6 | import org.springframework.security.config.annotation.authentication.configurers.GlobalAuthenticationConfigurerAdapter; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | 9 | @Configuration 10 | @EnableGlobalAuthentication 11 | public class SecurityConfig extends GlobalAuthenticationConfigurerAdapter { 12 | 13 | private final UserDetailsService userDetailsService; 14 | 15 | public SecurityConfig(UserDetailsService userDetailsService) { 16 | this.userDetailsService = userDetailsService; 17 | } 18 | 19 | @Override 20 | public void init(AuthenticationManagerBuilder auth) throws Exception { 21 | auth.userDetailsService(this.userDetailsService); 22 | } 23 | 24 | } 25 | --------------------------------------------------------------------------------