From 3ffbc8223dbfba2cb21f0971022a0bc67aae62c3 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 28 Oct 2025 09:20:20 +0100 Subject: [PATCH] Initial commit --- pom.xml | 60 +++++++++++++++++++ .../discovery/DiscoveryServerApplication.java | 32 ++++++++++ src/main/resources/application.yml | 21 +++++++ .../DiscoveryServerApplicationTests.java | 28 +++++++++ 4 files changed, 141 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.java create mode 100644 src/main/resources/application.yml create mode 100644 src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.java diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..970f974 --- /dev/null +++ b/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.springframework.samples.petclinic.discovery + spring-petclinic-discovery-server + jar + Spring PetClinic Discovery Server + + + org.springframework.samples + spring-petclinic-microservices + 3.4.1 + + + + 8761 + ${basedir}/../docker + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-server + + + org.springframework.cloud + spring-cloud-starter-config + + + + + org.glassfish.jaxb + jaxb-runtime + + + + + + buildDocker + + + + org.codehaus.mojo + exec-maven-plugin + + + + + + diff --git a/src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.java b/src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.java new file mode 100644 index 0000000..56c49ed --- /dev/null +++ b/src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.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.discovery; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +/** + * @author Maciej Szarlinski + */ +@SpringBootApplication +@EnableEurekaServer +public class DiscoveryServerApplication { + + public static void main(String[] args) { + SpringApplication.run(DiscoveryServerApplication.class, args); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..9fbcbc5 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,21 @@ +spring: + application: + name: discovery-server + config: + import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:8888/} + +# Avoid some debugging logs at startup +logging: + level: + org: + springframework: + boot: INFO + web: INFO + +--- +spring: + config: + activate: + on-profile: docker + import: configserver:http://config-server:8888 + diff --git a/src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.java b/src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.java new file mode 100644 index 0000000..8bcc0af --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.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.discovery; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DiscoveryServerApplicationTests { + + @Test + void contextLoads() { + } + +}