I using spring boot multiple modules and i want inherit application.properties from parent . I have parent module : spring-ecommere-demo and sub module : model , core and security. In parent modules i put some config jdbc look like :
application.properties (parent module)
spring.datasource.url=jdbc:mysql://localhost:3306/BaoTrung
spring.datasource.username=root
spring.datasource.password=123456
spring.jpa.show-sql=true
And in sub module security i specific config look like:
application-security.properties (security module)
app.jwtSecret= JWTSuperSecretKey
app.jwtExpirationInMs = 604800000
And config in Spring Boot application in security module look like :
@SpringBootApplication(scanBasePackages = "springecommeredemo")
@PropertySources({
@PropertySource("application-security.properties")
})
But when i run it, it throw me exception
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).
It mean sub module security can't inherit properties from parent project. How to inherit all properties from parent module. Because i using same database , i don't want config duplicate jdbc in my project. I want inherit common properties.Please help