├── .devcontainer ├── devcontainer.json ├── funcs.sh └── postCreateCommand.sh ├── .github ├── CODE_OF_CONDUCT.md ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── azure-dev.yml │ ├── maven-build.yml │ ├── pages.yml │ └── validation-sample-workflow.yml ├── .gitignore ├── .gitmodules ├── .vscode └── settings.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Dockerfile ├── Gemfile ├── LICENSE.md ├── README.md ├── SECURITY.md ├── _config.yml ├── azure.yaml ├── cleanup.md ├── config ├── LICENSE ├── README.md ├── api-gateway.yml ├── application-mysql.yml ├── application-passwordless.yml ├── application.yml ├── chat-agent.yml ├── customers-service.yml ├── discovery-server.yml ├── tracing-server.yml ├── vets-service.yml └── visits-service.yml ├── dashboard └── aca-java-metrics-dashboard.json ├── docker-compose.yml ├── docs ├── 01_lab_plan │ ├── 0101.md │ ├── 0102.md │ ├── 0103.md │ └── 01_openlab_plan.md ├── 02_lab_launch │ ├── 0201.md │ ├── 0202.md │ ├── 0203.md │ ├── 0204.md │ ├── 0205.md │ ├── 0206.md │ ├── 0207.md │ ├── 0208.md │ ├── 0209.md │ └── 02_openlab_setup_aca.md ├── 03_lab_openai │ ├── 0301.md │ ├── 0302.md │ ├── 0303.md │ ├── 0304.md │ ├── 03_openai.md │ ├── 03_openai_existing.md │ └── 03_openlab_openai_aca.md ├── 04_lab_monitor │ ├── 0401.md │ ├── 0402.md │ ├── 0403.md │ ├── 0404.md │ ├── 0405.md │ ├── 0406.md │ └── 04_openlab_monitoring_aca.md ├── 05_lab_secrets │ ├── 0501.md │ ├── 0502.md │ ├── 0503.md │ ├── 0504.md │ └── 05_openlab_secrets_aca.md ├── 06_lab_automation │ ├── 0601.md │ ├── 0602.md │ ├── 0603.md │ ├── 0604.md │ ├── 0605.md │ └── 06_openlab_automation.md ├── 07_lab_security │ ├── 0701.md │ ├── 0702.md │ ├── 0703.md │ ├── 0704.md │ ├── 0705.md │ ├── 0706.md │ ├── 0707.md │ ├── 0708.md │ └── 07_openlab_security_aca.md ├── 08_lab_private │ ├── 0801.md │ ├── 0802.md │ ├── 0803.md │ ├── 0804.md │ └── 08_openlab_private_endpoints_aca.md ├── 09_lab_messaging │ ├── 0901.md │ ├── 0901_application.yml │ ├── 0902.md │ ├── 0903.md │ ├── 0904.md │ ├── 0905.md │ └── 09_openlab_messaging_aca.md ├── 10_lab_reliable_application │ ├── 1001.md │ ├── 1002.md │ ├── 1003.md │ └── 10_reliable_java_aca.md └── 11_lab_scale │ ├── 1101.md │ ├── 1102.md │ ├── 1103.md │ └── 11_openlab_scale_aca.md ├── images ├── ACA-PetClinic-Lab.vsdx ├── CloudConfiglog.png ├── Eurekaconsolelog.png ├── aca-overview.png ├── acalab-ai-chat.png ├── acalab-managed-identity.png ├── acalab-monitor.png ├── acalab-monitoring-05-grafana-import-dashboard.png ├── acalab-monitoring-05-grafana-jvm-buffer.png ├── acalab-monitoring-05-grafana-jvm-gc.png ├── acalab-monitoring-05-grafana-jvm-mem-analysis.png ├── acalab-monitoring-05-grafana-jvm-mem.png ├── acalab-monitoring-05-grafana-overview.png ├── acalab-openai.png ├── acalab-overview.png ├── acalab10.png ├── acalab2.png ├── acalab6.png ├── acalab7.png ├── acalab8.png ├── acalab9.png ├── adminserver_applications.png ├── adminserver_wallboard.png ├── ai-env-monitor.png ├── ai_overview.png ├── api-gateway-chatbox.png ├── api-gateway-main.png ├── api-gateway.png ├── api-gw-perf.png ├── api-gw.png ├── app-map.png ├── appalllogs.png ├── application-map.png ├── config-map.png ├── copilot-gen-code-1.png ├── copilot-gen-code-2.png ├── customers-service-logs.png ├── customers-service-perf.png ├── customers-service.png ├── customerserviceapplog.png ├── deployments.png ├── events.png ├── exception.png ├── failure.png ├── failures.png ├── ingress.png ├── lab10-grace.png ├── lab10-liveness-probe.png ├── lab10-no-downtime.png ├── lab10-readiness-probe.png ├── lab11_http_rule_scale_in.png ├── lab11_http_rule_scale_out.png ├── lab11_service_bus_rule_scale_in.png ├── lab11_service_bus_rule_scale_out.png ├── lab11_service_bus_scale_rule.png ├── lab2.drawio ├── lab2.png ├── lab3.png ├── lab4.png ├── lab5.png ├── lab6.png ├── lab7.png ├── lab8.png ├── live-metrics.png ├── live-perf.png ├── managed-components.png ├── open-ai-ask-copilot.png ├── open-ai-eureka-client.png ├── open-ai-gen-1.png ├── open-ai-gen-2.png ├── open-ai-petclinic-curl.png ├── open-ai-rag-bot.png ├── overview-base.png ├── perf.png ├── perf2.png ├── performance.png ├── performance2.png ├── performance3.png ├── petclinic_app.png ├── pods.png ├── revision_status.png ├── services.png ├── spring-boot-admin.png ├── sql-server-manage-firewall.png └── system-logs.png ├── index.md ├── infra └── bicep │ ├── abbreviations.json │ ├── hooks │ ├── postprovision.ps1 │ ├── postprovision.sh │ ├── predown.ps1 │ ├── predown.sh │ ├── preprovision.ps1 │ └── preprovision.sh │ ├── main.bicep │ ├── main.parameters.json │ └── modules │ ├── acr │ ├── acr.bicep │ ├── acrExisting.bicep │ ├── containerRegistry.bicep │ ├── containerRegistryRolesDef.bicep │ └── importImage.bicep │ ├── ai │ ├── openai.bicep │ └── openaiRoleAssignment.bicep │ ├── app │ └── petclinic.bicep │ ├── containerapps │ ├── aca-environment.bicep │ ├── containerapp-java-components.bicep │ ├── containerapp.bicep │ └── serviceLinker.bicep │ ├── database │ ├── database.bicep │ └── mysql.bicep │ ├── grafana │ ├── azure-managed-grafana.bicep │ ├── grafana-dashboard.bicep │ └── grafana-role-assignment.bicep │ ├── network │ ├── private-dns-zone.bicep │ └── vnet.bicep │ └── shared │ ├── applicationInsights.bicep │ ├── logAnalyticsWorkspace.bicep │ ├── resourceGroup.bicep │ └── userAssignedIdentity.bicep ├── install.md ├── more.md ├── private_key.pem ├── solution ├── sampleENVIRONMENT.azcli └── samplebashrc ├── src ├── .editorconfig ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── LICENSE ├── README.md ├── docker-compose.yml ├── docker │ ├── Dockerfile │ ├── grafana │ │ ├── Dockerfile │ │ ├── dashboards │ │ │ └── grafana-petclinic-dashboard.json │ │ ├── grafana.ini │ │ └── provisioning │ │ │ ├── dashboards │ │ │ └── all.yml │ │ │ └── datasources │ │ │ └── all.yml │ └── prometheus │ │ ├── Dockerfile │ │ └── prometheus.yml ├── docs │ ├── application-screenshot.png │ ├── grafana-custom-metrics-dashboard.png │ └── microservices-architecture-diagram.jpg ├── mvnw ├── mvnw.cmd ├── pom.xml ├── scripts │ ├── chaos │ │ ├── README.md │ │ ├── attacks_disable.json │ │ ├── attacks_enable_exception.json │ │ ├── attacks_enable_killapplication.json │ │ ├── attacks_enable_latency.json │ │ ├── attacks_enable_memory.json │ │ ├── call_chaos.sh │ │ ├── watcher_disable.json │ │ ├── watcher_enable_component.json │ │ ├── watcher_enable_controller.json │ │ ├── watcher_enable_repository.json │ │ ├── watcher_enable_restcontroller.json │ │ └── watcher_enable_service.json │ └── run_all.sh ├── spring-petclinic-admin-server │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── admin │ │ │ └── SpringBootAdminApplication.java │ │ └── resources │ │ ├── application.yml │ │ └── logback-spring.xml ├── spring-petclinic-api-gateway │ ├── .gitignore │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── api │ │ │ │ ├── ApiGatewayApplication.java │ │ │ │ ├── application │ │ │ │ ├── ChatServiceClient.java │ │ │ │ ├── CustomersServiceClient.java │ │ │ │ └── VisitsServiceClient.java │ │ │ │ ├── boundary │ │ │ │ └── web │ │ │ │ │ └── ApiGatewayController.java │ │ │ │ ├── dto │ │ │ │ ├── ChatMessage.java │ │ │ │ ├── OwnerDetails.java │ │ │ │ ├── PetDetails.java │ │ │ │ ├── PetType.java │ │ │ │ ├── VisitDetails.java │ │ │ │ └── Visits.java │ │ │ │ └── websocket │ │ │ │ ├── ChatWebSocketHandler.java │ │ │ │ └── WebSocketConfig.java │ │ ├── less │ │ │ ├── header.less │ │ │ ├── petclinic.less │ │ │ ├── responsive.less │ │ │ └── typography.less │ │ ├── resources │ │ │ ├── application.yml │ │ │ ├── logback-spring.xml │ │ │ ├── messages │ │ │ │ ├── messages.properties │ │ │ │ ├── messages_de.properties │ │ │ │ └── messages_en.properties │ │ │ └── static │ │ │ │ ├── fonts │ │ │ │ ├── montserrat-webfont.eot │ │ │ │ ├── montserrat-webfont.svg │ │ │ │ ├── montserrat-webfont.ttf │ │ │ │ ├── montserrat-webfont.woff │ │ │ │ ├── varela_round-webfont.eot │ │ │ │ ├── varela_round-webfont.svg │ │ │ │ ├── varela_round-webfont.ttf │ │ │ │ └── varela_round-webfont.woff │ │ │ │ ├── images │ │ │ │ ├── favicon.png │ │ │ │ ├── pets.png │ │ │ │ ├── platform-bg.png │ │ │ │ ├── spring-logo-dataflow-mobile.png │ │ │ │ ├── spring-logo-dataflow.png │ │ │ │ └── spring-pivotal-logo.png │ │ │ │ ├── index.html │ │ │ │ ├── js │ │ │ │ └── main.js │ │ │ │ └── scripts │ │ │ │ ├── agent │ │ │ │ ├── agent.component.js │ │ │ │ ├── agent.js │ │ │ │ └── agent.template.html │ │ │ │ ├── app.js │ │ │ │ ├── fragments │ │ │ │ ├── footer.html │ │ │ │ ├── nav.html │ │ │ │ └── welcome.html │ │ │ │ ├── infrastructure │ │ │ │ ├── httpErrorHandlingInterceptor.js │ │ │ │ └── infrastructure.js │ │ │ │ ├── owner-details │ │ │ │ ├── owner-details.component.js │ │ │ │ ├── owner-details.controller.js │ │ │ │ ├── owner-details.js │ │ │ │ └── owner-details.template.html │ │ │ │ ├── owner-form │ │ │ │ ├── owner-form.component.js │ │ │ │ ├── owner-form.controller.js │ │ │ │ ├── owner-form.js │ │ │ │ └── owner-form.template.html │ │ │ │ ├── owner-list │ │ │ │ ├── owner-list.component.js │ │ │ │ ├── owner-list.controller.js │ │ │ │ ├── owner-list.js │ │ │ │ └── owner-list.template.html │ │ │ │ ├── pet-form │ │ │ │ ├── pet-form.component.js │ │ │ │ ├── pet-form.controller.js │ │ │ │ ├── pet-form.js │ │ │ │ └── pet-form.template.html │ │ │ │ ├── vet-list │ │ │ │ ├── vet-list.component.js │ │ │ │ ├── vet-list.controller.js │ │ │ │ ├── vet-list.js │ │ │ │ └── vet-list.template.html │ │ │ │ └── visits │ │ │ │ ├── visits.component.js │ │ │ │ ├── visits.controller.js │ │ │ │ ├── visits.js │ │ │ │ └── visits.template.html │ │ └── wro │ │ │ ├── wro.properties │ │ │ └── wro.xml │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── api │ │ │ ├── ApiGatewayApplicationTests.java │ │ │ ├── application │ │ │ └── VisitsServiceClientIntegrationTest.java │ │ │ └── boundary │ │ │ └── web │ │ │ ├── ApiGatewayControllerTest.java │ │ │ └── CircuitBreakerConfiguration.java │ │ ├── jmeter │ │ └── petclinic_test_plan.jmx │ │ └── resources │ │ └── application-test.yml ├── spring-petclinic-chat-agent │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── agent │ │ │ ├── ChatAgentApplication.java │ │ │ ├── PetClinicRuntimeHints.java │ │ │ ├── chat │ │ │ ├── Agent.java │ │ │ ├── AgentConfig.java │ │ │ ├── ChatModelProperties.java │ │ │ ├── ChatOptionsProperties.java │ │ │ ├── ModeledQuestionAnswerAdvisor.java │ │ │ ├── OwnerTools.java │ │ │ ├── PetTools.java │ │ │ ├── VetTools.java │ │ │ └── VisitTools.java │ │ │ ├── controller │ │ │ └── ChatController.java │ │ │ ├── model │ │ │ ├── ChatMessage.java │ │ │ ├── Owner.java │ │ │ ├── Pet.java │ │ │ ├── PetRequest.java │ │ │ ├── PetType.java │ │ │ ├── Specialty.java │ │ │ ├── Vet.java │ │ │ └── Visit.java │ │ │ ├── service │ │ │ ├── OwnerService.java │ │ │ ├── PetService.java │ │ │ ├── VetService.java │ │ │ └── VisitService.java │ │ │ ├── system │ │ │ ├── CacheConfiguration.java │ │ │ ├── CrashController.java │ │ │ └── WelcomeController.java │ │ │ └── websocket │ │ │ ├── WebSocketConfig.java │ │ │ └── WebSocketEventListener.java │ │ ├── resources │ │ ├── application.yml │ │ ├── messages │ │ │ ├── messages.properties │ │ │ ├── messages_de.properties │ │ │ ├── messages_en.properties │ │ │ ├── messages_es.properties │ │ │ └── messages_ko.properties │ │ ├── petclinic-terms-of-use.txt │ │ ├── prompts │ │ │ └── system-message.st │ │ ├── static │ │ │ ├── images │ │ │ │ └── spring-logo.png │ │ │ ├── js │ │ │ │ └── main.js │ │ │ └── resources │ │ │ │ ├── css │ │ │ │ └── petclinic.css │ │ │ │ ├── fonts │ │ │ │ ├── montserrat-webfont.eot │ │ │ │ ├── montserrat-webfont.svg │ │ │ │ ├── montserrat-webfont.ttf │ │ │ │ ├── montserrat-webfont.woff │ │ │ │ ├── varela_round-webfont.eot │ │ │ │ ├── varela_round-webfont.svg │ │ │ │ ├── varela_round-webfont.ttf │ │ │ │ └── varela_round-webfont.woff │ │ │ │ └── images │ │ │ │ ├── favicon.png │ │ │ │ ├── pets.png │ │ │ │ ├── spring-logo-dataflow-mobile.png │ │ │ │ ├── spring-logo-dataflow.png │ │ │ │ └── spring-logo.svg │ │ └── templates │ │ │ ├── chat │ │ │ └── chat.html │ │ │ ├── error.html │ │ │ ├── fragments │ │ │ ├── inputField.html │ │ │ ├── layout.html │ │ │ └── selectField.html │ │ │ └── welcome.html │ │ └── scss │ │ ├── header.scss │ │ ├── petclinic.scss │ │ ├── responsive.scss │ │ └── typography.scss ├── spring-petclinic-config-server │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── config │ │ │ │ └── ConfigServerApplication.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── static │ │ │ └── index.html │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── config │ │ │ └── PetclinicConfigServerApplicationTests.java │ │ └── resources │ │ └── application.yml ├── spring-petclinic-customers-service │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── customers │ │ │ │ ├── CustomersServiceApplication.java │ │ │ │ ├── config │ │ │ │ └── MetricConfig.java │ │ │ │ ├── health │ │ │ │ └── ServiceHealthIndicator.java │ │ │ │ ├── model │ │ │ │ ├── Owner.java │ │ │ │ ├── OwnerRepository.java │ │ │ │ ├── Pet.java │ │ │ │ ├── PetRepository.java │ │ │ │ └── PetType.java │ │ │ │ ├── shutdown │ │ │ │ └── EurekaGracefulShutdown.java │ │ │ │ └── web │ │ │ │ ├── OwnerResource.java │ │ │ │ ├── PetDetails.java │ │ │ │ ├── PetRequest.java │ │ │ │ ├── PetResource.java │ │ │ │ └── ResourceNotFoundException.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── data-hsqldb.sql │ │ │ ├── data-mysql.sql │ │ │ ├── db │ │ │ ├── hsqldb │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ ├── mysql │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── postgres │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ ├── logback-spring.xml │ │ │ ├── schema-hsqldb.sql │ │ │ └── schema-mysql.sql │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── customers │ │ │ └── web │ │ │ └── PetResourceTest.java │ │ └── resources │ │ └── application-test.yml ├── spring-petclinic-discovery-server │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── discovery │ │ │ │ └── DiscoveryServerApplication.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── discovery │ │ └── DiscoveryServerApplicationTests.java ├── spring-petclinic-messaging-emulator │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── messagingemulator │ │ │ ├── EmulatorApp.java │ │ │ ├── config │ │ │ ├── MessagingConfig.java │ │ │ └── QueueConfig.java │ │ │ ├── entity │ │ │ ├── PetClinicMessageRequest.java │ │ │ └── PetClinicMessageResponse.java │ │ │ ├── jkube │ │ │ └── deployment.yml │ │ │ ├── model │ │ │ ├── VisitRequest.java │ │ │ └── VisitRequestRepository.java │ │ │ ├── service │ │ │ ├── PetClinicMessageResponsesReceiver.java │ │ │ └── PetClinicVisitRequestSender.java │ │ │ └── web │ │ │ └── AzureServiceBusResource.java │ │ ├── less │ │ ├── header.less │ │ ├── petclinic.less │ │ ├── responsive.less │ │ └── typography.less │ │ ├── resources │ │ ├── application.yml │ │ ├── db │ │ │ └── mysql │ │ │ │ └── schema.sql │ │ ├── logback-spring.xml │ │ ├── messages │ │ │ ├── messages.properties │ │ │ ├── messages_de.properties │ │ │ └── messages_en.properties │ │ ├── schema-hsqldb.sql │ │ ├── schema-mysql.sql │ │ └── static │ │ │ ├── fonts │ │ │ ├── montserrat-webfont.eot │ │ │ ├── montserrat-webfont.svg │ │ │ ├── montserrat-webfont.ttf │ │ │ ├── montserrat-webfont.woff │ │ │ ├── varela_round-webfont.eot │ │ │ ├── varela_round-webfont.svg │ │ │ ├── varela_round-webfont.ttf │ │ │ └── varela_round-webfont.woff │ │ │ ├── images │ │ │ ├── favicon.png │ │ │ ├── pets.png │ │ │ ├── platform-bg.png │ │ │ ├── spring-logo-dataflow-mobile.png │ │ │ ├── spring-logo-dataflow.png │ │ │ └── spring-pivotal-logo.png │ │ │ ├── index.html │ │ │ └── scripts │ │ │ ├── app.js │ │ │ ├── fragments │ │ │ ├── footer.html │ │ │ ├── nav.html │ │ │ └── welcome.html │ │ │ ├── infrastructure │ │ │ ├── httpErrorHandlingInterceptor.js │ │ │ └── infrastructure.js │ │ │ ├── message-form │ │ │ ├── message-form.component.js │ │ │ ├── message-form.controller.js │ │ │ ├── message-form.js │ │ │ └── message-form.template.html │ │ │ └── message-list │ │ │ ├── message-list.component.js │ │ │ ├── message-list.controller.js │ │ │ ├── message-list.js │ │ │ └── message-list.template.html │ │ └── wro │ │ ├── wro.properties │ │ └── wro.xml ├── spring-petclinic-vets-service │ ├── .gitignore │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── springframework │ │ │ │ └── samples │ │ │ │ └── petclinic │ │ │ │ └── vets │ │ │ │ ├── VetsServiceApplication.java │ │ │ │ ├── model │ │ │ │ ├── Specialty.java │ │ │ │ ├── Vet.java │ │ │ │ └── VetRepository.java │ │ │ │ ├── shutdown │ │ │ │ └── EurekaGracefulShutdown.java │ │ │ │ ├── system │ │ │ │ ├── CacheConfig.java │ │ │ │ └── VetsProperties.java │ │ │ │ └── web │ │ │ │ └── VetResource.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── data-hsqldb.sql │ │ │ ├── data-mysql.sql │ │ │ ├── db │ │ │ ├── hsqldb │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ ├── mysql │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ └── postgres │ │ │ │ ├── data.sql │ │ │ │ └── schema.sql │ │ │ ├── logback-spring.xml │ │ │ ├── schema-hsqldb.sql │ │ │ └── schema-mysql.sql │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── vets │ │ │ └── web │ │ │ └── VetResourceTest.java │ │ └── resources │ │ └── application-test.yml └── spring-petclinic-visits-service │ ├── Dockerfile │ ├── ai.Dockerfile │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── springframework │ │ │ └── samples │ │ │ └── petclinic │ │ │ └── visits │ │ │ ├── VisitsServiceApplication.java │ │ │ ├── config │ │ │ ├── MessagingConfig.java │ │ │ ├── MetricConfig.java │ │ │ └── QueueConfig.java │ │ │ ├── entities │ │ │ ├── VisitRequest.java │ │ │ └── VisitResponse.java │ │ │ ├── model │ │ │ ├── Visit.java │ │ │ └── VisitRepository.java │ │ │ ├── service │ │ │ └── VisitsReceiver.java │ │ │ ├── shutdown │ │ │ └── EurekaGracefulShutdown.java │ │ │ └── web │ │ │ └── VisitResource.java │ └── resources │ │ ├── application.yml │ │ ├── data-hsqldb.sql │ │ ├── data-mysql.sql │ │ ├── db │ │ ├── hsqldb │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ ├── mysql │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ └── postgres │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ ├── logback-spring.xml │ │ ├── schema-hsqldb.sql │ │ └── schema-mysql.sql │ └── test │ ├── java │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── visits │ │ └── web │ │ └── VisitResourceTest.java │ └── resources │ └── application-test.yml ├── tips.md └── tools ├── Dockerfile ├── api-gateway-chatbox.patch ├── azure-resource.profile.template ├── create-apps.sh ├── create-azure-resource.sh ├── funcs.sh ├── prepare-extensions.sh ├── prepare-subscription.sh ├── prepare.sh ├── spring-petclinic-chat-service ├── .gitattributes ├── .gitignore ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── org │ │ └── springframework │ │ └── samples │ │ └── petclinic │ │ └── chat_service │ │ └── ChatServiceApplication.java │ └── resources │ ├── AzureOpenAiChatClientIT.java │ └── application.yml ├── update-apps-appinsights.sh └── update-apps-passwordless.sh /.devcontainer/funcs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DEV_ENV_FILE="$HOME/.dev-environment" 4 | 5 | alias saveenv='declare -p | grep "declare \(--\|-x\)" | grep -v "^declare \(--\|-x\) \(PS[0-9]\|_.*\|SDKMAN_.*\|sdkman_.*\|IFS\|VSCODE_.*\|HIST.*\|GITHUB_.*\|BASH_.*\|COMP_WORDBREAKS\|PATH\|OLDPWD\|PWD\|LS_COLORS\)=" > "$DEV_ENV_FILE"' 6 | 7 | alias loadenv='[ -f $DEV_ENV_FILE ] && source "$DEV_ENV_FILE"' 8 | 9 | alias clearenv='rm -f "$DEV_ENV_FILE"' 10 | -------------------------------------------------------------------------------- /.devcontainer/postCreateCommand.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | CHECK_AZD=$(which azd) 6 | if [[ ! -z "$CHECK_AZD" ]]; then 7 | azd config set alpha.deployment.stacks on 8 | fi 9 | 10 | grep JAVA_AI_FUNC "$HOME/.bashrc" > /dev/null 2>&1 11 | if [[ $? -ne 0 ]]; then 12 | 13 | cat <> "$HOME/.bashrc" 14 | JAVA_AI_FUNC="$DIR" 15 | [ -f "\$JAVA_AI_FUNC/funcs.sh" ] && \. "\$JAVA_AI_FUNC/funcs.sh" 16 | 17 | loadenv 18 | 19 | EOT 20 | 21 | fi 22 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 4 | > Please provide us with the following information: 5 | > --------------------------------------------------------------- 6 | 7 | ### This issue is for a: (mark with an `x`) 8 | ``` 9 | - [ ] bug report -> please search issues before submitting 10 | - [ ] feature request 11 | - [ ] documentation issue or request 12 | - [ ] regression (a behavior that used to work and stopped in a new release) 13 | ``` 14 | 15 | ### Minimal steps to reproduce 16 | > 17 | 18 | ### Any log messages given by the failure 19 | > 20 | 21 | ### Expected/desired behavior 22 | > 23 | 24 | ### OS and Version? 25 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) 26 | 27 | ### Versions 28 | > 29 | 30 | ### Mention any other details that might be useful 31 | 32 | > --------------------------------------------------------------- 33 | > Thanks! We'll be in touch soon. 34 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | 3 | * ... 4 | 5 | ## Does this introduce a breaking change? 6 | 7 | ``` 8 | [ ] Yes 9 | [ ] No 10 | ``` 11 | 12 | ## Pull Request Type 13 | What kind of change does this Pull Request introduce? 14 | 15 | 16 | ``` 17 | [ ] Bugfix 18 | [ ] Feature 19 | [ ] Code style update (formatting, local variables) 20 | [ ] Refactoring (no functional changes, no api changes) 21 | [ ] Documentation content changes 22 | [ ] Other... Please describe: 23 | ``` 24 | 25 | ## How to Test 26 | * Get the code 27 | 28 | ``` 29 | git clone [repo-address] 30 | cd [repo-name] 31 | git checkout [branch-name] 32 | npm install 33 | ``` 34 | 35 | * Test the code 36 | 37 | ``` 38 | ``` 39 | 40 | ## What to Check 41 | Verify that the following are valid 42 | * ... 43 | 44 | ## Other Information 45 | -------------------------------------------------------------------------------- /.github/workflows/maven-build.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | paths: 'src/**' 10 | pull_request: 11 | branches: [ main ] 12 | paths: 'src/**' 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Set up JDK 17 23 | uses: actions/setup-java@v4 24 | with: 25 | java-version: '17' 26 | distribution: 'adopt' 27 | cache: maven 28 | 29 | - name: Build with Maven 30 | run: mvn -B package --file src/pom.xml 31 | -------------------------------------------------------------------------------- /.github/workflows/validation-sample-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Validation Sample Workflow 2 | on: 3 | workflow_dispatch: 4 | 5 | permissions: 6 | contents: read 7 | id-token: write 8 | pull-requests: write 9 | 10 | jobs: 11 | template_validation_job: 12 | runs-on: ubuntu-latest 13 | name: template validation 14 | steps: 15 | - uses: actions/checkout@v4 16 | 17 | # https://github.com/microsoft/template-validation-action 18 | - uses: microsoft/template-validation-action@v0.3.5 19 | id: validation 20 | with: 21 | validateAzd: true 22 | useDevContainer: true 23 | env: 24 | AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} 25 | AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} 26 | AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} 27 | AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} 28 | AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | 31 | - name: print result 32 | run: cat ${{ steps.validation.outputs.resultFile }} 33 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "spring-petclinic-microservices"] 2 | path = spring-petclinic-microservices 3 | url = https://github.com/spring-petclinic/spring-petclinic-microservices 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "acalab", 4 | "APPNAME", 5 | "autoinstrumentation", 6 | "azcli", 7 | "codespace", 8 | "Codespaces", 9 | "containerapp", 10 | "Entra", 11 | "kubenet", 12 | "Kusto", 13 | "MSYS", 14 | "PATHCONV", 15 | "petclinic", 16 | "serviceconnector", 17 | "VM's", 18 | "vnet" 19 | ], 20 | "java.compile.nullAnalysis.mode": "automatic" 21 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:3.2 2 | 3 | # Set default locale for the environment 4 | ENV LC_ALL=C.UTF-8 5 | ENV LANG=en_US.UTF-8 6 | ENV LANGUAGE=en_US.UTF-8 7 | 8 | WORKDIR /usr/src/app 9 | 10 | COPY Gemfile Gemfile.lock ./ 11 | RUN bundle install 12 | 13 | EXPOSE 4000 14 | CMD ["bundle", "exec", "jekyll", "help"] 15 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem "jekyll", "~> 4.3" # installed by `gem jekyll` 4 | 5 | #gem "just-the-docs", "0.4.2" # pinned to the current release 6 | gem "just-the-docs" # always download the latest release 7 | 8 | gem "sass-embedded", "~> 1.78.0" # workaround on warning: darken() is deprecated, see https://github.com/jekyll/jekyll/issues/9686 -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: Java and AI 2 | description: This lab walks you through the creation of an intelligent Java application on Azure Container Apps integrated with multiple Azure services. 3 | theme: just-the-docs 4 | 5 | # url: https://Azure-Samples.github.io/java-on-aca 6 | 7 | aux_links: 8 | "Java and AI lab on GitHub": 9 | - "https://github.com/Azure-Samples/java-on-aca" 10 | 11 | 12 | callouts_level: quiet # or loud 13 | callouts: 14 | highlight: 15 | color: yellow 16 | important: 17 | title: Important 18 | color: blue 19 | new: 20 | title: New 21 | color: green 22 | note: 23 | title: Note 24 | color: purple 25 | warning: 26 | title: Warning 27 | color: red 28 | -------------------------------------------------------------------------------- /cleanup.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Clean up lab resources 3 | layout: home 4 | nav_order: 90 5 | --- 6 | 7 | # Clean up lab resources 8 | {: .no_toc } 9 | 10 | If you're finished with the resources that you created for these labs, clean up your lab environment by deleting them and the resource group that contains them. 11 | 12 | 1. Clean up the Azure OpenAI Service instance (optional). 13 | 14 | If you completed the optional [Lab 3]({% link docs/03_lab_openai/03_openlab_openai_aca.md %}), you created a new Azure OpenAI instance. Use the following command to delete it before you delete any other resources. If you didn't complete Lab 3, you can ignore this step. 15 | 16 | ```bash 17 | az cognitiveservices account delete -g $RESOURCE_GROUP -n $OPEN_AI_SERVICE_NAME 18 | ``` 19 | 20 | 1. Delete the resource group that you created for these labs, along with any resources that it contains. 21 | 22 | ```bash 23 | az group delete --name $RESOURCE_GROUP --yes --no-wait 24 | 25 | az configure --default group='' 26 | ``` 27 | 28 | {: .note } 29 | 30 | > It can take roughly 30 minutes to delete all these resources. With the option `--no-wait`, you can execute this long-running command without waiting for it to finish. 31 | -------------------------------------------------------------------------------- /config/README.md: -------------------------------------------------------------------------------- 1 | # spring-petclinic-microservices-config 2 | 3 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 4 | 5 | Configuration repository for distributed Spring Petclinic application 6 | 7 | This folder for the config repository is a close copy of the [spring-petclinic-microservices-config](https://github.com/spring-petclinic/spring-petclinic-microservices-config) repository and is used in the [Java microservices on ACA](https://azure-samples.github.io/java-on-aca/) lab. 8 | -------------------------------------------------------------------------------- /config/api-gateway.yml: -------------------------------------------------------------------------------- 1 | zuul: 2 | prefix: /api 3 | ignoredServices: '*' 4 | routes: 5 | vets-service: /vet/** 6 | visits-service: /visit/** 7 | customers-service: /customer/** 8 | api-gateway: /gateway/** 9 | 10 | server: 11 | port: 8080 12 | # The stop processing uses a timeout which provides a grace period during which existing requests will be allowed to complete but no new requests will be permitted 13 | shutdown: graceful 14 | compression: 15 | enabled: true 16 | mime-types: application/json,text/css,application/javascript 17 | min-response-size: 2048 18 | 19 | spring: 20 | message: 21 | basename: messages/messages 22 | cloud: 23 | loadbalancer: 24 | cache: 25 | enabled: false 26 | 27 | --- 28 | spring: 29 | config: 30 | activate: 31 | on-profile: docker 32 | zipkin: 33 | baseUrl: http://tracing-server:9411 34 | eureka: 35 | client: 36 | serviceUrl: 37 | defaultZone: http://discovery-server:8761/eureka/ 38 | -------------------------------------------------------------------------------- /config/application-mysql.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | url: jdbc:mysql://${SQL_SERVER}.mysql.database.azure.com:3306/petclinic?useSSL=true 4 | username: ${SQL_USER:sqladmin} 5 | password: ${SQL_PASSWORD:} 6 | sql: 7 | init: 8 | schema-locations: classpath*:db/mysql/schema.sql 9 | data-locations: classpath*:db/mysql/data.sql 10 | mode: ALWAYS 11 | -------------------------------------------------------------------------------- /config/application-passwordless.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | sql: 3 | init: 4 | schema-locations: classpath*:db/mysql/schema.sql 5 | data-locations: classpath*:db/mysql/data.sql 6 | mode: ALWAYS 7 | -------------------------------------------------------------------------------- /config/chat-agent.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | sql: 3 | init: 4 | schema-locations: classpath*:db/h2/schema.sql 5 | data-locations: classpath*:db/h2/data.sql 6 | # Web 7 | thymeleaf: 8 | mode: HTML 9 | # Internationalization 10 | messages: 11 | basename: messages/messages 12 | # Maximum time static resources should be cached 13 | web: 14 | resources: 15 | cache: 16 | cachecontrol: 17 | max-age: 12h 18 | # Spring AI 19 | ai: 20 | azure: 21 | openai: 22 | endpoint: 23 | client-id: 24 | chat: 25 | options: 26 | deployment-name: gpt-4o 27 | temperature: 0.8 28 | embedding: 29 | options: 30 | deployment-name: text-embedding-ada-002 31 | chat: 32 | client: 33 | enabled: true 34 | 35 | # PetClinic Agent 36 | petclinic: 37 | agent: 38 | name: petclinic agent 39 | -------------------------------------------------------------------------------- /config/customers-service.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | config: 3 | activate: 4 | on-profile: default 5 | eureka: 6 | instance: 7 | # enable to register multiple app instances with a random server port 8 | instance-id: ${spring.application.name}:${random.uuid} 9 | 10 | --- 11 | spring: 12 | config: 13 | activate: 14 | on-profile: docker 15 | zipkin: 16 | baseUrl: http://tracing-server:9411 17 | server: 18 | port: 8081 19 | eureka: 20 | client: 21 | serviceUrl: 22 | defaultZone: http://discovery-server:8761/eureka/ 23 | -------------------------------------------------------------------------------- /config/discovery-server.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8761 3 | 4 | eureka: 5 | instance: 6 | hostname: localhost 7 | # standalone mode 8 | client: 9 | registerWithEureka: false 10 | fetchRegistry: false 11 | serviceUrl: 12 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ 13 | 14 | -------------------------------------------------------------------------------- /config/tracing-server.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9411 3 | 4 | --- 5 | spring: 6 | profiles: default 7 | eureka: 8 | instance: 9 | # enable to register multiple app instances with a random server port 10 | instance-id: ${spring.application.name}:${random.uuid} 11 | 12 | --- 13 | spring: 14 | config: 15 | activate: 16 | on-profile: docker 17 | eureka: 18 | client: 19 | serviceUrl: 20 | defaultZone: http://discovery-server:8761/eureka/ 21 | -------------------------------------------------------------------------------- /config/vets-service.yml: -------------------------------------------------------------------------------- 1 | vets: 2 | cache: 3 | ttl: 60 4 | heap-size: 100 5 | 6 | --- 7 | spring: 8 | config: 9 | activate: 10 | on-profile: default 11 | eureka: 12 | instance: 13 | # enable to register multiple app instances with a random server port 14 | instance-id: ${spring.application.name}:${random.uuid} 15 | 16 | --- 17 | spring: 18 | config: 19 | activate: 20 | on-profile: docker 21 | zipkin: 22 | baseUrl: http://tracing-server:9411 23 | server: 24 | port: 8083 25 | eureka: 26 | client: 27 | serviceUrl: 28 | defaultZone: http://discovery-server:8761/eureka/ 29 | -------------------------------------------------------------------------------- /config/visits-service.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | config: 3 | activate: 4 | on-profile: default 5 | eureka: 6 | instance: 7 | # enable to register multiple app instances with a random server port 8 | instance-id: ${spring.application.name}:${random.uuid} 9 | 10 | --- 11 | spring: 12 | config: 13 | activate: 14 | on-profile: docker 15 | zipkin: 16 | baseUrl: http://tracing-server:9411 17 | server: 18 | port: 8082 19 | eureka: 20 | client: 21 | serviceUrl: 22 | defaultZone: http://discovery-server:8761/eureka/ 23 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # This file is for running the doc pages in a local Docker environment 2 | # Usage: 3 | # run "docker-compose up" 4 | # open "http://localhost:4000" in your browser 5 | 6 | services: 7 | jekyll: 8 | build: 9 | context: ./ 10 | ports: 11 | - 4000:4000 12 | volumes: 13 | - .:/usr/src/app 14 | stdin_open: true 15 | tty: true 16 | command: bundle exec jekyll serve -H 0.0.0.0 -t 17 | -------------------------------------------------------------------------------- /docs/01_lab_plan/01_openlab_plan.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Lab 1: Plan your application deployment' 3 | layout: default 4 | nav_order: 3 5 | has_children: true 6 | --- 7 | 8 | # Lab 01: Plan your application deployment 9 | 10 | ## Introduction 11 | 12 | Before you can deploy the example Spring Petclinic workload to Azure, you need to determine what application components need to run on Azure, which Azure resources you’ll use to host these components, and what tools you’ll need to perform the deployment. 13 | 14 | In this first lab session, you’ll explore the sample application code and configure your development environment. You’ll also evaluate the application’s technical and operational requirements to determine the best hosting, storage, and organizational approach for moving the Spring Petclinic workload to Azure. 15 | 16 | ## What you’ll cover 17 | 18 | As you work through this lab, you’ll: 19 | 20 | - Examine the information provided in the sample application’s GitHub repository and dive into the app’s various components. 21 | - Review the Azure services that you’ll use to host the application. 22 | - Make sure that your lab development environment is set up to connect and manage your Azure resources. 23 | 24 | Duration 25 | 26 | **Estimated time:** 20 minutes 27 | -------------------------------------------------------------------------------- /docs/02_lab_launch/0209.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '9. Review' 3 | layout: default 4 | nav_order: 9 5 | parent: 'Lab 2: Deploy applications to Azure Container Apps' 6 | --- 7 | 8 | # Review 9 | 10 | In this lab, you deployed the Spring Petclinic workload to Azure. 11 | 12 | The following image should reflect your application architecture after a successful deployment. 13 | 14 | ![lab 2 overview](../../images/acalab2.png) 15 | 16 | {: .important } 17 | > The work you did in this lab is fundamental to both this lab and the next several labs you’ll be working through, so please do not delete any of the Azure resources you've created here. 18 | > 19 | > As we mentioned in the [Install instructions]({% link install.md %}#configure-your-subscription-and-deploy-prerequisite-azure-resources), you can use both the `saveenv` and `loadenv` commands to manually save and load your environment variables at any time. 20 | > 21 | >You've done a lot in this lab, so now is a good time to run `saveenv` to make sure your current environment variables will be there if you have to start a new bash session. 22 | -------------------------------------------------------------------------------- /docs/03_lab_openai/0304.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '4. Review' 3 | layout: default 4 | nav_order: 7 5 | parent: 'Lab 3: Integrate Azure OpenAI Service with your apps' 6 | --- 7 | 8 | # Review 9 | 10 | In this lab, you learned how to build a Spring application-based chat service powered by Azure OpenAI, and you learned how to integrate it into the sample Spring Petclinic workload. 11 | 12 | The following diagram should reflect the current state of the deployed application. 13 | 14 | ![lab 3 overview](../../images/acalab-openai.png) -------------------------------------------------------------------------------- /docs/04_lab_monitor/0406.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '6. Review' 3 | layout: default 4 | nav_order: 6 5 | parent: 'Lab 4: Enable monitoring (Optional)' 6 | --- 7 | 8 | # Review 9 | 10 | In this lab, you added monitoring to the example Spring Petclinic workload that you deployed in the previous lab. 11 | 12 | As part of this process, you: 13 | 14 | - Inspected your Azure Container Apps in the Azure portal. 15 | - Configured Azure Container Apps environment monitoring. 16 | - Configured Application Insights to receive monitoring information from your applications. 17 | - Analyzed application-specific monitoring data. 18 | - Built a Java metrics dashboard with Azure Managed Grafana. 19 | 20 | The following image should now reflect your current application architecture. 21 | 22 | ![lab 4 overview](../../images/acalab-monitor.png) 23 | -------------------------------------------------------------------------------- /docs/05_lab_secrets/0504.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '4. Review' 3 | layout: default 4 | nav_order: 4 5 | parent: 'Lab 5: Connect to a database with managed identity (Optional)' 6 | --- 7 | 8 | # Review 9 | 10 | In this lab, you secured your database connection secrets for your Spring Petclinic workload, without needing to make application code changes, by using Azure Service Connector and managed identities. 11 | 12 | As part of this process, you: 13 | 14 | - Created a database administrator account. 15 | - Updated the application dependencies to enable passwordless connectivity. 16 | - Created service connections from your applications to the database server. 17 | 18 | The following diagram should reflect your application’s current architecture. 19 | 20 | ![lab 5 overview](../../images/acalab-managed-identity.png) 21 | -------------------------------------------------------------------------------- /docs/06_lab_automation/0605.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '5. Cleanup lab environment' 3 | layout: default 4 | nav_order: 5 5 | parent: 'Deploy to Azure automatically' 6 | search_exclude: true 7 | --- 8 | 9 | # 5. Cleanup lab environment 10 | 11 | Run the `azd` command to cleanup the automatically build lab environment. 12 | 13 | See detail steps in [Delete environment created by Azd automation]({% link cleanup.md %}#delete-environment-created-by-azd-automation) 14 | -------------------------------------------------------------------------------- /docs/07_lab_security/0707.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '7. WAF policy' 3 | layout: default 4 | nav_order: 7 5 | parent: 'Lab 7: Protect endpoints using Web Application Firewalls' 6 | search_exclude: true 7 | --- 8 | 9 | # Enable the WAF policy 10 | 11 | Now that you have successfully deployed Application Gateway and you can connect to your application, you can additionally enable the Web Application Firewall on your Application Gateway. By default your WAF policy will be disabled when you created it. You can use the following guidance to perform this task: 12 | 13 | - [az network application-gateway waf-policy](https://docs.microsoft.com/cli/azure/network/application-gateway/waf-policy?view=azure-cli-latest). 14 | 15 | ## Step by step guidance 16 | 17 | 1. To conclude the setup, enable the WAF policy. This will automatically start flagging noncompliant requests. To avoid blocking any requests at this point, configure it in detection mode. 18 | 19 | ```bash 20 | az network application-gateway waf-policy policy-setting update \ 21 | --mode Detection \ 22 | --policy-name $WAF_POLICY_NAME \ 23 | --resource-group $RESOURCE_GROUP \ 24 | --state Enabled 25 | ``` 26 | 27 | -------------------------------------------------------------------------------- /docs/07_lab_security/0708.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '8. Review' 3 | layout: default 4 | nav_order: 8 5 | parent: 'Lab 7: Protect endpoints using Web Application Firewalls' 6 | search_exclude: true 7 | --- 8 | 9 | # Review 10 | 11 | In this lab, you enhanced network security of Azure Spring Apps applications by blocking connections to its public endpoints and adding a Web Application Firewall to filter incoming requests. In this lab you 12 | 13 | - Created additional networking resources 14 | - Created an Azure Key Vault service 15 | - Acquired a certificate and add it to Key Vault 16 | - Redeployed your Azure Container Apps environment with internal networking 17 | - Created the Application Gateway resource 18 | - Accessed the application by DNS name 19 | - Enabled the WAF policy 20 | 21 | The below image illustrates the end state you have build in this lab. 22 | 23 | ![lab 7 overview](../../images/acalab7.png) 24 | -------------------------------------------------------------------------------- /docs/08_lab_private/0803.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '3. Test' 3 | layout: default 4 | nav_order: 3 5 | parent: 'Lab 8: Secure MySQL database and Key Vault using a Private Endpoint' 6 | search_exclude: true 7 | --- 8 | 9 | # Test your setup 10 | 11 | As the last step of this exercise and the lab, test your setup again. You should still be able to navigate to your application through the custom domain that you configured on your Application Gateway and view the listing of owners and veterinarians. 12 | 13 | -------------------------------------------------------------------------------- /docs/08_lab_private/0804.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '4. Review' 3 | layout: default 4 | nav_order: 4 5 | parent: 'Lab 8: Secure MySQL database and Key Vault using a Private Endpoint' 6 | search_exclude: true 7 | --- 8 | 9 | # Review 10 | 11 | In this lab, you implemented a configuration in which PaaS services used by Azure Spring Apps applications accept only connections that originate from within the virtual network hosting these apps. In this lab you 12 | 13 | - Locked down the Azure Database for MySQL Flexible Server instance by redeploying it in a subnet 14 | - Locked down the Key Vault instance by using a private endpoint 15 | - Tested your setup 16 | 17 | The below image illustrates the end state you have build in this lab. 18 | 19 | ![lab 8 overview](../../images/acalab8.png) 20 | -------------------------------------------------------------------------------- /docs/09_lab_messaging/0905.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '5. Review' 3 | layout: default 4 | nav_order: 5 5 | parent: 'Lab 9: Send messages between microservices' 6 | search_exclude: true 7 | --- 8 | 9 | # Review 10 | 11 | In this lab, you implemented support for outbound messaging by Azure Container Apps. In this lab you 12 | 13 | - Created an Azure Service Bus resource 14 | - Tried out an existing microservice 15 | - Updated an existing microservice to use the queues 16 | - Added the message producer 17 | 18 | The below image illustrates the end state you have build in this lab. 19 | 20 | ![lab 9 overview](../../images/acalab9.png) 21 | -------------------------------------------------------------------------------- /docs/10_lab_reliable_application/1003.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '3. Review' 3 | layout: default 4 | nav_order: 3 5 | parent: 'Build reliable Java application' 6 | search_exclude: true 7 | --- 8 | 9 | # Review 10 | 11 | In this lab, you implemented some design to build reliable Java applications with Azure Container Apps. In this lab you 12 | 13 | - Add appropiate shutdown hook to a Java application 14 | - Config health probes for a Java application 15 | 16 | 17 | The below image illustrates the end state you have build in this lab. 18 | 19 | ![lab 10 overview](../../images/acalab10.png) 20 | -------------------------------------------------------------------------------- /docs/11_lab_scale/1103.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '3. Review' 3 | layout: default 4 | nav_order: 1 5 | parent: 'Set up autoscaling for microservices' 6 | search_exclude: true 7 | --- 8 | 9 | # Review 10 | 11 | In this lab, you configured autoscaling rules for your applications to ensure they remain responsive and cost-efficient. Specifically, you: 12 | 13 | - Set up an HTTP scaling rule for an HTTP-based application. 14 | - Configured an Azure Service Bus scaling rule for an event-driven application. 15 | 16 | 17 | The below image illustrates the end state you have achieved in this lab. 18 | 19 | ![lab 11 overview](../../images/acalab10.png) 20 | -------------------------------------------------------------------------------- /images/ACA-PetClinic-Lab.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/ACA-PetClinic-Lab.vsdx -------------------------------------------------------------------------------- /images/CloudConfiglog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/CloudConfiglog.png -------------------------------------------------------------------------------- /images/Eurekaconsolelog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/Eurekaconsolelog.png -------------------------------------------------------------------------------- /images/aca-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/aca-overview.png -------------------------------------------------------------------------------- /images/acalab-ai-chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-ai-chat.png -------------------------------------------------------------------------------- /images/acalab-managed-identity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-managed-identity.png -------------------------------------------------------------------------------- /images/acalab-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitor.png -------------------------------------------------------------------------------- /images/acalab-monitoring-05-grafana-import-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitoring-05-grafana-import-dashboard.png -------------------------------------------------------------------------------- /images/acalab-monitoring-05-grafana-jvm-buffer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitoring-05-grafana-jvm-buffer.png -------------------------------------------------------------------------------- /images/acalab-monitoring-05-grafana-jvm-gc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitoring-05-grafana-jvm-gc.png -------------------------------------------------------------------------------- /images/acalab-monitoring-05-grafana-jvm-mem-analysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitoring-05-grafana-jvm-mem-analysis.png -------------------------------------------------------------------------------- /images/acalab-monitoring-05-grafana-jvm-mem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitoring-05-grafana-jvm-mem.png -------------------------------------------------------------------------------- /images/acalab-monitoring-05-grafana-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-monitoring-05-grafana-overview.png -------------------------------------------------------------------------------- /images/acalab-openai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-openai.png -------------------------------------------------------------------------------- /images/acalab-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab-overview.png -------------------------------------------------------------------------------- /images/acalab10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab10.png -------------------------------------------------------------------------------- /images/acalab2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab2.png -------------------------------------------------------------------------------- /images/acalab6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab6.png -------------------------------------------------------------------------------- /images/acalab7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab7.png -------------------------------------------------------------------------------- /images/acalab8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab8.png -------------------------------------------------------------------------------- /images/acalab9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/acalab9.png -------------------------------------------------------------------------------- /images/adminserver_applications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/adminserver_applications.png -------------------------------------------------------------------------------- /images/adminserver_wallboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/adminserver_wallboard.png -------------------------------------------------------------------------------- /images/ai-env-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/ai-env-monitor.png -------------------------------------------------------------------------------- /images/ai_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/ai_overview.png -------------------------------------------------------------------------------- /images/api-gateway-chatbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/api-gateway-chatbox.png -------------------------------------------------------------------------------- /images/api-gateway-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/api-gateway-main.png -------------------------------------------------------------------------------- /images/api-gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/api-gateway.png -------------------------------------------------------------------------------- /images/api-gw-perf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/api-gw-perf.png -------------------------------------------------------------------------------- /images/api-gw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/api-gw.png -------------------------------------------------------------------------------- /images/app-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/app-map.png -------------------------------------------------------------------------------- /images/appalllogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/appalllogs.png -------------------------------------------------------------------------------- /images/application-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/application-map.png -------------------------------------------------------------------------------- /images/config-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/config-map.png -------------------------------------------------------------------------------- /images/copilot-gen-code-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/copilot-gen-code-1.png -------------------------------------------------------------------------------- /images/copilot-gen-code-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/copilot-gen-code-2.png -------------------------------------------------------------------------------- /images/customers-service-logs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/customers-service-logs.png -------------------------------------------------------------------------------- /images/customers-service-perf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/customers-service-perf.png -------------------------------------------------------------------------------- /images/customers-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/customers-service.png -------------------------------------------------------------------------------- /images/customerserviceapplog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/customerserviceapplog.png -------------------------------------------------------------------------------- /images/deployments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/deployments.png -------------------------------------------------------------------------------- /images/events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/events.png -------------------------------------------------------------------------------- /images/exception.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/exception.png -------------------------------------------------------------------------------- /images/failure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/failure.png -------------------------------------------------------------------------------- /images/failures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/failures.png -------------------------------------------------------------------------------- /images/ingress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/ingress.png -------------------------------------------------------------------------------- /images/lab10-grace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab10-grace.png -------------------------------------------------------------------------------- /images/lab10-liveness-probe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab10-liveness-probe.png -------------------------------------------------------------------------------- /images/lab10-no-downtime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab10-no-downtime.png -------------------------------------------------------------------------------- /images/lab10-readiness-probe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab10-readiness-probe.png -------------------------------------------------------------------------------- /images/lab11_http_rule_scale_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab11_http_rule_scale_in.png -------------------------------------------------------------------------------- /images/lab11_http_rule_scale_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab11_http_rule_scale_out.png -------------------------------------------------------------------------------- /images/lab11_service_bus_rule_scale_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab11_service_bus_rule_scale_in.png -------------------------------------------------------------------------------- /images/lab11_service_bus_rule_scale_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab11_service_bus_rule_scale_out.png -------------------------------------------------------------------------------- /images/lab11_service_bus_scale_rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab11_service_bus_scale_rule.png -------------------------------------------------------------------------------- /images/lab2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab2.png -------------------------------------------------------------------------------- /images/lab3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab3.png -------------------------------------------------------------------------------- /images/lab4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab4.png -------------------------------------------------------------------------------- /images/lab5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab5.png -------------------------------------------------------------------------------- /images/lab6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab6.png -------------------------------------------------------------------------------- /images/lab7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab7.png -------------------------------------------------------------------------------- /images/lab8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/lab8.png -------------------------------------------------------------------------------- /images/live-metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/live-metrics.png -------------------------------------------------------------------------------- /images/live-perf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/live-perf.png -------------------------------------------------------------------------------- /images/managed-components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/managed-components.png -------------------------------------------------------------------------------- /images/open-ai-ask-copilot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/open-ai-ask-copilot.png -------------------------------------------------------------------------------- /images/open-ai-eureka-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/open-ai-eureka-client.png -------------------------------------------------------------------------------- /images/open-ai-gen-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/open-ai-gen-1.png -------------------------------------------------------------------------------- /images/open-ai-gen-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/open-ai-gen-2.png -------------------------------------------------------------------------------- /images/open-ai-petclinic-curl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/open-ai-petclinic-curl.png -------------------------------------------------------------------------------- /images/open-ai-rag-bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/open-ai-rag-bot.png -------------------------------------------------------------------------------- /images/overview-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/overview-base.png -------------------------------------------------------------------------------- /images/perf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/perf.png -------------------------------------------------------------------------------- /images/perf2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/perf2.png -------------------------------------------------------------------------------- /images/performance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/performance.png -------------------------------------------------------------------------------- /images/performance2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/performance2.png -------------------------------------------------------------------------------- /images/performance3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/performance3.png -------------------------------------------------------------------------------- /images/petclinic_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/petclinic_app.png -------------------------------------------------------------------------------- /images/pods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/pods.png -------------------------------------------------------------------------------- /images/revision_status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/revision_status.png -------------------------------------------------------------------------------- /images/services.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/services.png -------------------------------------------------------------------------------- /images/spring-boot-admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/spring-boot-admin.png -------------------------------------------------------------------------------- /images/sql-server-manage-firewall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/sql-server-manage-firewall.png -------------------------------------------------------------------------------- /images/system-logs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/images/system-logs.png -------------------------------------------------------------------------------- /infra/bicep/hooks/predown.ps1: -------------------------------------------------------------------------------- 1 | azd config set alpha.deployment.stacks on 2 | -------------------------------------------------------------------------------- /infra/bicep/hooks/predown.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | azd config set alpha.deployment.stacks on 4 | -------------------------------------------------------------------------------- /infra/bicep/modules/acr/acrExisting.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | import { roleAssignmentType, builtInRoleNames } from 'containerRegistryRolesDef.bicep' 4 | 5 | param name string 6 | 7 | param roleAssignments roleAssignmentType 8 | 9 | resource registry 'Microsoft.ContainerRegistry/registries@2023-11-01-preview' existing = { 10 | name: name 11 | } 12 | 13 | resource registry_roleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for (roleAssignment, index) in (roleAssignments ?? []): { 14 | name: guid(registry.id, roleAssignment.principalId, roleAssignment.roleDefinitionIdOrName) 15 | properties: { 16 | roleDefinitionId: builtInRoleNames[?roleAssignment.roleDefinitionIdOrName] ?? roleAssignment.roleDefinitionIdOrName 17 | principalId: roleAssignment.principalId 18 | description: roleAssignment.?description 19 | principalType: roleAssignment.?principalType 20 | condition: roleAssignment.?condition 21 | conditionVersion: !empty(roleAssignment.?condition) ? (roleAssignment.?conditionVersion ?? '2.0') : null // Must only be set if condtion is set 22 | delegatedManagedIdentityResourceId: roleAssignment.?delegatedManagedIdentityResourceId 23 | } 24 | scope: registry 25 | }] 26 | 27 | output name string = registry.name 28 | output loginServer string = registry.properties.loginServer 29 | -------------------------------------------------------------------------------- /infra/bicep/modules/acr/importImage.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | param acrName string 4 | 5 | param images array 6 | 7 | param umiAcrContributorId string 8 | 9 | resource importImage 'Microsoft.Resources/deploymentScripts@2023-08-01' = [ for image in images: { 10 | name: 'acr-import-image-${image.name}' 11 | location: resourceGroup().location 12 | kind: 'AzureCLI' 13 | identity: { 14 | type: 'UserAssigned' 15 | userAssignedIdentities: { 16 | '${umiAcrContributorId}': {} 17 | } 18 | } 19 | properties: { 20 | azCliVersion: '2.63.0' 21 | timeout: 'PT10M' 22 | environmentVariables: [ 23 | { 24 | name: 'acrName' 25 | value: acrName 26 | } 27 | { 28 | name: 'source' 29 | value: image.source 30 | } 31 | { 32 | name: 'target' 33 | value: image.target 34 | } 35 | ] 36 | scriptContent: ''' 37 | az acr import --name $acrName --source $source --image $target --force 38 | ''' 39 | cleanupPreference: 'OnSuccess' 40 | retentionInterval: 'PT1H' 41 | } 42 | }] 43 | 44 | output results array = [ for i in range(0, length(images)): { 45 | name: importImage[i].name 46 | errorCode: importImage[i].properties.status.?error.code 47 | errorMessage: importImage[i].properties.status.?error.message 48 | }] 49 | -------------------------------------------------------------------------------- /infra/bicep/modules/ai/openaiRoleAssignment.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | param accountName string 4 | 5 | param appPrincipalId string 6 | 7 | param roleDefinitionId string 8 | 9 | resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = { 10 | name: accountName 11 | } 12 | 13 | resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 14 | // The role assignment ID must be a GUID. 15 | name: guid(resourceGroup().id, appPrincipalId, roleDefinitionId) 16 | scope: account 17 | properties: { 18 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionId) 19 | principalId: appPrincipalId 20 | } 21 | } 22 | 23 | output endpoint string = account.properties.endpoint 24 | -------------------------------------------------------------------------------- /infra/bicep/modules/database/database.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | param serverName string 4 | 5 | param databaseName string 6 | 7 | resource server 'Microsoft.DBforMySQL/flexibleServers@2023-06-30' existing = { 8 | name: serverName 9 | } 10 | 11 | resource database 'Microsoft.DBforMySQL/flexibleServers/databases@2023-06-30' = { 12 | parent: server 13 | name: databaseName 14 | properties: { 15 | charset: 'utf8' 16 | collation: 'utf8_general_ci' 17 | } 18 | } 19 | 20 | output id string = database.id 21 | -------------------------------------------------------------------------------- /infra/bicep/modules/grafana/azure-managed-grafana.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | @description('Required. Name of your Azure Managed Grafana resource.') 4 | param grafanaName string 5 | 6 | @description('Required. Location for the Azure Managed Grafana resource.') 7 | param location string = resourceGroup().location 8 | 9 | @description('Optional. Tags of the resource.') 10 | param tags object = {} 11 | 12 | resource grafana 'Microsoft.Dashboard/grafana@2023-10-01-preview' = { 13 | name: grafanaName 14 | location: location 15 | properties: { 16 | publicNetworkAccess: 'Enabled' 17 | zoneRedundancy: 'Disabled' 18 | autoGeneratedDomainNameLabelScope: 'TenantReuse' 19 | apiKey: 'Disabled' 20 | deterministicOutboundIP: 'Disabled' 21 | grafanaMajorVersion: '10' 22 | } 23 | tags: tags 24 | sku: { 25 | name: 'Standard' 26 | } 27 | identity: { 28 | type: 'SystemAssigned' 29 | } 30 | } 31 | 32 | output grafanaDashboardEndpoint string = grafana.properties.endpoint 33 | output grafanaPrincipalId string = grafana.identity.principalId 34 | -------------------------------------------------------------------------------- /infra/bicep/modules/grafana/grafana-dashboard.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | @description('Required. Name of your Azure Managed Grafana resource.') 4 | param grafanaName string 5 | 6 | @description('Required. Location of your Azure Managed Grafana resource.') 7 | param location string 8 | 9 | @description('Optional. Tags of the resource.') 10 | param tags object = {} 11 | 12 | module azureManagedGrafana 'azure-managed-grafana.bicep' = { 13 | name: grafanaName 14 | scope: resourceGroup() 15 | params: { 16 | grafanaName: grafanaName 17 | location: location 18 | tags: tags 19 | } 20 | } 21 | 22 | module grafanaRoleAssignment 'grafana-role-assignment.bicep' = { 23 | name: 'role-assignment-${grafanaName}' 24 | scope: resourceGroup() 25 | params: { 26 | grafanaPrincipalId: azureManagedGrafana.outputs.grafanaPrincipalId 27 | } 28 | } 29 | 30 | output grafanaDashboardEndpoint string = azureManagedGrafana.outputs.grafanaDashboardEndpoint 31 | 32 | -------------------------------------------------------------------------------- /infra/bicep/modules/grafana/grafana-role-assignment.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | @description('Required. The principal ID of the Managed Identity for the Grafana resource.') 4 | param grafanaPrincipalId string 5 | 6 | @description('Optional. The role definition ID for the Monitoring Reader role. Default: Monitoring Reader role.') 7 | // https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/monitor#monitoring-reader 8 | param grafanaRoleDefinitionId string = '43d0d8ad-25c7-4714-9337-8ba259a9fe05' // Monitoring Reader role 9 | 10 | resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 11 | name: guid(resourceGroup().id, grafanaPrincipalId, grafanaRoleDefinitionId) 12 | scope: resourceGroup() 13 | properties: { 14 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', grafanaRoleDefinitionId) 15 | principalId: grafanaPrincipalId 16 | principalType: 'ServicePrincipal' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /infra/bicep/modules/shared/resourceGroup.bicep: -------------------------------------------------------------------------------- 1 | targetScope='subscription' 2 | 3 | param resourceGroupName string 4 | param resourceGroupLocation string 5 | 6 | param tags object = {} 7 | 8 | resource rg 'Microsoft.Resources/resourceGroups@2024-03-01' = { 9 | name: resourceGroupName 10 | location: resourceGroupLocation 11 | tags: tags 12 | } 13 | 14 | output name string = rg.name 15 | -------------------------------------------------------------------------------- /infra/bicep/modules/shared/userAssignedIdentity.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'resourceGroup' 2 | 3 | @description('Required. Name of your user managed identity.') 4 | param name string 5 | 6 | param location string = resourceGroup().location 7 | 8 | resource umi 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { 9 | name: name 10 | location: location 11 | } 12 | 13 | output id string = umi.id 14 | 15 | output principalId string = umi.properties.principalId 16 | 17 | output clientId string = umi.properties.clientId 18 | -------------------------------------------------------------------------------- /more.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: More topics 3 | layout: home 4 | nav_order: 95 5 | nav_exclude: true 6 | has_children: true 7 | search_exclude: true 8 | --- 9 | 10 | # More topics 11 | 12 | There are some more topics based on the petclinic microservice repo, you may find your interested topics here. 13 | -------------------------------------------------------------------------------- /solution/sampleENVIRONMENT.azcli: -------------------------------------------------------------------------------- 1 | az login --use-device-code 2 | az account list -o table 3 | 4 | UNIQUEID= 5 | APPNAME=petclinic 6 | RESOURCE_GROUP=rg-$APPNAME-$UNIQUEID 7 | LOCATION=northeurope 8 | MYACR=acr$APPNAME$UNIQUEID 9 | az acr login --name $MYACR 10 | 11 | VIRTUAL_NETWORK_NAME=vnet-$APPNAME-$UNIQUEID 12 | AKS_SUBNET_CIDR=10.1.0.0/24 13 | SUBNET_ID=$(az network vnet subnet show --resource-group $RESOURCE_GROUP --vnet-name $VIRTUAL_NETWORK_NAME --name aca-subnet --query id -o tsv) 14 | ACA_ENVIRONMENT=acaenv-$APPNAME-$UNIQUEID 15 | MYSQL_SERVER_NAME=mysql-$APPNAME-$UNIQUEID 16 | MYSQL_ADMIN_USERNAME=myadmin 17 | MYSQL_ADMIN_PASSWORD= 18 | DATABASE_NAME=petclinic 19 | NAMESPACE=spring-petclinic 20 | VERSION=3.0.2 21 | 22 | KEYVAULT_NAME=kv-$APPNAME-$UNIQUEID 23 | GIT_PAT= 24 | 25 | AKS_OIDC_ISSUER= 26 | FEDERATED_IDENTITY_CREDENTIAL_NAME=fedid-$APPNAME-$UNIQUEID 27 | ADTENANT= 28 | 29 | AZ_MYSQL_AD_NON_ADMIN_USERID= 30 | 31 | CURRENT_USER_OBJECTID= 32 | 33 | SERVICEBUS_NAMESPACE=sb-$APPNAME-$UNIQUEID 34 | 35 | EVENTHUBS_NAMESPACE=evhns-$APPNAME-$UNIQUEID 36 | 37 | 38 | -------------------------------------------------------------------------------- /solution/samplebashrc: -------------------------------------------------------------------------------- 1 | UNIQUEID= 2 | APPNAME=petclinic 3 | RESOURCE_GROUP=rg-$APPNAME-$UNIQUEID 4 | LOCATION=northeurope 5 | MYACR=acr$APPNAME$UNIQUEID 6 | 7 | VIRTUAL_NETWORK_NAME=vnet-$APPNAME-$UNIQUEID 8 | AKS_SUBNET_CIDR=10.1.0.0/24 9 | ACA_ENVIRONMENT=acaenv-$APPNAME-$UNIQUEID 10 | MYSQL_SERVER_NAME=mysql-$APPNAME-$UNIQUEID 11 | MYSQL_ADMIN_USERNAME=myadmin 12 | MYSQL_ADMIN_PASSWORD= 13 | DATABASE_NAME=petclinic 14 | NAMESPACE=spring-petclinic 15 | VERSION=3.0.2 16 | 17 | KEYVAULT_NAME=kv-$APPNAME-$UNIQUEID 18 | GIT_PAT= 19 | 20 | AKS_OIDC_ISSUER= 21 | FEDERATED_IDENTITY_CREDENTIAL_NAME=fedid-$APPNAME-$UNIQUEID 22 | ADTENANT= 23 | 24 | AZ_MYSQL_AD_NON_ADMIN_USERID= 25 | 26 | CURRENT_USER_OBJECTID= 27 | 28 | SERVICEBUS_NAMESPACE=sb-$APPNAME-$UNIQUEID 29 | 30 | EVENTHUBS_NAMESPACE=evhns-$APPNAME-$UNIQUEID 31 | -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | indent_style = space 9 | 10 | [*.{java,xml}] 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | -------------------------------------------------------------------------------- /src/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /src/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.4/maven-wrapper-0.5.4.jar 3 | -------------------------------------------------------------------------------- /src/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:17 as builder 2 | WORKDIR application 3 | ARG ARTIFACT_NAME 4 | COPY ${ARTIFACT_NAME}.jar application.jar 5 | RUN java -Djarmode=layertools -jar application.jar extract 6 | 7 | # Download dockerize and cache that layer 8 | ARG DOCKERIZE_VERSION 9 | RUN wget -O dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz 10 | RUN tar xzf dockerize.tar.gz 11 | RUN chmod +x dockerize 12 | 13 | 14 | FROM eclipse-temurin:17 15 | 16 | WORKDIR application 17 | 18 | # Dockerize 19 | COPY --from=builder application/dockerize ./ 20 | 21 | ARG EXPOSED_PORT 22 | EXPOSE ${EXPOSED_PORT} 23 | 24 | ENV SPRING_PROFILES_ACTIVE docker 25 | 26 | COPY --from=builder application/dependencies/ ./ 27 | COPY --from=builder application/spring-boot-loader/ ./ 28 | COPY --from=builder application/snapshot-dependencies/ ./ 29 | COPY --from=builder application/application/ ./ 30 | ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] 31 | -------------------------------------------------------------------------------- /src/docker/grafana/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grafana/grafana:5.2.4 2 | ADD ./provisioning /etc/grafana/provisioning 3 | ADD ./grafana.ini /etc/grafana/grafana.ini 4 | ADD ./dashboards /var/lib/grafana/dashboards 5 | -------------------------------------------------------------------------------- /src/docker/grafana/grafana.ini: -------------------------------------------------------------------------------- 1 | ##################### Spring Petclinic Microservices Grafana Configuration ##################### 2 | 3 | # possible values : production, development 4 | app_mode = development 5 | 6 | #################################### Paths #################################### 7 | [paths] 8 | # folder that contains provisioning config files that grafana will apply on startup and while running. 9 | provisioning = /etc/grafana/provisioning 10 | 11 | #################################### Server #################################### 12 | [server] 13 | # enable gzip 14 | enable_gzip = true 15 | 16 | #################################### Anonymous Auth ########################## 17 | # Anonymous authentication has been enabled in the Petclinic sample with Admin role 18 | # Do not do that in Production environment 19 | [auth.anonymous] 20 | # enable anonymous access 21 | enabled = true 22 | 23 | # specify organization name that should be used for unauthenticated users 24 | org_name = Main Org. 25 | 26 | # specify role for unauthenticated users 27 | org_role = Admin 28 | -------------------------------------------------------------------------------- /src/docker/grafana/provisioning/dashboards/all.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'default' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards 10 | options: 11 | path: /var/lib/grafana/dashboards 12 | -------------------------------------------------------------------------------- /src/docker/grafana/provisioning/datasources/all.yml: -------------------------------------------------------------------------------- 1 | # config file version 2 | apiVersion: 1 3 | 4 | # list of datasources to insert/update depending what's available in the database 5 | datasources: 6 | - name: Prometheus 7 | type: prometheus 8 | access: proxy 9 | org_id: 1 10 | url: http://prometheus-server:9090 11 | is_default: true 12 | version: 1 13 | editable: true 14 | -------------------------------------------------------------------------------- /src/docker/prometheus/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM prom/prometheus:v2.4.2 2 | ADD prometheus.yml /etc/prometheus/ 3 | -------------------------------------------------------------------------------- /src/docker/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | # my global config 2 | global: 3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. 4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. 5 | # scrape_timeout is set to the global default (10s). 6 | 7 | # A scrape configuration containing exactly one endpoint to scrape: 8 | # Here it's Prometheus itself. 9 | scrape_configs: 10 | - job_name: prometheus 11 | static_configs: 12 | - targets: ['localhost:9090'] 13 | 14 | - job_name: api-gateway 15 | metrics_path: /actuator/prometheus 16 | static_configs: 17 | - targets: ['api-gateway:8080'] 18 | 19 | - job_name: customers-service 20 | metrics_path: /actuator/prometheus 21 | static_configs: 22 | - targets: ['customers-service:8081'] 23 | 24 | - job_name: visits-service 25 | metrics_path: /actuator/prometheus 26 | static_configs: 27 | - targets: ['visits-service:8082'] 28 | 29 | - job_name: vets-service 30 | metrics_path: /actuator/prometheus 31 | static_configs: 32 | - targets: ['vets-service:8083'] 33 | -------------------------------------------------------------------------------- /src/docs/application-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/docs/application-screenshot.png -------------------------------------------------------------------------------- /src/docs/grafana-custom-metrics-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/docs/grafana-custom-metrics-dashboard.png -------------------------------------------------------------------------------- /src/docs/microservices-architecture-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/docs/microservices-architecture-diagram.jpg -------------------------------------------------------------------------------- /src/scripts/chaos/attacks_disable.json: -------------------------------------------------------------------------------- 1 | { 2 | "latencyActive": false, 3 | "exceptionsActive": false, 4 | "killApplicationActive": false, 5 | "memoryActive": false 6 | } 7 | -------------------------------------------------------------------------------- /src/scripts/chaos/attacks_enable_exception.json: -------------------------------------------------------------------------------- 1 | { 2 | "exceptionsActive": true, 3 | "level" : 5 4 | } 5 | -------------------------------------------------------------------------------- /src/scripts/chaos/attacks_enable_killapplication.json: -------------------------------------------------------------------------------- 1 | { 2 | "killApplicationActive": true 3 | } 4 | -------------------------------------------------------------------------------- /src/scripts/chaos/attacks_enable_latency.json: -------------------------------------------------------------------------------- 1 | { 2 | "latencyActive": true, 3 | "latencyRangeStart" : 1000, 4 | "latencyRangeEnd" : 10000 5 | } 6 | -------------------------------------------------------------------------------- /src/scripts/chaos/attacks_enable_memory.json: -------------------------------------------------------------------------------- 1 | { 2 | "memoryActive": true, 3 | "level" : 5 4 | } 5 | -------------------------------------------------------------------------------- /src/scripts/chaos/watcher_disable.json: -------------------------------------------------------------------------------- 1 | { 2 | "controller": false, 3 | "restController": false, 4 | "service": false, 5 | "repository": false, 6 | "component": false 7 | } 8 | -------------------------------------------------------------------------------- /src/scripts/chaos/watcher_enable_component.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true 3 | } 4 | -------------------------------------------------------------------------------- /src/scripts/chaos/watcher_enable_controller.json: -------------------------------------------------------------------------------- 1 | { 2 | "controller": true 3 | } 4 | -------------------------------------------------------------------------------- /src/scripts/chaos/watcher_enable_repository.json: -------------------------------------------------------------------------------- 1 | { 2 | "repository": true 3 | } 4 | -------------------------------------------------------------------------------- /src/scripts/chaos/watcher_enable_restcontroller.json: -------------------------------------------------------------------------------- 1 | { 2 | "restController": true 3 | } 4 | -------------------------------------------------------------------------------- /src/scripts/chaos/watcher_enable_service.json: -------------------------------------------------------------------------------- 1 | { 2 | "service": true 3 | } 4 | -------------------------------------------------------------------------------- /src/spring-petclinic-admin-server/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-admin-server/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-admin-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: admin-server 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | 7 | 8 | --- 9 | spring: 10 | config: 11 | activate: 12 | on-profile: docker 13 | import: configserver:http://config-server:8888 14 | -------------------------------------------------------------------------------- /src/spring-petclinic-admin-server/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/ChatMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.*; 19 | 20 | /** 21 | * Represents a chat message in the chat application. 22 | */ 23 | @Getter 24 | @Setter 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @Builder 28 | public class ChatMessage { 29 | 30 | private String content; 31 | 32 | private String sender; 33 | 34 | private MessageType type; 35 | 36 | /** 37 | * Enum representing the type of the chat message. 38 | */ 39 | public enum MessageType { 40 | 41 | CHAT, LEAVE, JOIN 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/PetDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | /** 24 | * @author Maciej Szarlinski 25 | */ 26 | @Data 27 | public class PetDetails { 28 | 29 | private int id; 30 | 31 | private String name; 32 | 33 | private String birthDate; 34 | 35 | private PetType type; 36 | 37 | private final List visits = new ArrayList<>(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/PetType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.Data; 19 | 20 | /** 21 | * @author Maciej Szarlinski 22 | */ 23 | @Data 24 | public class PetType { 25 | 26 | private String name; 27 | } 28 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/VisitDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import lombok.Data; 19 | import lombok.NoArgsConstructor; 20 | 21 | /** 22 | * @author Maciej Szarlinski 23 | */ 24 | @Data 25 | @NoArgsConstructor 26 | public class VisitDetails { 27 | 28 | private Integer id = null; 29 | 30 | private Integer petId = null; 31 | 32 | private String date = null; 33 | 34 | private String description = null; 35 | } 36 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/Visits.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.api.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import lombok.NoArgsConstructor; 22 | import lombok.Value; 23 | 24 | /** 25 | * @author Maciej Szarlinski 26 | */ 27 | @Value 28 | public class Visits { 29 | 30 | private List items = new ArrayList<>(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/less/responsive.less: -------------------------------------------------------------------------------- 1 | @media (max-width: 768px) { 2 | .navbar-toggle { 3 | position:absolute; 4 | z-index: 9999; 5 | left:0px; 6 | top:0px; 7 | } 8 | 9 | .navbar a.navbar-brand { 10 | display: block; 11 | margin: 0 auto 0 auto; 12 | width: 148px; 13 | height: 50px; 14 | float: none; 15 | background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat; 16 | } 17 | 18 | .homepage-billboard .homepage-subtitle { 19 | font-size: 21px; 20 | line-height: 21px; 21 | } 22 | 23 | .navbar a.navbar-brand span { 24 | display: none; 25 | } 26 | 27 | .navbar { 28 | border-top-width: 0; 29 | } 30 | 31 | .xd-container { 32 | margin-top: 20px; 33 | margin-bottom: 30px; 34 | } 35 | 36 | .index-page--subtitle { 37 | margin-top: 10px; 38 | margin-bottom: 30px; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: api-gateway 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | cloud: 7 | gateway: 8 | routes: 9 | - id: vets-service 10 | uri: lb://vets-service 11 | predicates: 12 | - Path=/api/vet/** 13 | filters: 14 | - StripPrefix=2 15 | - id: visits-service 16 | uri: lb://visits-service 17 | predicates: 18 | - Path=/api/visit/** 19 | filters: 20 | - StripPrefix=2 21 | - id: customers-service 22 | uri: lb://customers-service 23 | predicates: 24 | - Path=/api/customer/** 25 | filters: 26 | - StripPrefix=2 27 | - id: chat-agent 28 | uri: lb://chat-agent 29 | predicates: 30 | - Path=/api/chat/** 31 | filters: 32 | - StripPrefix=2 33 | 34 | 35 | 36 | --- 37 | spring: 38 | config: 39 | activate: 40 | on-profile: docker 41 | import: configserver:http://config-server:8888 42 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/messages/messages.properties: -------------------------------------------------------------------------------- 1 | required=is required 2 | notFound=has not been found 3 | duplicate=is already in use 4 | nonNumeric=must be all numeric 5 | duplicateFormSubmission=Duplicate form submission is not allowed 6 | typeMismatch.date=invalid date 7 | typeMismatch.birthDate=invalid date 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/messages/messages_de.properties: -------------------------------------------------------------------------------- 1 | required=muss angegeben werden 2 | notFound=wurde nicht gefunden 3 | duplicate=ist bereits vergeben 4 | nonNumeric=darf nur numerisch sein 5 | duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt 6 | typeMismatch.date=ung�ltiges Datum 7 | typeMismatch.birthDate=ung�ltiges Datum 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/messages/messages_en.properties: -------------------------------------------------------------------------------- 1 | # This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/images/favicon.png -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/images/pets.png -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/images/platform-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/images/platform-bg.png -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo.png -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/agent/agent.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('agent') 4 | .component('agent', { 5 | templateUrl: 'scripts/agent/agent.template.html' 6 | }); 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/agent/agent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('agent', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('agent', { 7 | parent: 'app', 8 | url: '/agent', 9 | template: '' 10 | }) 11 | }]); 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/fragments/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Sponsored by Pivotal
5 |
6 |
-------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/fragments/welcome.html: -------------------------------------------------------------------------------- 1 |

