true has multiple purposes. One, as you said if you don't want to include a jar as a transitive dependency you can set it as optional. Second, if you use some jar only for local development such as lombok, spring-boot-docker-compose and you don't need them to be packaged in the final fat-jar. From official docs: maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html "Optional dependencies save space and memory. They prevent problematic jars that violate a license agreement or cause classpath issues from being bundled into a WAR, EAR, fat jar, or the like." In our case, we are using optional=true so that we make use of them only for development and not to package in the final artifact.
sir while interacting with database it need to create datasource object it reads the necessary properties from application.propreties (autoconfiguration and bulk injection) right in the first demo the properties are there in compose.yaml file so from compose.yaml how it will read ?
While using Spring Boot docker compose support for database, Spring Boot will ignore the properties configured in application.properties file and use POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB env variable values configured in compose.yaml file. I have demonstrated this here ua-cam.com/video/fTcyyxs3ZXI/v-deo.htmlsi=cEXXle4ibeuQn1Yg&t=588
Awesome! Good job, man!
Awesome
Thanks for the video!
2:00 When I google the term true then I came to know it means
true controls transitive inclusion for downstream projects, not packaging.
true has multiple purposes. One, as you said if you don't want to include a jar as a transitive dependency you can set it as optional. Second, if you use some jar only for local development such as lombok, spring-boot-docker-compose and you don't need them to be packaged in the final fat-jar.
From official docs: maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
"Optional dependencies save space and memory. They prevent problematic jars that violate a license agreement or cause classpath issues from being bundled into a WAR, EAR, fat jar, or the like."
In our case, we are using optional=true so that we make use of them only for development and not to package in the final artifact.
great video ... thanks 👍
sir while interacting with database it need to create datasource object it reads the necessary properties from application.propreties (autoconfiguration and bulk injection) right in the first demo the properties are there in compose.yaml file so from compose.yaml how it will read ?
While using Spring Boot docker compose support for database, Spring Boot will ignore the properties configured in application.properties file and use POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB env variable values configured in compose.yaml file.
I have demonstrated this here ua-cam.com/video/fTcyyxs3ZXI/v-deo.htmlsi=cEXXle4ibeuQn1Yg&t=588