thombergs / buckpal

An example approach for implementing a Clean/Hexagonal Architecture
https://leanpub.com/get-your-hands-dirty-on-clean-architecture/overview
2.13k stars 654 forks source link

Location of application.properties #19

Open JayAhn2 opened 3 years ago

JayAhn2 commented 3 years ago

Hi Tom,

First of all, Thanks for the nice demo project for hexagonal architecture. :) This project is the best implementations I've ever seen!

I'm quite a newbie on Spring Boot, so my question would be quite silly. As I see this project, I cannot find application.properties or application.yml. I guess this should exist if I want to add some configuration like DB connection.

Could you let me know why configuration file is missing in this project?

Thanks!

dhasilin commented 3 years ago

Also it is interesting how module *.properties files collaborate. There are some issues around @ConditionalOnProperty with different properties files.

amithksm commented 3 years ago

Same suggestion/issue as posted by JayAhn2. I intend to view the H2 database via localhost:8080/h2-console

RuneMolin commented 3 years ago

Properties, such as those that controls what database to use, are a Spring Boot feature and not relevant for individual applications to define. You can read more about them here

Spring Boot will default to an in-memory H2 database if nothing else is defined.

Also, it is best practice, per 12-factor apps not to allow an application to provide any sort of configuration, but expect the application to always be externally configured. Spring Boot provides many options for doing this, which you can study here

thombergs commented 3 years ago

@JayAhn2 @amithksm @RuneMolin thanks for the discussion!

Here are my 2 cents:

dhasilin commented 3 years ago

Got it, it generally you suggestion is to stick with one property file.

We end up with same approach, it's just not very "clean" when you have interchangeable plugins (based on client environment).