Welcome to Petclinic

2 | 3 |
4 |
5 | pets logo 6 |
7 |
-------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/infrastructure/httpErrorHandlingInterceptor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Global HTTP errors handler. 5 | */ 6 | angular.module('infrastructure') 7 | .factory('HttpErrorHandlingInterceptor', function () { 8 | return { 9 | responseError: function (response) { 10 | var error = response.data; 11 | alert(error.error + "\r\n" + error.errors.map(function (e) { 12 | return e.field + ": " + e.defaultMessage; 13 | }).join("\r\n")); 14 | return response; 15 | } 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/infrastructure/infrastructure.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('infrastructure', []); 4 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .component('ownerDetails', { 5 | templateUrl: 'scripts/owner-details/owner-details.template.html', 6 | controller: 'OwnerDetailsController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails') 4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { 5 | var self = this; 6 | 7 | $http.get('api/gateway/owners/' + $stateParams.ownerId).then(function (resp) { 8 | self.owner = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerDetails', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerDetails', { 7 | parent: 'app', 8 | url: '/owners/details/:ownerId', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .component('ownerForm', { 5 | templateUrl: 'scripts/owner-form/owner-form.template.html', 6 | controller: 'OwnerFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm') 4 | .controller('OwnerFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | var ownerId = $stateParams.ownerId || 0; 8 | 9 | if (!ownerId) { 10 | self.owner = {}; 11 | } else { 12 | $http.get("api/customer/owners/" + ownerId).then(function (resp) { 13 | self.owner = resp.data; 14 | }); 15 | } 16 | 17 | self.submitOwnerForm = function () { 18 | var id = self.owner.id; 19 | 20 | if (id) { 21 | $http.put('api/customer/owners/' + id, self.owner).then(function () { 22 | $state.go('ownerDetails', {ownerId: ownerId}); 23 | }); 24 | } else { 25 | $http.post('api/customer/owners', self.owner).then(function () { 26 | $state.go('owners'); 27 | }); 28 | } 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('ownerNew', { 7 | parent: 'app', 8 | url: '/owners/new', 9 | template: '' 10 | }) 11 | .state('ownerEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/edit', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .component('ownerList', { 5 | templateUrl: 'scripts/owner-list/owner-list.template.html', 6 | controller: 'OwnerListController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList') 4 | .controller('OwnerListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get('api/customer/owners').then(function (resp) { 8 | self.owners = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('ownerList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('owners', { 7 | parent: 'app', 8 | url: '/owners', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.template.html: -------------------------------------------------------------------------------- 1 |

Owners

2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 |
NameCityTelephone
22 | 23 | {{owner.firstName}} {{owner.lastName}} 24 | 25 | {{owner.city}}{{owner.telephone}}
32 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm') 4 | .component('petForm', { 5 | templateUrl: 'scripts/pet-form/pet-form.template.html', 6 | controller: 'PetFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('petForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('petNew', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/new-pet', 9 | template: '' 10 | }) 11 | .state('petEdit', { 12 | parent: 'app', 13 | url: '/owners/:ownerId/pets/:petId', 14 | template: '' 15 | }) 16 | }]); 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .component('vetList', { 5 | templateUrl: 'scripts/vet-list/vet-list.template.html', 6 | controller: 'VetListController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList') 4 | .controller('VetListController', ['$http', function ($http) { 5 | var self = this; 6 | 7 | $http.get('api/vet/vets').then(function (resp) { 8 | self.vetList = resp.data; 9 | }); 10 | }]); 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('vetList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('vets', { 7 | parent: 'app', 8 | url: '/vets', 9 | template: '' 10 | }) 11 | }]); -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.template.html: -------------------------------------------------------------------------------- 1 |

Veterinarians

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameSpecialties
{{vet.firstName}} {{vet.lastName}}{{specialty.name + ' '}}
16 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .component('visits', { 5 | templateUrl: 'scripts/visits/visits.template.html', 6 | controller: 'VisitsController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits') 4 | .controller('VisitsController', ['$http', '$state', '$stateParams', '$filter', function ($http, $state, $stateParams, $filter) { 5 | var self = this; 6 | var petId = $stateParams.petId || 0; 7 | var url = "api/visit/owners/" + ($stateParams.ownerId || 0) + "/pets/" + petId + "/visits"; 8 | self.date = new Date(); 9 | self.desc = ""; 10 | 11 | $http.get(url).then(function (resp) { 12 | self.visits = resp.data; 13 | }); 14 | 15 | self.submit = function () { 16 | var data = { 17 | date: $filter('date')(self.date, "yyyy-MM-dd"), 18 | description: self.desc 19 | }; 20 | 21 | $http.post(url, data).then(function () { 22 | $state.go('ownerDetails', { ownerId: $stateParams.ownerId }); 23 | }); 24 | }; 25 | }]); 26 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('visits', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('visits', { 7 | parent: 'app', 8 | url: '/owners/:ownerId/pets/:petId/visits', 9 | template: '' 10 | }) 11 | }]); 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.template.html: -------------------------------------------------------------------------------- 1 |

Visits

2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | 12 | 13 |
14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 |

Previous Visits

22 | 23 | 24 | 25 | 26 | 27 |
{{v.date}}{{v.description}}
-------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/wro/wro.properties: -------------------------------------------------------------------------------- 1 | #List of preProcessors 2 | preProcessors=lessCssImport 3 | #List of postProcessors 4 | postProcessors=less4j -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/main/wro/wro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | classpath:META-INF/resources/webjars/bootstrap/3.3.7-1/less/bootstrap.less 4 | /petclinic.less 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/test/java/org/springframework/samples/petclinic/api/ApiGatewayApplicationTests.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.api; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | import org.springframework.test.context.ActiveProfiles; 6 | 7 | @ActiveProfiles("test") 8 | @SpringBootTest 9 | class ApiGatewayApplicationTests { 10 | 11 | @Test 12 | void contextLoads() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/test/java/org/springframework/samples/petclinic/api/boundary/web/CircuitBreakerConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.api.boundary.web; 2 | 3 | import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry; 4 | import io.github.resilience4j.timelimiter.TimeLimiterRegistry; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class CircuitBreakerConfiguration { 10 | 11 | @Bean 12 | public CircuitBreakerRegistry circuitBreakerRegistry() { 13 | return CircuitBreakerRegistry.ofDefaults(); 14 | } 15 | 16 | @Bean 17 | public TimeLimiterRegistry timeLimiterRegistry() { 18 | return TimeLimiterRegistry.ofDefaults(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/spring-petclinic-api-gateway/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring.cloud.config.enabled: false 2 | eureka.client.enabled: false 3 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/chat/ChatModelProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.chat; 17 | 18 | import lombok.Getter; 19 | import lombok.Setter; 20 | import org.springframework.boot.context.properties.ConfigurationProperties; 21 | 22 | @Getter 23 | @Setter 24 | @ConfigurationProperties(prefix = ChatModelProperties.PREFIX) 25 | public class ChatModelProperties { 26 | 27 | static final String PREFIX = "spring.ai.azure.openai"; 28 | 29 | String endpoint; 30 | 31 | String clientId; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/chat/ChatOptionsProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.chat; 17 | 18 | import lombok.Getter; 19 | import lombok.Setter; 20 | import org.springframework.boot.context.properties.ConfigurationProperties; 21 | 22 | @Getter 23 | @Setter 24 | @ConfigurationProperties(prefix = ChatOptionsProperties.PREFIX) 25 | public class ChatOptionsProperties { 26 | 27 | static final String PREFIX = "spring.ai.azure.openai.chat.options"; 28 | 29 | String deploymentName; 30 | 31 | Float temperature; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/model/Owner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.model; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | import java.util.Set; 22 | 23 | @Data 24 | public class Owner implements Serializable { 25 | 26 | private Integer id; 27 | 28 | private String firstName; 29 | 30 | private String lastName; 31 | 32 | private String address; 33 | 34 | private String city; 35 | 36 | private String telephone; 37 | 38 | private Set pets; 39 | } 40 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/model/Pet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.model; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | import java.util.Date; 22 | 23 | @Data 24 | public class Pet implements Serializable { 25 | 26 | private Integer id; 27 | 28 | private String name; 29 | 30 | private Date birthDate; 31 | 32 | private PetType type; 33 | 34 | private Owner owner; 35 | } 36 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/model/PetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.agent.model; 17 | 18 | import com.fasterxml.jackson.annotation.JsonFormat; 19 | import jakarta.validation.constraints.Size; 20 | import lombok.Data; 21 | 22 | import java.util.Date; 23 | 24 | /** 25 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 26 | */ 27 | @Data 28 | public class PetRequest { 29 | private int id; 30 | 31 | @JsonFormat(pattern = "yyyy-MM-dd") 32 | private Date birthDate; 33 | 34 | @Size(min = 1) 35 | private String name; 36 | 37 | private int typeId; 38 | } 39 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/model/PetType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.model; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | @Data 23 | public class PetType implements Serializable { 24 | 25 | private Integer id; 26 | 27 | private String name; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/model/Specialty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.model; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | @Data 23 | public class Specialty implements Serializable { 24 | 25 | private Integer id; 26 | 27 | private String name; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/model/Vet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.model; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | import java.util.Set; 22 | 23 | @Data 24 | public class Vet implements Serializable { 25 | 26 | private Integer id; 27 | 28 | private String firstName; 29 | 30 | private String lastName; 31 | 32 | private Set specialties; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/service/PetService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.agent.service; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.samples.petclinic.agent.model.Pet; 5 | import org.springframework.samples.petclinic.agent.model.PetRequest; 6 | import org.springframework.samples.petclinic.agent.model.PetType; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | @Service 11 | public class PetService { 12 | 13 | private final RestTemplate restTemplate; 14 | 15 | @Autowired 16 | public PetService(RestTemplate restTemplate) { 17 | this.restTemplate = restTemplate; 18 | } 19 | 20 | public void addPet(int ownerId, PetRequest pet) { 21 | restTemplate.postForEntity("http://customers-service/owners/" + ownerId + "/pets", pet, Pet.class); 22 | } 23 | 24 | public Pet findPetByName(String petName) { 25 | return restTemplate.getForObject("http://customers-service/owners/*/pets?petName=" + petName, Pet.class); 26 | } 27 | 28 | public PetType findPetTypeByName(String typeName) { 29 | return restTemplate.getForObject("http://customers-service/petType?typeName=" + typeName, PetType.class); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/service/VisitService.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.agent.service; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.samples.petclinic.agent.model.Visit; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @Configuration 9 | public class VisitService { 10 | 11 | private final RestTemplate restTemplate; 12 | 13 | @Autowired 14 | public VisitService(RestTemplate restTemplate) { 15 | this.restTemplate = restTemplate; 16 | } 17 | 18 | public void addVisit(int petId, Visit visit) { 19 | restTemplate.postForEntity("http://visits-service/owners/*/pets/" + petId + "/visits", visit, Visit.class); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/system/CrashController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.system; 17 | 18 | import org.springframework.stereotype.Controller; 19 | import org.springframework.web.bind.annotation.GetMapping; 20 | 21 | /** 22 | * Controller used to showcase what happens when an exception is thrown 23 | */ 24 | @Controller 25 | class CrashController { 26 | 27 | @GetMapping("/oups") 28 | public String triggerException() { 29 | throw new RuntimeException( 30 | "Expected: controller used to showcase what " + "happens when an exception is thrown"); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/java/org/springframework/samples/petclinic/agent/system/WelcomeController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2024 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 | package org.springframework.samples.petclinic.agent.system; 17 | 18 | import org.springframework.stereotype.Controller; 19 | import org.springframework.web.bind.annotation.GetMapping; 20 | 21 | @Controller 22 | class WelcomeController { 23 | 24 | @GetMapping("/") 25 | public String welcome() { 26 | return "welcome"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: chat-agent 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/messages/messages.properties: -------------------------------------------------------------------------------- 1 | welcome=Welcome 2 | required=is required 3 | notFound=has not been found 4 | duplicate=is already in use 5 | nonNumeric=must be all numeric 6 | duplicateFormSubmission=Duplicate form submission is not allowed 7 | typeMismatch.date=invalid date 8 | typeMismatch.birthDate=invalid date 9 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/messages/messages_de.properties: -------------------------------------------------------------------------------- 1 | welcome=Willkommen 2 | required=muss angegeben werden 3 | notFound=wurde nicht gefunden 4 | duplicate=ist bereits vergeben 5 | nonNumeric=darf nur numerisch sein 6 | duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt 7 | typeMismatch.date=ung�ltiges Datum 8 | typeMismatch.birthDate=ung�ltiges Datum 9 | 10 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/messages/messages_en.properties: -------------------------------------------------------------------------------- 1 | # This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/messages/messages_es.properties: -------------------------------------------------------------------------------- 1 | welcome=Bienvenido 2 | required=Es requerido 3 | notFound=No ha sido encontrado 4 | duplicate=Ya se encuentra en uso 5 | nonNumeric=Sólo debe contener numeros 6 | duplicateFormSubmission=No se permite el envío de formularios duplicados 7 | typeMismatch.date=Fecha invalida 8 | typeMismatch.birthDate=Fecha invalida 9 | 10 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/messages/messages_ko.properties: -------------------------------------------------------------------------------- 1 | welcome=환영합니다 2 | required=입력이 필요합니다 3 | notFound=찾을 수 없습니다 4 | duplicate=이미 존재합니다 5 | nonNumeric=모두 숫자로 입력해야 합니다 6 | duplicateFormSubmission=중복 제출은 허용되지 않습니다 7 | typeMismatch.date=잘못된 날짜입니다 8 | typeMismatch.birthDate=잘못된 날짜입니다 9 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/petclinic-terms-of-use.txt: -------------------------------------------------------------------------------- 1 | Pet clinic Terms of Use 2 | 1. Vets 3 | 1.1 Query all vets and their specialty, the specialty can be used to recommend a vets according to the pet problem. 4 | 5 | 2. Owners 6 | 2.1 Owner is the petclinic customer 7 | 2.2 Query all the owners information, the owner information include the owner id, first name, last name, city, telephone, address and their pets 8 | 2.3 Can add an owner by providing first name, last name, city, telephone and address. The information of city, telephone and address must be provided by customer and please don't use the default value. 9 | 2.4 Can update an owner by providing first name. 10 | 11 | 3. Pets 12 | 3.1 Can add a pet by input the owner first name, pet name, pet type, the pet type should be one cat, dog, lizard, snake, bird and hamster. 13 | 14 | 4. Visits 15 | 4.1 Can add a visit for a pet by providing pet name, visit date, and description. 16 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/prompts/system-message.st: -------------------------------------------------------------------------------- 1 | You are a customer support agent of a pet clinic. You will answer question from a petclinic customer. 2 | you will always answer the customer question according to Pet clinic Terms of Use 3 | The customer last name is {username} 4 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/images/spring-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/images/spring-logo.png -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/favicon.png -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/pets.png -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-chat-agent/src/main/resources/static/resources/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Something happened...

8 |

Exception message

9 | 10 | 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/templates/fragments/inputField.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
8 | 9 |
10 |
11 | 12 | 13 |
14 | 17 | 18 | 21 | Error 22 | 23 |
24 |
25 |
26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/templates/fragments/selectField.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
8 | 9 | 10 |
11 | 16 | 19 | 20 | 23 | Error 24 | 25 |
26 |
27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/resources/templates/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Welcome

8 |
9 |
10 | 11 |
12 |
13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-chat-agent/src/main/scss/responsive.scss: -------------------------------------------------------------------------------- 1 | @media (max-width: 768px) { 2 | .navbar-toggle { 3 | position:absolute; 4 | z-index: 9999; 5 | left:0px; 6 | top:0px; 7 | } 8 | 9 | .navbar a.navbar-brand { 10 | display: block; 11 | margin: 0 auto 0 auto; 12 | width: 148px; 13 | height: 50px; 14 | float: none; 15 | background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat; 16 | } 17 | 18 | .homepage-billboard .homepage-subtitle { 19 | font-size: 21px; 20 | line-height: 21px; 21 | } 22 | 23 | .navbar a.navbar-brand span { 24 | display: none; 25 | } 26 | 27 | .navbar { 28 | border-top-width: 0; 29 | } 30 | 31 | .xd-container { 32 | margin-top: 20px; 33 | margin-bottom: 30px; 34 | } 35 | 36 | .index-page--subtitle { 37 | margin-top: 10px; 38 | margin-bottom: 30px; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/spring-petclinic-config-server/src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.config; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.config.server.EnableConfigServer; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @EnableConfigServer 26 | @SpringBootApplication 27 | public class ConfigServerApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(ConfigServerApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/spring-petclinic-config-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server.port: 8888 2 | spring: 3 | cloud: 4 | config: 5 | server: 6 | git: 7 | uri: https://github.com/sonalika-roy/spring-petclinic-microservices-config 8 | username: sonalika-roy 9 | password: ${git_pat} 10 | default-label: main 11 | # Use the File System Backend to avoid git pulling. Enable "native" profile in the Config Server. 12 | native: 13 | searchLocations: file:///${GIT_REPO} 14 | 15 | -------------------------------------------------------------------------------- /src/spring-petclinic-config-server/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Spring Cloud Config Server

5 |

The Spring Cloud Config Server provides an HTTP resource-based API for external yaml configuration for all the Spring Petclinic microservices

6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/spring-petclinic-config-server/src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.config; 17 | 18 | import org.junit.jupiter.api.Test; 19 | import org.springframework.boot.test.context.SpringBootTest; 20 | 21 | @SpringBootTest 22 | class PetclinicConfigServerApplicationTests { 23 | 24 | @Test 25 | void contextLoads() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/spring-petclinic-config-server/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | server: 5 | git: 6 | uri: https://github.com/spring-petclinic/spring-petclinic-microservices-config 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/config/MetricConfig.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.config; 2 | 3 | import io.micrometer.core.aop.TimedAspect; 4 | import io.micrometer.core.instrument.MeterRegistry; 5 | import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | @Configuration 10 | public class MetricConfig { 11 | 12 | @Bean 13 | MeterRegistryCustomizer metricsCommonTags() { 14 | return registry -> registry.config().commonTags("application", "petclinic"); 15 | } 16 | 17 | @Bean 18 | TimedAspect timedAspect(MeterRegistry registry) { 19 | return new TimedAspect(registry); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.customers.web; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.Date; 21 | 22 | import jakarta.validation.constraints.Size; 23 | 24 | import com.fasterxml.jackson.annotation.JsonFormat; 25 | 26 | /** 27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05. 28 | */ 29 | @Data 30 | class PetRequest { 31 | private int id; 32 | 33 | @JsonFormat(pattern = "yyyy-MM-dd") 34 | private Date birthDate; 35 | 36 | @Size(min = 1) 37 | private String name; 38 | 39 | private int typeId; 40 | } 41 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.customers.web; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 7 | public class ResourceNotFoundException extends RuntimeException { 8 | 9 | public ResourceNotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: customers-service 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | 7 | 8 | --- 9 | spring: 10 | config: 11 | activate: 12 | on-profile: docker 13 | import: configserver:http://config-server:8888 14 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/db/hsqldb/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE pets IF EXISTS; 2 | DROP TABLE types IF EXISTS; 3 | DROP TABLE owners IF EXISTS; 4 | 5 | CREATE TABLE types ( 6 | id INTEGER IDENTITY PRIMARY KEY, 7 | name VARCHAR(80) 8 | ); 9 | CREATE INDEX types_name ON types (name); 10 | 11 | CREATE TABLE owners ( 12 | id INTEGER IDENTITY PRIMARY KEY, 13 | first_name VARCHAR(30), 14 | last_name VARCHAR(30), 15 | address VARCHAR(255), 16 | city VARCHAR(80), 17 | telephone VARCHAR(12) 18 | ); 19 | CREATE INDEX owners_last_name ON owners (last_name); 20 | 21 | CREATE TABLE pets ( 22 | id INTEGER IDENTITY PRIMARY KEY, 23 | name VARCHAR(30), 24 | birth_date DATE, 25 | type_id INTEGER NOT NULL, 26 | owner_id INTEGER NOT NULL 27 | ); 28 | ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners (id); 29 | ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types (id); 30 | CREATE INDEX pets_name ON pets (name); 31 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | USE petclinic; 2 | 3 | CREATE TABLE IF NOT EXISTS types ( 4 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 5 | name VARCHAR(80), 6 | INDEX(name) 7 | ) engine=InnoDB; 8 | 9 | CREATE TABLE IF NOT EXISTS owners ( 10 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 11 | first_name VARCHAR(30), 12 | last_name VARCHAR(30), 13 | address VARCHAR(255), 14 | city VARCHAR(80), 15 | telephone VARCHAR(20), 16 | INDEX(last_name) 17 | ) engine=InnoDB; 18 | 19 | CREATE TABLE IF NOT EXISTS pets ( 20 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 21 | name VARCHAR(30), 22 | birth_date DATE, 23 | type_id INT(4) UNSIGNED NOT NULL, 24 | owner_id INT(4) UNSIGNED NOT NULL, 25 | INDEX(name), 26 | FOREIGN KEY (owner_id) REFERENCES owners(id), 27 | FOREIGN KEY (type_id) REFERENCES types(id) 28 | ) engine=InnoDB; 29 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/db/postgres/schema.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE TABLE IF NOT EXISTS types ( 3 | id SERIAL PRIMARY KEY, 4 | name VARCHAR(80) NOT NULL, 5 | UNIQUE (name) 6 | ); 7 | 8 | 9 | CREATE TABLE IF NOT EXISTS owners ( 10 | id SERIAL PRIMARY KEY, 11 | first_name VARCHAR(30) NOT NULL, 12 | last_name VARCHAR(30) NOT NULL, 13 | address VARCHAR(255) NOT NULL, 14 | city VARCHAR(80) NOT NULL, 15 | telephone VARCHAR(20) NOT NULL 16 | ); 17 | 18 | 19 | CREATE TABLE IF NOT EXISTS pets ( 20 | id SERIAL PRIMARY KEY, 21 | name VARCHAR(30) NOT NULL, 22 | birth_date DATE NOT NULL, 23 | type_id INT NOT NULL, 24 | owner_id INT NOT NULL, 25 | FOREIGN KEY (owner_id) REFERENCES owners(id) ON DELETE CASCADE, 26 | FOREIGN KEY (type_id) REFERENCES types(id) ON DELETE CASCADE 27 | ); 28 | 29 | CREATE INDEX idx_last_name ON owners(last_name); 30 | CREATE INDEX idx_name ON pets(name); 31 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/schema-hsqldb.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE pets IF EXISTS; 2 | DROP TABLE types IF EXISTS; 3 | DROP TABLE owners IF EXISTS; 4 | 5 | CREATE TABLE types ( 6 | id INTEGER IDENTITY PRIMARY KEY, 7 | name VARCHAR(80) 8 | ); 9 | CREATE INDEX types_name ON types (name); 10 | 11 | CREATE TABLE owners ( 12 | id INTEGER IDENTITY PRIMARY KEY, 13 | first_name VARCHAR(30), 14 | last_name VARCHAR(30), 15 | address VARCHAR(255), 16 | city VARCHAR(80), 17 | telephone VARCHAR(12) 18 | ); 19 | CREATE INDEX owners_last_name ON owners (last_name); 20 | 21 | CREATE TABLE pets ( 22 | id INTEGER IDENTITY PRIMARY KEY, 23 | name VARCHAR(30), 24 | birth_date DATE, 25 | type_id INTEGER NOT NULL, 26 | owner_id INTEGER NOT NULL 27 | ); 28 | ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners (id); 29 | ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types (id); 30 | CREATE INDEX pets_name ON pets (name); 31 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/main/resources/schema-mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS petclinic; 2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | 4 | USE petclinic; 5 | 6 | CREATE TABLE IF NOT EXISTS types ( 7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 8 | name VARCHAR(80), 9 | INDEX(name) 10 | ) engine=InnoDB; 11 | 12 | CREATE TABLE IF NOT EXISTS owners ( 13 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 14 | first_name VARCHAR(30), 15 | last_name VARCHAR(30), 16 | address VARCHAR(255), 17 | city VARCHAR(80), 18 | telephone VARCHAR(20), 19 | INDEX(last_name) 20 | ) engine=InnoDB; 21 | 22 | CREATE TABLE IF NOT EXISTS pets ( 23 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 24 | name VARCHAR(30), 25 | birth_date DATE, 26 | type_id INT(4) UNSIGNED NOT NULL, 27 | owner_id INT(4) UNSIGNED NOT NULL, 28 | INDEX(name), 29 | FOREIGN KEY (owner_id) REFERENCES owners(id), 30 | FOREIGN KEY (type_id) REFERENCES types(id) 31 | ) engine=InnoDB; 32 | -------------------------------------------------------------------------------- /src/spring-petclinic-customers-service/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | enabled: false 5 | sql: 6 | init: 7 | schema-locations: classpath*:db/hsqldb/schema.sql 8 | data-locations: classpath*:db/hsqldb/data.sql 9 | jpa: 10 | hibernate: 11 | ddl-auto: none 12 | 13 | eureka: 14 | client: 15 | enabled: false 16 | 17 | logging.level.org.springframework: INFO 18 | 19 | -------------------------------------------------------------------------------- /src/spring-petclinic-discovery-server/src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.discovery; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @SpringBootApplication 26 | @EnableEurekaServer 27 | public class DiscoveryServerApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(DiscoveryServerApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/spring-petclinic-discovery-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: discovery-server 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | 7 | # Avoid some debugging logs at startup 8 | logging: 9 | level: 10 | org: 11 | springframework: 12 | boot: INFO 13 | web: INFO 14 | 15 | --- 16 | spring: 17 | config: 18 | activate: 19 | on-profile: docker 20 | import: configserver:http://config-server:8888 21 | 22 | -------------------------------------------------------------------------------- /src/spring-petclinic-discovery-server/src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.discovery; 17 | 18 | import org.junit.jupiter.api.Test; 19 | import org.springframework.boot.test.context.SpringBootTest; 20 | 21 | @SpringBootTest 22 | class DiscoveryServerApplicationTests { 23 | 24 | @Test 25 | void contextLoads() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/java/org/springframework/samples/petclinic/messagingemulator/config/QueueConfig.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.messagingemulator.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | public class QueueConfig { 6 | @Value("${spring.jms.queue.visits-requests:visits-requests}") 7 | private String visitsRequestsQueue; 8 | 9 | @Value("${spring.jms.queue.visits-confirmations:visits-confirmations}") 10 | private String visitsResponsesQueue; 11 | 12 | public String getVisitsRequestsQueue() { 13 | return visitsRequestsQueue; 14 | } 15 | 16 | public String getVisitsResponsesQueue(){ 17 | return visitsResponsesQueue; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/java/org/springframework/samples/petclinic/messagingemulator/entity/PetClinicMessageRequest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.messagingemulator.entity; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.AllArgsConstructor; 6 | import java.io.Serializable; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | public class PetClinicMessageRequest implements Serializable { 12 | private static final long serialVersionUID = -249322721255887286L; 13 | 14 | private Integer requestId; 15 | private Integer petId; 16 | private String message; 17 | 18 | public PetClinicMessageRequest(Integer ownerId, String message) { 19 | this.petId = ownerId; 20 | this.message = message; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/java/org/springframework/samples/petclinic/messagingemulator/entity/PetClinicMessageResponse.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.messagingemulator.entity; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.AllArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class PetClinicMessageResponse { 11 | int requestId; 12 | Boolean confirmed; 13 | String reason; 14 | } 15 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/java/org/springframework/samples/petclinic/messagingemulator/jkube/deployment.yml: -------------------------------------------------------------------------------- 1 | spec: 2 | replicas: 1 3 | template: 4 | spec: 5 | volumes: 6 | - name: secrets-store01-inline 7 | csi: 8 | driver: secrets-store.csi.k8s.io 9 | readOnly: true 10 | volumeAttributes: 11 | secretProviderClass: "azure-kvname-user-msi" 12 | containers: 13 | - env: 14 | - name: CONFIG_SERVER_URL 15 | valueFrom: 16 | configMapKeyRef: 17 | name: config-server 18 | key: CONFIG_SERVER_URL 19 | - name: SPRING_PROFILES_ACTIVE 20 | valueFrom: 21 | configMapKeyRef: 22 | name: config-server 23 | key: SPRING_PROFILES_ACTIVE 24 | - name: SPRING_DATASOURCE_USERNAME 25 | valueFrom: 26 | secretKeyRef: 27 | name: unsecret 28 | key: username 29 | - name: SPRING_DATASOURCE_PASSWORD 30 | valueFrom: 31 | secretKeyRef: 32 | name: pwsecret 33 | key: password 34 | volumeMounts: 35 | - name: secrets-store01-inline 36 | mountPath: "/mnt/secrets-store" 37 | readOnly: true -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/java/org/springframework/samples/petclinic/messagingemulator/model/VisitRequestRepository.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.messagingemulator.model; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface VisitRequestRepository extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/less/responsive.less: -------------------------------------------------------------------------------- 1 | @media (max-width: 768px) { 2 | .navbar-toggle { 3 | position:absolute; 4 | z-index: 9999; 5 | left:0px; 6 | top:0px; 7 | } 8 | 9 | .navbar a.navbar-brand { 10 | display: block; 11 | margin: 0 auto 0 auto; 12 | width: 148px; 13 | height: 50px; 14 | float: none; 15 | background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat; 16 | } 17 | 18 | .homepage-billboard .homepage-subtitle { 19 | font-size: 21px; 20 | line-height: 21px; 21 | } 22 | 23 | .navbar a.navbar-brand span { 24 | display: none; 25 | } 26 | 27 | .navbar { 28 | border-top-width: 0; 29 | } 30 | 31 | .xd-container { 32 | margin-top: 20px; 33 | margin-bottom: 30px; 34 | } 35 | 36 | .index-page--subtitle { 37 | margin-top: 10px; 38 | margin-bottom: 30px; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: messaging-emulator 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | USE petclinic; 2 | 3 | CREATE TABLE IF NOT EXISTS visitrequests ( 4 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 5 | pet_id INT(4) UNSIGNED NOT NULL, 6 | message VARCHAR(2048) NOT NULL, 7 | response VARCHAR(2048), 8 | accepted BOOLEAN NOT NULL DEFAULT FALSE 9 | ) engine = InnoDB; 10 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/messages/messages.properties: -------------------------------------------------------------------------------- 1 | required=is required 2 | notFound=has not been found 3 | duplicate=is already in use 4 | nonNumeric=must be all numeric 5 | duplicateFormSubmission=Duplicate form submission is not allowed 6 | typeMismatch.date=invalid date 7 | typeMismatch.birthDate=invalid date 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/messages/messages_de.properties: -------------------------------------------------------------------------------- 1 | required=muss angegeben werden 2 | notFound=wurde nicht gefunden 3 | duplicate=ist bereits vergeben 4 | nonNumeric=darf nur numerisch sein 5 | duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt 6 | typeMismatch.date=ung�ltiges Datum 7 | typeMismatch.birthDate=ung�ltiges Datum 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/messages/messages_en.properties: -------------------------------------------------------------------------------- 1 | # This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file. -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/schema-hsqldb.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE visitrequests IF EXISTS; 2 | CREATE TABLE visitrequests ( 3 | id INTEGER IDENTITY PRIMARY KEY, 4 | pet_id INTEGER NOT NULL, 5 | message VARCHAR(2048), 6 | response VARCHAR(2048), 7 | accepted INT 8 | ); 9 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/schema-mysql.sql: -------------------------------------------------------------------------------- 1 | -- CREATE DATABASE IF NOT EXISTS petclinic; 2 | -- GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | -- USE petclinic; 4 | CREATE TABLE IF NOT EXISTS visitrequests ( 5 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 6 | pet_id INT(4) UNSIGNED NOT NULL, 7 | message VARCHAR(2048) NOT NULL, 8 | response VARCHAR(2048), 9 | accepted BOOLEAN NOT NULL DEFAULT FALSE 10 | ) engine = InnoDB; 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/montserrat-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/montserrat-webfont.eot -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/montserrat-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/montserrat-webfont.ttf -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/montserrat-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/montserrat-webfont.woff -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/varela_round-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/varela_round-webfont.eot -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/varela_round-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/varela_round-webfont.ttf -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/varela_round-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/fonts/varela_round-webfont.woff -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/images/favicon.png -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/images/pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/images/pets.png -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/images/platform-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/images/platform-bg.png -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/images/spring-logo-dataflow-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/images/spring-logo-dataflow-mobile.png -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/images/spring-logo-dataflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/images/spring-logo-dataflow.png -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/images/spring-pivotal-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/java-on-aca/1d28e490dab382de297c1e676a5142ca5bafb159/src/spring-petclinic-messaging-emulator/src/main/resources/static/images/spring-pivotal-logo.png -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/fragments/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Sponsored by Pivotal
5 |
6 |
-------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/fragments/welcome.html: -------------------------------------------------------------------------------- 1 |

Welcome to Petclinic Messaging emulator

2 | 3 |
4 |
5 | pets logo 6 |
7 |
-------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/infrastructure/httpErrorHandlingInterceptor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Global HTTP errors handler. 5 | */ 6 | angular.module('infrastructure') 7 | .factory('HttpErrorHandlingInterceptor', function () { 8 | return { 9 | responseError: function (response) { 10 | var error = response.data; 11 | alert(error.error + "\r\n" + error.errors.map(function (e) { 12 | return e.field + ": " + e.defaultMessage; 13 | }).join("\r\n")); 14 | return response; 15 | } 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/infrastructure/infrastructure.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('infrastructure', []); 4 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-form/message-form.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('messageForm') 4 | .component('messageForm', { 5 | templateUrl: 'scripts/message-form/message-form.template.html', 6 | controller: 'MessageFormController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-form/message-form.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('messageForm') 4 | .controller('MessageFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | self.submit = function () { 8 | const msg = { 9 | petId: self.petId, 10 | message: self.message 11 | } 12 | 13 | let req = $http.post('asb', msg); 14 | req.then(function (response) { 15 | if (response.status >= 200 && response.status < 300) { 16 | self.result = response.data; 17 | } else { 18 | self.result = "Error: " + response.data; 19 | } 20 | // if (response.status >= 200 && response.status < 400 && response.data.ok === true) { 21 | // self.result = "New message processed. ID: " + response.data.correlationId; 22 | // } else { 23 | // self.result = "Error: " + response.data.description; 24 | // } 25 | }).catch(function (response) { 26 | self.result =response; 27 | }); 28 | } 29 | }]); 30 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-form/message-form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('messageForm', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('messages', { 7 | parent: 'app', 8 | url: '/messages', 9 | template: '' 10 | }) 11 | }]); 12 | 13 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-form/message-form.template.html: -------------------------------------------------------------------------------- 1 |

Message

2 | 3 |
4 |
5 | 6 | 7 | Pet Id is required 8 |
9 | 10 | 11 |
12 | 13 | 14 | Message is required. 15 |
16 | 17 |
18 | 19 |
20 |
21 | 22 |
23 | 24 | 25 |
26 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-list/message-list.component.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('messageList') 4 | .component('messageList', { 5 | templateUrl: 'scripts/message-list/message-list.template.html', 6 | controller: 'MessageListController' 7 | }); 8 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-list/message-list.controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('messageList') 4 | .controller('MessageListController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) { 5 | var self = this; 6 | 7 | 8 | $http.get('asb').then(function (resp) { 9 | self.messages = resp.data; 10 | }); 11 | 12 | self.refresh = function () { 13 | $http.get('asb').then(function (resp) { 14 | self.messages = resp.data; 15 | }); 16 | }; 17 | }]); 18 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-list/message-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('messageList', ['ui.router']) 4 | .config(['$stateProvider', function ($stateProvider) { 5 | $stateProvider 6 | .state('message-list', { 7 | parent: 'app', 8 | url: '/message-list', 9 | template: '' 10 | }) 11 | }]); 12 | 13 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/resources/static/scripts/message-list/message-list.template.html: -------------------------------------------------------------------------------- 1 |

Message list

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
Request idPet idMessageAcceptedResponse
{{message.id}}{{message.petId}}{{message.message}}{{message.accepted}}{{message.response}}
23 | 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/wro/wro.properties: -------------------------------------------------------------------------------- 1 | #List of preProcessors 2 | preProcessors=lessCssImport 3 | #List of postProcessors 4 | postProcessors=less4j -------------------------------------------------------------------------------- /src/spring-petclinic-messaging-emulator/src/main/wro/wro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | classpath:META-INF/resources/webjars/bootstrap/3.3.7-1/less/bootstrap.less 4 | /petclinic.less 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/system/CacheConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.vets.system; 17 | 18 | import org.springframework.cache.annotation.EnableCaching; 19 | import org.springframework.context.annotation.Configuration; 20 | import org.springframework.context.annotation.Profile; 21 | 22 | /** 23 | * Cache could be disable in unit test. 24 | * @author Maciej Szarlinski 25 | */ 26 | @Configuration 27 | @EnableCaching 28 | @Profile("production") 29 | class CacheConfig { 30 | } 31 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/system/VetsProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.vets.system; 17 | 18 | import lombok.Data; 19 | 20 | import org.springframework.boot.context.properties.ConfigurationProperties; 21 | 22 | /** 23 | * Typesafe custom configuration. 24 | * 25 | * @author Maciej Szarlinski 26 | */ 27 | @Data 28 | @ConfigurationProperties(prefix = "vets") 29 | public class VetsProperties { 30 | 31 | private Cache cache; 32 | 33 | @Data 34 | public static class Cache { 35 | 36 | private int ttl; 37 | 38 | private int heapSize; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vets-service 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | cache: 7 | cache-names: vets 8 | profiles: 9 | active: production 10 | 11 | --- 12 | spring: 13 | config: 14 | activate: 15 | on-profile: docker 16 | import: configserver:http://config-server:8888 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/data-hsqldb.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO vets VALUES (1, 'James', 'Carter'); 2 | INSERT INTO vets VALUES (2, 'Helen', 'Leary'); 3 | INSERT INTO vets VALUES (3, 'Linda', 'Douglas'); 4 | INSERT INTO vets VALUES (4, 'Rafael', 'Ortega'); 5 | INSERT INTO vets VALUES (5, 'Henry', 'Stevens'); 6 | INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins'); 7 | 8 | INSERT INTO specialties VALUES (1, 'radiology'); 9 | INSERT INTO specialties VALUES (2, 'surgery'); 10 | INSERT INTO specialties VALUES (3, 'dentistry'); 11 | 12 | INSERT INTO vet_specialties VALUES (2, 1); 13 | INSERT INTO vet_specialties VALUES (3, 2); 14 | INSERT INTO vet_specialties VALUES (3, 3); 15 | INSERT INTO vet_specialties VALUES (4, 2); 16 | INSERT INTO vet_specialties VALUES (5, 1); 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/data-mysql.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO vets VALUES (1, 'James', 'Carter'); 2 | INSERT IGNORE INTO vets VALUES (2, 'Helen', 'Leary'); 3 | INSERT IGNORE INTO vets VALUES (3, 'Linda', 'Douglas'); 4 | INSERT IGNORE INTO vets VALUES (4, 'Rafael', 'Ortega'); 5 | INSERT IGNORE INTO vets VALUES (5, 'Henry', 'Stevens'); 6 | INSERT IGNORE INTO vets VALUES (6, 'Sharon', 'Jenkins'); 7 | 8 | INSERT IGNORE INTO specialties VALUES (1, 'radiology'); 9 | INSERT IGNORE INTO specialties VALUES (2, 'surgery'); 10 | INSERT IGNORE INTO specialties VALUES (3, 'dentistry'); 11 | 12 | INSERT IGNORE INTO vet_specialties VALUES (2, 1); 13 | INSERT IGNORE INTO vet_specialties VALUES (3, 2); 14 | INSERT IGNORE INTO vet_specialties VALUES (3, 3); 15 | INSERT IGNORE INTO vet_specialties VALUES (4, 2); 16 | INSERT IGNORE INTO vet_specialties VALUES (5, 1); 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/db/hsqldb/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO vets VALUES (1, 'James', 'Carter'); 2 | INSERT INTO vets VALUES (2, 'Helen', 'Leary'); 3 | INSERT INTO vets VALUES (3, 'Linda', 'Douglas'); 4 | INSERT INTO vets VALUES (4, 'Rafael', 'Ortega'); 5 | INSERT INTO vets VALUES (5, 'Henry', 'Stevens'); 6 | INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins'); 7 | 8 | INSERT INTO specialties VALUES (1, 'radiology'); 9 | INSERT INTO specialties VALUES (2, 'surgery'); 10 | INSERT INTO specialties VALUES (3, 'dentistry'); 11 | 12 | INSERT INTO vet_specialties VALUES (2, 1); 13 | INSERT INTO vet_specialties VALUES (3, 2); 14 | INSERT INTO vet_specialties VALUES (3, 3); 15 | INSERT INTO vet_specialties VALUES (4, 2); 16 | INSERT INTO vet_specialties VALUES (5, 1); 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/db/hsqldb/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE vet_specialties IF EXISTS; 2 | DROP TABLE vets IF EXISTS; 3 | DROP TABLE specialties IF EXISTS; 4 | 5 | CREATE TABLE vets ( 6 | id INTEGER IDENTITY PRIMARY KEY, 7 | first_name VARCHAR(30), 8 | last_name VARCHAR(30) 9 | ); 10 | CREATE INDEX vets_last_name ON vets (last_name); 11 | 12 | CREATE TABLE specialties ( 13 | id INTEGER IDENTITY PRIMARY KEY, 14 | name VARCHAR(80) 15 | ); 16 | CREATE INDEX specialties_name ON specialties (name); 17 | 18 | CREATE TABLE vet_specialties ( 19 | vet_id INTEGER NOT NULL, 20 | specialty_id INTEGER NOT NULL 21 | ); 22 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY (vet_id) REFERENCES vets (id); 23 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id); 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/db/mysql/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO vets VALUES (1, 'James', 'Carter'); 2 | INSERT IGNORE INTO vets VALUES (2, 'Helen', 'Leary'); 3 | INSERT IGNORE INTO vets VALUES (3, 'Linda', 'Douglas'); 4 | INSERT IGNORE INTO vets VALUES (4, 'Rafael', 'Ortega'); 5 | INSERT IGNORE INTO vets VALUES (5, 'Henry', 'Stevens'); 6 | INSERT IGNORE INTO vets VALUES (6, 'Sharon', 'Jenkins'); 7 | 8 | INSERT IGNORE INTO specialties VALUES (1, 'radiology'); 9 | INSERT IGNORE INTO specialties VALUES (2, 'surgery'); 10 | INSERT IGNORE INTO specialties VALUES (3, 'dentistry'); 11 | 12 | INSERT IGNORE INTO vet_specialties VALUES (2, 1); 13 | INSERT IGNORE INTO vet_specialties VALUES (3, 2); 14 | INSERT IGNORE INTO vet_specialties VALUES (3, 3); 15 | INSERT IGNORE INTO vet_specialties VALUES (4, 2); 16 | INSERT IGNORE INTO vet_specialties VALUES (5, 1); 17 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | USE petclinic; 2 | 3 | CREATE TABLE IF NOT EXISTS vets ( 4 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 5 | first_name VARCHAR(30), 6 | last_name VARCHAR(30), 7 | INDEX(last_name) 8 | ) engine=InnoDB; 9 | 10 | CREATE TABLE IF NOT EXISTS specialties ( 11 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 12 | name VARCHAR(80), 13 | INDEX(name) 14 | ) engine=InnoDB; 15 | 16 | CREATE TABLE IF NOT EXISTS vet_specialties ( 17 | vet_id INT(4) UNSIGNED NOT NULL, 18 | specialty_id INT(4) UNSIGNED NOT NULL, 19 | FOREIGN KEY (vet_id) REFERENCES vets(id), 20 | FOREIGN KEY (specialty_id) REFERENCES specialties(id), 21 | UNIQUE (vet_id,specialty_id) 22 | ) engine=InnoDB; 23 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/db/postgres/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO vets (id, first_name, last_name) VALUES 2 | (1, 'James', 'Carter'), 3 | (2, 'Helen', 'Leary'), 4 | (3, 'Linda', 'Douglas'), 5 | (4, 'Rafael', 'Ortega'), 6 | (5, 'Henry', 'Stevens'), 7 | (6, 'Sharon', 'Jenkins') 8 | ON CONFLICT (id) DO NOTHING; 9 | 10 | INSERT INTO specialties (id, name) VALUES 11 | (1, 'radiology'), 12 | (2, 'surgery'), 13 | (3, 'dentistry') 14 | ON CONFLICT (id) DO NOTHING; 15 | 16 | INSERT INTO vet_specialties (vet_id, specialty_id) VALUES 17 | (2, 1), 18 | (3, 2), 19 | (3, 3), 20 | (4, 2), 21 | (5, 1) 22 | ON CONFLICT (vet_id, specialty_id) DO NOTHING; 23 | 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/db/postgres/schema.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE TABLE IF NOT EXISTS vets ( 3 | id SERIAL PRIMARY KEY, 4 | first_name VARCHAR(30) NOT NULL, 5 | last_name VARCHAR(30) NOT NULL 6 | ); 7 | 8 | CREATE INDEX idx_vets_last_name ON vets(last_name); 9 | 10 | CREATE TABLE IF NOT EXISTS specialties ( 11 | id SERIAL PRIMARY KEY, 12 | name VARCHAR(80) NOT NULL, 13 | UNIQUE (name) 14 | ); 15 | 16 | CREATE TABLE IF NOT EXISTS vet_specialties ( 17 | vet_id INT NOT NULL, 18 | specialty_id INT NOT NULL, 19 | PRIMARY KEY (vet_id, specialty_id), 20 | FOREIGN KEY (vet_id) REFERENCES vets(id) ON DELETE CASCADE, 21 | FOREIGN KEY (specialty_id) REFERENCES specialties(id) ON DELETE CASCADE 22 | ); 23 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/schema-hsqldb.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE vet_specialties IF EXISTS; 2 | DROP TABLE vets IF EXISTS; 3 | DROP TABLE specialties IF EXISTS; 4 | 5 | CREATE TABLE vets ( 6 | id INTEGER IDENTITY PRIMARY KEY, 7 | first_name VARCHAR(30), 8 | last_name VARCHAR(30) 9 | ); 10 | CREATE INDEX vets_last_name ON vets (last_name); 11 | 12 | CREATE TABLE specialties ( 13 | id INTEGER IDENTITY PRIMARY KEY, 14 | name VARCHAR(80) 15 | ); 16 | CREATE INDEX specialties_name ON specialties (name); 17 | 18 | CREATE TABLE vet_specialties ( 19 | vet_id INTEGER NOT NULL, 20 | specialty_id INTEGER NOT NULL 21 | ); 22 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY (vet_id) REFERENCES vets (id); 23 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id); 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/main/resources/schema-mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS petclinic; 2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | 4 | USE petclinic; 5 | 6 | CREATE TABLE IF NOT EXISTS vets ( 7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 8 | first_name VARCHAR(30), 9 | last_name VARCHAR(30), 10 | INDEX(last_name) 11 | ) engine=InnoDB; 12 | 13 | CREATE TABLE IF NOT EXISTS specialties ( 14 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 15 | name VARCHAR(80), 16 | INDEX(name) 17 | ) engine=InnoDB; 18 | 19 | CREATE TABLE IF NOT EXISTS vet_specialties ( 20 | vet_id INT(4) UNSIGNED NOT NULL, 21 | specialty_id INT(4) UNSIGNED NOT NULL, 22 | FOREIGN KEY (vet_id) REFERENCES vets(id), 23 | FOREIGN KEY (specialty_id) REFERENCES specialties(id), 24 | UNIQUE (vet_id,specialty_id) 25 | ) engine=InnoDB; 26 | -------------------------------------------------------------------------------- /src/spring-petclinic-vets-service/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | enabled: false 5 | sql: 6 | init: 7 | schema-locations: classpath*:db/hsqldb/schema.sql 8 | data-locations: classpath*:db/hsqldb/data.sql 9 | jpa: 10 | hibernate: 11 | ddl-auto: none 12 | 13 | eureka: 14 | client: 15 | enabled: false 16 | 17 | vets: 18 | cache: 19 | ttl: 10 20 | heap-size: 10 21 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | COPY ./target/*.jar app.jar 7 | 8 | EXPOSE 8080 9 | 10 | # Run the jar file 11 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 12 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/ai.Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # build 4 | FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS build 5 | 6 | ARG AI_VERSION=3.5.4 7 | 8 | RUN yum update -y && \ 9 | yum install -y wget 10 | 11 | RUN wget https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar -O ai.jar --quiet 12 | 13 | # run 14 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 15 | 16 | COPY --from=build ./ai.jar ai.jar 17 | 18 | COPY ./target/*.jar app.jar 19 | 20 | EXPOSE 8080 21 | 22 | # Run the jar file 23 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/ai.jar", "-jar", "/app.jar"] 24 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/VisitsServiceApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2021 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 | package org.springframework.samples.petclinic.visits; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 21 | 22 | /** 23 | * @author Maciej Szarlinski 24 | */ 25 | @EnableDiscoveryClient 26 | @SpringBootApplication 27 | public class VisitsServiceApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(VisitsServiceApplication.class, args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/config/MetricConfig.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.visits.config; 2 | 3 | import io.micrometer.core.aop.TimedAspect; 4 | import io.micrometer.core.instrument.MeterRegistry; 5 | import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | @Configuration 10 | public class MetricConfig { 11 | 12 | @Bean 13 | MeterRegistryCustomizer metricsCommonTags() { 14 | return registry -> registry.config().commonTags("application", "petclinic"); 15 | } 16 | 17 | @Bean 18 | TimedAspect timedAspect(MeterRegistry registry) { 19 | return new TimedAspect(registry); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/config/QueueConfig.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.visits.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | public class QueueConfig { 6 | @Value("${spring.jms.queue.visits-requests:visits-requests}") 7 | private String visitsRequestsQueue; 8 | 9 | @Value("${spring.jms.queue.visits-confirmations:visits-confirmations}") 10 | private String visitsResponsesQueue; 11 | 12 | public String getVisitsRequestsQueue() { 13 | return visitsRequestsQueue; 14 | } 15 | 16 | public String getVisitsResponsesQueue(){ 17 | return visitsResponsesQueue; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/entities/VisitRequest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.visits.entities; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.AllArgsConstructor; 6 | import java.io.Serializable; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | public class VisitRequest implements Serializable { 12 | private static final long serialVersionUID = -249974321255677286L; 13 | 14 | private Integer requestId; 15 | private Integer petId; 16 | private String message; 17 | } 18 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/entities/VisitResponse.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.visits.entities; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.AllArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class VisitResponse { 11 | Integer requestId; 12 | Boolean confirmed; 13 | String reason; 14 | } 15 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: visits-service 4 | config: 5 | import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} 6 | 7 | 8 | --- 9 | spring: 10 | config: 11 | activate: 12 | on-profile: docker 13 | import: configserver:http://config-server:8888 14 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/data-hsqldb.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot'); 2 | INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot'); 3 | INSERT INTO visits VALUES (3, 8, '2013-01-03', 'neutered'); 4 | INSERT INTO visits VALUES (4, 7, '2013-01-04', 'spayed'); 5 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/data-mysql.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO visits VALUES (1, 7, '2010-03-04', 'rabies shot'); 2 | INSERT IGNORE INTO visits VALUES (2, 8, '2011-03-04', 'rabies shot'); 3 | INSERT IGNORE INTO visits VALUES (3, 8, '2009-06-04', 'neutered'); 4 | INSERT IGNORE INTO visits VALUES (4, 7, '2008-09-04', 'spayed'); 5 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/db/hsqldb/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot'); 2 | INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot'); 3 | INSERT INTO visits VALUES (3, 8, '2013-01-03', 'neutered'); 4 | INSERT INTO visits VALUES (4, 7, '2013-01-04', 'spayed'); 5 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/db/hsqldb/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE visits IF EXISTS; 2 | 3 | CREATE TABLE visits ( 4 | id INTEGER IDENTITY PRIMARY KEY, 5 | pet_id INTEGER NOT NULL, 6 | visit_date DATE, 7 | description VARCHAR(8192) 8 | ); 9 | 10 | CREATE INDEX visits_pet_id ON visits (pet_id); 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/db/mysql/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO visits VALUES (1, 7, '2010-03-04', 'rabies shot'); 2 | INSERT IGNORE INTO visits VALUES (2, 8, '2011-03-04', 'rabies shot'); 3 | INSERT IGNORE INTO visits VALUES (3, 8, '2009-06-04', 'neutered'); 4 | INSERT IGNORE INTO visits VALUES (4, 7, '2008-09-04', 'spayed'); 5 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/db/mysql/schema.sql: -------------------------------------------------------------------------------- 1 | USE petclinic; 2 | 3 | CREATE TABLE IF NOT EXISTS visits ( 4 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 5 | pet_id INT(4) UNSIGNED NOT NULL, 6 | visit_date DATE, 7 | description VARCHAR(8192), 8 | FOREIGN KEY (pet_id) REFERENCES pets(id) 9 | ) engine=InnoDB; 10 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/db/postgres/data.sql: -------------------------------------------------------------------------------- 1 | 2 | 3 | INSERT INTO visits (id, pet_id, visit_date, description) VALUES 4 | (1, 7, '2010-03-04', 'rabies shot'), 5 | (2, 8, '2011-03-04', 'rabies shot'), 6 | (3, 8, '2009-06-04', 'neutered'), 7 | (4, 7, '2008-09-04', 'spayed') 8 | ON CONFLICT (id) DO NOTHING; 9 | 10 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/db/postgres/schema.sql: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CREATE TABLE IF NOT EXISTS visits ( 5 | id SERIAL PRIMARY KEY, 6 | pet_id INT NOT NULL, 7 | visit_date DATE, 8 | description VARCHAR(8192), 9 | FOREIGN KEY (pet_id) REFERENCES pets(id) ON DELETE CASCADE 10 | ); 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/schema-hsqldb.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE visits IF EXISTS; 2 | 3 | CREATE TABLE visits ( 4 | id INTEGER IDENTITY PRIMARY KEY, 5 | pet_id INTEGER NOT NULL, 6 | visit_date DATE, 7 | description VARCHAR(8192) 8 | ); 9 | 10 | CREATE INDEX visits_pet_id ON visits (pet_id); 11 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/main/resources/schema-mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE IF NOT EXISTS petclinic; 2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc'; 3 | 4 | USE petclinic; 5 | 6 | CREATE TABLE IF NOT EXISTS visits ( 7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 8 | pet_id INT(4) UNSIGNED NOT NULL, 9 | visit_date DATE, 10 | description VARCHAR(8192), 11 | FOREIGN KEY (pet_id) REFERENCES pets(id) 12 | ) engine=InnoDB; 13 | -------------------------------------------------------------------------------- /src/spring-petclinic-visits-service/src/test/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | enabled: false 5 | sql: 6 | init: 7 | schema-locations: classpath*:db/hsqldb/schema.sql 8 | data-locations: classpath*:db/hsqldb/data.sql 9 | jpa: 10 | hibernate: 11 | ddl-auto: none 12 | 13 | eureka: 14 | client: 15 | enabled: false 16 | 17 | logging.level.org.springframework: INFO 18 | 19 | -------------------------------------------------------------------------------- /tools/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # run 4 | FROM mcr.microsoft.com/openjdk/jdk:17-distroless 5 | 6 | # Prepare the Application Insights Java agent 7 | ARG AI_VERSION=3.6.2 8 | ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/$AI_VERSION/applicationinsights-agent-$AI_VERSION.jar /applicationinsights-agent.jar 9 | 10 | COPY ./target/*.jar app.jar 11 | 12 | EXPOSE 8080 13 | 14 | # Run the jar file 15 | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"] 16 | -------------------------------------------------------------------------------- /tools/azure-resource.profile.template: -------------------------------------------------------------------------------- 1 | 2 | # Set all the variables with <> and keep the others unchanged 3 | 4 | # This part is for lab 2 & Lab 3 5 | 6 | # Pay attention to this, use command 'openssl rand -hex 3' to generate a unique id and put value here, don't put command here 7 | UNIQUEID= 8 | 9 | SUBSCRIPTION= 10 | LOCATION= 11 | 12 | APPNAME=petclinic 13 | RESOURCE_GROUP=rg-$APPNAME-$UNIQUEID 14 | 15 | # MySQL Server 16 | 17 | MYSQL_SERVER_NAME=mysql-$APPNAME-$UNIQUEID 18 | MYSQL_ADMIN_USERNAME=sqladmin 19 | MYSQL_ADMIN_PASSWORD="" 20 | DATABASE_NAME=petclinic 21 | 22 | # Azure Container Registry 23 | MYACR=acr$APPNAME$UNIQUEID 24 | 25 | # Azure OpenAI Service 26 | OPEN_AI_SERVICE_NAME=open-ai-account-$UNIQUEID 27 | 28 | ############### Optional ############### 29 | # Set RUN_OPTIONAL to true if you want to deploy resources for Lab 4 & Lab 5 30 | RUN_OPTIONAL=true 31 | 32 | # Set the below variables if RUN_OPTIONAL=true 33 | 34 | # Azure Monitoring 35 | WORKSPACE=la-$APPNAME-$UNIQUEID 36 | 37 | # Application Insights 38 | APP_INSIGHTS_NAME=app-insights-$APPNAME-$UNIQUEID 39 | 40 | # Azure Managed Grafana 41 | GRAFANA_NAME=amg-$UNIQUEID 42 | -------------------------------------------------------------------------------- /tools/funcs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GREEN='\033[0;32m' 4 | YELLOW='\033[1;33m' 5 | NC='\033[0m' # No Color 6 | 7 | function random_element() { 8 | 9 | local array=("$@") 10 | local array_length=${#array[@]} 11 | 12 | if [[ $array_length -gt 0 ]]; then 13 | local index=$((RANDOM % array_length)) 14 | echo ${array[index]} 15 | else 16 | echo "" 17 | fi 18 | } 19 | -------------------------------------------------------------------------------- /tools/prepare-extensions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Install or Update az extensions ..." 4 | 5 | for name in containerapp serviceconnector-passwordless application-insights amg; do 6 | az extension add --name $name --upgrade --yes 7 | done -------------------------------------------------------------------------------- /tools/prepare-subscription.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Registering providers ..." 4 | 5 | az provider register --namespace Microsoft.ContainerRegistry 6 | 7 | az provider register --namespace Microsoft.Network 8 | 9 | az provider register --namespace Microsoft.App 10 | 11 | az provider register --namespace Microsoft.DBforMySQL 12 | 13 | az provider register --namespace Microsoft.CognitiveServices 14 | -------------------------------------------------------------------------------- /tools/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | bash $DIR/../.devcontainer/postCreateCommand.sh 6 | 7 | bash $DIR/prepare-subscription.sh 8 | 9 | bash $DIR/prepare-extensions.sh 10 | 11 | GREEN='\033[0;32m' 12 | NC='\033[0m' # No Color 13 | 14 | echo -e "${GREEN}INFO:${NC} Please quite this terminal and reopen it to have a full functional lab environment" -------------------------------------------------------------------------------- /tools/spring-petclinic-chat-service/.gitattributes: -------------------------------------------------------------------------------- 1 | /mvnw text eol=lf 2 | *.cmd text eol=crlf 3 | -------------------------------------------------------------------------------- /tools/spring-petclinic-chat-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /tools/spring-petclinic-chat-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /tools/spring-petclinic-chat-service/src/main/java/org/springframework/samples/petclinic/chat_service/ChatServiceApplication.java: -------------------------------------------------------------------------------- 1 | package org.springframework.samples.petclinic.chat_service; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class ChatServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ChatServiceApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /tools/spring-petclinic-chat-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: chat-service 4 | -------------------------------------------------------------------------------- /tools/update-apps-appinsights.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR=/tmp 4 | 5 | update_app_with_ai() { 6 | APP_NAME=$1 7 | 8 | echo "Updating app $APP_NAME with application insights agent ..." 9 | 10 | az containerapp update \ 11 | --name $APP_NAME \ 12 | --resource-group $RESOURCE_GROUP \ 13 | --set-env-vars JAVA_TOOL_OPTIONS='-javaagent:/applicationinsights-agent.jar' APPLICATIONINSIGHTS_CONNECTION_STRING="$APP_INSIGHTS_CONN" APPLICATIONINSIGHTS_CONFIGURATION_CONTENT='{"role": {"name": "'$APP_NAME'"}}' \ 14 | > $DIR/$APP_NAME.update.log 2>&1 15 | 16 | if [[ $? -ne 0 ]]; then 17 | echo "Update app $APP_NAME failed, check $DIR/$APP_NAME.update.log for more details" 18 | return 2 19 | fi 20 | 21 | echo "Update app $APP_NAME succeed" 22 | return 0 23 | } 24 | 25 | CHECK_FAIL=$DIR/aca-lab.$$ 26 | 27 | for name in customers-service vets-service visits-service; do 28 | update_app_with_ai $name || touch $CHECK_FAIL & 29 | done 30 | 31 | wait < <(jobs -p) 32 | 33 | if [[ -f $CHECK_FAIL ]]; then 34 | echo "Error happens on update apps, please check the logs for more details" 35 | exit 1 36 | else 37 | echo "Update succeed" 38 | exit 0 39 | fi 40 | 41 | --------------------------------------------------------------------------------