quarkus-for-spring-developers / examples

Example code for the Quarkus for Spring Developers eBook
https://red.ht/quarkus-spring-devs
Apache License 2.0
46 stars 17 forks source link

Purpose of the greeting-application.properties file at root of chapter-6 directory ? #84

Closed edeandrea closed 3 years ago

edeandrea commented 3 years ago

Theres a greeting-application.properties file at the root of the chapter-6 directory. Which project does it belong in?

edeandrea commented 3 years ago

@cmoulliard ?

cmoulliard commented 3 years ago

heres a greeting-application.properties file at the root of the chapter-6 directory. Which project does it belong in?

This file is used/needed by the Spring Cloud Config Server when it will fetch the properties files from a git repository. As it is not possible to declare a path/subpath, this is the reason why it has been created under the path=chapter-6 of the github repository.

Here is the project that we are using currently as this git examples repository is still private and wgere the path defined is chapter-6: https://github.com/ch007m/config-repo/tree/main/chapter-6

Make sense @edeandrea

edeandrea commented 3 years ago

I don't think I quite understand what you are saying here. Are you saying the greeting-application.properties file at the root of the chapter-6 directory (https://github.com/quarkus-for-spring-developers/examples/blob/main/chapter-6/greeting-application.properties) is the source for https://github.com/ch007m/config-repo/blob/main/chapter-6/greeting-application.properties?

Spring Cloud config server does support multiple paths, but I think keeping the SCCS config as simple as possible is best. Would it make sense to move that config-repo you have in the ch007m space into the quarkus-for-spring-developers org? Something like https://github.com/quarkus-for-spring-developers/sccs-config-repo?

cmoulliard commented 3 years ago

I don't think I quite understand what you are saying here. Are you saying the greeting-application.properties file at the root of the chapter-6 directory (https://github.com/quarkus-for-spring-developers/examples/blob/main/chapter-6/greeting-application.properties) is the source for https://github.com/ch007m/config-repo/blob/main/chapter-6/greeting-application.properties?

Not at all

cmoulliard commented 3 years ago

Spring Cloud config server does support multiple paths

Yes but it do not support to declare a search path as path/subpath1/subpath2. Only one level (or subpath is supported). See discussion here: https://stackoverflow.com/questions/50508388/multiple-search-paths-for-config-server-in-spring-boot

So, in our case (or mine as my github project is public ;-)), we can only declare the greeting-application.properties file under the first level which is chapter-6 as we cannot define as search path chapter-6/chapter-6-quarkus-rest-cloud-config

This config works

spring:
  cloud:
    config:
      server:
        git:
          uri:[git repo]
          search-paths:
           - chapter-6
               greeting-application.properties

but not at all

spring:
  cloud:
    config:
      server:
        git:
          uri:[git repo]
          search-paths:
           - chapter-6
              - chapter-6-quarkus-rest-cloud-config
                       greeting-application.properties

Conclusion: This is the reason why the file greeting-application.properties has been added to the folder chapter-6