From 434e657cb55fcd49b2ebfb1d6865d4aabea54ebc Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 28 Oct 2025 09:08:22 +0100 Subject: [PATCH] Initial commit --- pom.xml | 68 +++++++++++++++++++ .../config/ConfigServerApplication.java | 32 +++++++++ src/main/resources/application.yml | 12 ++++ src/main/resources/static/index.html | 12 ++++ ...PetclinicConfigServerApplicationTests.java | 28 ++++++++ src/test/resources/application.yml | 6 ++ 6 files changed, 158 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/static/index.html create mode 100644 src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java create mode 100644 src/test/resources/application.yml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a6cce24 --- /dev/null +++ b/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.springframework.samples.petclinic.config + spring-petclinic-config-server + jar + Spring PetClinic Config Server + + + org.springframework.samples + spring-petclinic-microservices + 3.4.1 + + + + 8888 + ${basedir}/../docker + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework.cloud + spring-cloud-config-server + + + + + org.jolokia + jolokia-core + + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + buildDocker + + + + org.codehaus.mojo + exec-maven-plugin + + + + + + diff --git a/src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java b/src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java new file mode 100644 index 0000000..e6b810b --- /dev/null +++ b/src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java @@ -0,0 +1,32 @@ +/* + * Copyright 2002-2021 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.samples.petclinic.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; + +/** + * @author Maciej Szarlinski + */ +@EnableConfigServer +@SpringBootApplication +public class ConfigServerApplication { + + public static void main(String[] args) { + SpringApplication.run(ConfigServerApplication.class, args); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..9a58811 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,12 @@ +server.port: 8888 +spring: + cloud: + config: + server: + git: + uri: https://github.com/spring-petclinic/spring-petclinic-microservices-config + default-label: main + # Use the File System Backend to avoid git pulling. Enable "native" profile in the Config Server. + native: + searchLocations: file:///${GIT_REPO} + diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html new file mode 100644 index 0000000..6208dd8 --- /dev/null +++ b/src/main/resources/static/index.html @@ -0,0 +1,12 @@ + + + +

Spring Cloud Config Server

+

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

+ + + diff --git a/src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java b/src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java new file mode 100644 index 0000000..e3d5191 --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java @@ -0,0 +1,28 @@ +/* + * Copyright 2002-2021 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.samples.petclinic.config; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class PetclinicConfigServerApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml new file mode 100644 index 0000000..b4fb9c7 --- /dev/null +++ b/src/test/resources/application.yml @@ -0,0 +1,6 @@ +spring: + cloud: + config: + server: + git: + uri: https://github.com/spring-petclinic/spring-petclinic-microservices-config