File tree 18 files changed +251
-49
lines changed
java/io/dksifoua/eshop/catalog
java/io/dksifoua/eshop/config
test/java/io/dksifoua/eshop/config
18 files changed +251
-49
lines changed Original file line number Diff line number Diff line change
1
+ name : config-server
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - develop
8
+ - feature/**
9
+ pull_request :
10
+ branches :
11
+ - main
12
+ - develop
13
+ - feature/**
14
+
15
+ jobs :
16
+ test :
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - uses : actions/checkout@v3
20
+ - name : Setup Java
21
+ uses : actions/setup-java@v4
22
+ with :
23
+ distribution : oracle
24
+ java-version : 21
25
+ - name : Setup Task
26
+ uses : arduino/setup-task@v2
27
+ with :
28
+ version : 3.x
29
+ repo-token : ${{ secrets.GH_TOKEN }}
30
+ - name : Test config server
31
+ run : task config:test
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ Event driven microservice-based c2c ecommerce platform
6
6
7
7
[ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/gateway.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/gateway.yaml )
8
8
[ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/catalog.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/catalog.yaml )
9
+ [ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/config.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/config.yaml )
9
10
[ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/eureka.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/eureka.yaml )
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ version: 3
3
3
includes :
4
4
catalog :
5
5
taskfile : ./catalog-service/Taskfile.yaml
6
+ config :
7
+ taskfile : ./config-server/Taskfile.yaml
6
8
eureka :
7
9
taskfile : ./eureka-server/Taskfile.yaml
8
10
gateway :
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ dependencies {
28
28
29
29
implementation ' org.springframework.cloud:spring-cloud-starter-gateway'
30
30
implementation ' org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
31
+ implementation ' org.springframework.cloud:spring-cloud-starter-config'
31
32
developmentOnly ' org.springframework.boot:spring-boot-devtools'
32
33
testImplementation ' org.springframework.boot:spring-boot-starter-test'
33
34
testImplementation ' io.projectreactor:reactor-test'
Original file line number Diff line number Diff line change 1
- server :
2
- port : 8080
3
-
4
- eureka :
5
- client :
6
- service-url :
7
- defaultZone : ${EUREKA_URI:http://localhost:8761/eureka}
8
-
9
1
spring :
10
2
application :
11
3
name : api-gateway
12
- devtools :
13
- livereload :
14
- port : 35730
15
4
16
- cloud :
17
- gateway :
18
- routes :
19
- - id : catalog-service
20
- uri : http://localhost:8081
21
- predicates :
22
- - Path=/api/v1/catalog/**
23
- logging :
24
- level :
25
- root : info
26
- org.springframework.cloud.gateway : trace
27
- org.springframework.web : debug
28
- org.springframework.web.reactive : debug
5
+ config :
6
+ import : optional:configserver:http://dksifoua:dksifoua@localhost:8888
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ dependencies {
31
31
implementation ' org.springframework.boot:spring-boot-starter-data-mongodb'
32
32
implementation ' org.springframework.boot:spring-boot-starter-webflux'
33
33
implementation ' org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
34
+ implementation ' org.springframework.cloud:spring-cloud-starter-config'
34
35
compileOnly ' org.projectlombok:lombok'
35
36
developmentOnly ' org.springframework.boot:spring-boot-devtools'
36
37
developmentOnly ' org.springframework.boot:spring-boot-docker-compose'
Original file line number Diff line number Diff line change 1
- app :
2
- base-path : /api/v1/catalog
3
-
4
- eureka :
5
- client :
6
- service-url :
7
- defaultZone : ${EUREKA_URI:http://localhost:8761/eureka}
8
-
9
- server :
10
- port : 8081
11
-
12
1
spring :
13
2
application :
14
3
name : catalog-service
15
- devtools :
16
- livereload :
17
- port : 35729
18
4
19
- logging :
20
- level :
21
- root : info
22
- org.springframework.web : debug
23
- org.springframework.web.reactive : debug
5
+ config :
6
+ import : optional:configserver:http://dksifoua:dksifoua@localhost:8888
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .Test ;
4
4
import org .springframework .boot .test .context .SpringBootTest ;
5
5
import org .springframework .context .annotation .Import ;
6
- import org .springframework .test .context .TestPropertySource ;
6
+ import org .springframework .test .context .ActiveProfiles ;
7
7
8
8
@ Import (TestcontainersConfiguration .class )
9
9
@ SpringBootTest
10
- @ TestPropertySource (properties = {
11
- "eureka.client.enabled=false" ,
12
- "eureka.client.register-with-eureka=false" ,
13
- "eureka.client.fetch-registry=false"
14
- })
10
+ @ ActiveProfiles (profiles = "test" )
15
11
class CatalogServiceApplicationTests {
16
12
17
13
@ Test
Original file line number Diff line number Diff line change
1
+ app :
2
+ base-path : /api/v1/catalog
3
+
4
+ eureka :
5
+ client :
6
+ enabled : false
7
+ register-with-eureka : false
8
+ fetch-registry : false
9
+
10
+ server :
11
+ port : 8081
12
+
13
+ spring :
14
+ application :
15
+ name : catalog-service
16
+
17
+ devtools :
18
+ livereload :
19
+ port : 35729
20
+
21
+ logging :
22
+ level :
23
+ root : info
24
+ org.springframework.web : debug
25
+ org.springframework.web.reactive : debug
Original file line number Diff line number Diff line change
1
+ HELP.md
2
+ .gradle
3
+ build /
4
+ ! gradle /wrapper /gradle-wrapper.jar
5
+ ! ** /src /main /** /build /
6
+ ! ** /src /test /** /build /
7
+
8
+ # ## STS ###
9
+ .apt_generated
10
+ .classpath
11
+ .factorypath
12
+ .project
13
+ .settings
14
+ .springBeans
15
+ .sts4-cache
16
+ bin /
17
+ ! ** /src /main /** /bin /
18
+ ! ** /src /test /** /bin /
19
+
20
+ # ## IntelliJ IDEA ###
21
+ .idea
22
+ * .iws
23
+ * .iml
24
+ * .ipr
25
+ out /
26
+ ! ** /src /main /** /out /
27
+ ! ** /src /test /** /out /
28
+
29
+ # ## NetBeans ###
30
+ /nbproject /private /
31
+ /nbbuild /
32
+ /dist /
33
+ /nbdist /
34
+ /.nb-gradle /
35
+
36
+ # ## VS Code ###
37
+ .vscode /
Original file line number Diff line number Diff line change
1
+ version : 3
2
+
3
+ tasks :
4
+ clean :
5
+ desc : Clean config server build
6
+ cmd : ./gradlew :config-server:clean
7
+ silent : true
8
+
9
+ run :
10
+ desc : Run config server
11
+ cmd : ./gradlew :config-server:bootRun
12
+ silent : true
13
+
14
+ test :
15
+ desc : Test config server
16
+ cmds :
17
+ - task : clean
18
+ - ./gradlew :config-server:test
19
+ silent : true
Original file line number Diff line number Diff line change
1
+ plugins {
2
+ id ' java'
3
+ id ' org.springframework.boot' version ' 3.3.4'
4
+ id ' io.spring.dependency-management' version ' 1.1.6'
5
+ }
6
+
7
+ group = ' io.dksifoua.eshop'
8
+ version = ' 0.0.1-SNAPSHOT'
9
+
10
+ java {
11
+ toolchain {
12
+ languageVersion = JavaLanguageVersion . of(21 )
13
+ }
14
+ }
15
+
16
+ repositories {
17
+ mavenCentral()
18
+ }
19
+
20
+ ext {
21
+ set(' springCloudVersion' , " 2023.0.3" )
22
+ }
23
+
24
+ dependencies {
25
+ implementation ' org.springframework.boot:spring-boot-starter-security'
26
+ implementation ' org.springframework.cloud:spring-cloud-config-server'
27
+ implementation ' org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
28
+ testImplementation ' org.springframework.boot:spring-boot-starter-test'
29
+ testImplementation ' org.springframework.security:spring-security-test'
30
+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
31
+ }
32
+
33
+ dependencyManagement {
34
+ imports {
35
+ mavenBom " org.springframework.cloud:spring-cloud-dependencies:${ springCloudVersion} "
36
+ }
37
+ }
38
+
39
+ tasks. named(' test' ) {
40
+ useJUnitPlatform()
41
+ }
Original file line number Diff line number Diff line change
1
+ rootProject. name = ' config'
Original file line number Diff line number Diff line change
1
+ package io .dksifoua .eshop .config ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .cloud .config .server .EnableConfigServer ;
6
+
7
+ @ SpringBootApplication
8
+ @ EnableConfigServer
9
+ public class ConfigServerApplication {
10
+
11
+ public static void main (String [] args ) {
12
+ SpringApplication .run (ConfigServerApplication .class , args );
13
+ }
14
+
15
+ }
Original file line number Diff line number Diff line change
1
+ eureka :
2
+ client :
3
+ enabled : false
4
+ register-with-eureka : false
5
+ fetch-registry : false
6
+
7
+ logging :
8
+ level :
9
+ root : info
10
+ org.springframework.cloud.config : debug
11
+
12
+ server :
13
+ port : 8888
14
+
15
+ spring :
16
+ application :
17
+ name : config-server
18
+
19
+ cloud :
20
+ config :
21
+ server :
22
+ git :
23
+ uri : https://github.com/dksifoua/eshop-config
24
+
25
+ security :
26
+ user :
27
+ name : dksifoua
28
+ password : dksifoua
Original file line number Diff line number Diff line change
1
+ eureka :
2
+ client :
3
+ service-url :
4
+ defaultZone : ${EUREKA_URI:http://localhost:8761/eureka}
5
+
6
+ logging :
7
+ level :
8
+ root : info
9
+ org.springframework.cloud.config : debug
10
+
11
+ server :
12
+ port : 8888
13
+
14
+ spring :
15
+ application :
16
+ name : config-server
17
+
18
+ cloud :
19
+ config :
20
+ server :
21
+ git :
22
+ uri : https://github.com/dksifoua/eshop-config
23
+
24
+ security :
25
+ user :
26
+ name : dksifoua
27
+ password : dksifoua
Original file line number Diff line number Diff line change
1
+ package io .dksifoua .eshop .config ;
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
+ @ SpringBootTest
8
+ @ ActiveProfiles (profiles = "test" )
9
+ class ConfigServerApplicationTests {
10
+
11
+ @ Test
12
+ void contextLoads () {
13
+ }
14
+
15
+ }
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ rootProject.name = 'eshop'
2
2
3
3
include(' api-gateway' )
4
4
include(' catalog-service' )
5
+ include(' config-server' )
5
6
include(' eureka-server' )
You can’t perform that action at this time.
0 commit comments