You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Component: Parameter Store
io.awspring.cloud:spring-cloud-aws-starter-parameter-store version 3.2.1
Describe the bug
I'm importing my params from the store:
(DeferredLog.java:251) - Bean of type AwsClientConfigurerParameterStore is not registered: io.awspring.cloud.autoconfigure.config.parameterstore.AwsParameterStoreClientCustomizer has not been registered
(DeferredLog.java:252) - Loading property from AWS Parameter Store with name: /config/my-app_stag/, optional: false
(DeferredLog.java:251) - Populating property retrieved from AWS Parameter Store: spring.datasource.password
(DeferredLog.java:251) - Populating property retrieved from AWS Parameter Store: spring.datasource.url
(DeferredLog.java:251) - Populating property retrieved from AWS Parameter Store: spring.datasource.username
My problem is that testing locally the System property values are correctly evaluated from the parameter store. example:
spring.datasource.url=jdbc:mysql://my_db
But when I deploy my app to ECS, reading url (and others) value from System.property result in empty string:
spring.datasource.url=
The result is that the hikari DataSource class initialization fails because there is no DB url.
This is the way I create the datasource:
@Primary
@ConfigurationProperties("spring.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
}
@Bean(name = "hikariDataSource")
@ConfigurationProperties(prefix = "spring.datasource.hikari") // set hikari specific properties
public HikariDataSource hikariDataSource(final DataSourceProperties properties) {
return properties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
}
@Bean(name = "dataSource")
@Primary
public DataSource dataSource(final HikariDataSource hikariDataSource) {
return hikariDataSource;
}
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine suitable jdbc url
Is it something related to order initialization?
Or something related?
I can't figure out what to do with this problem.
Thanks
The text was updated successfully, but these errors were encountered:
After days of debug I found the problem.
It's related to spring profile and the various application.yaml.
I'm working with 2 profiles:
local for local execution
stag for test and deploy in AWS
mail application.yml:
spring:
datasource:
url: url_to_db
username: foo
password: bar
application-local.yml: does not contains any spring parameters, it's everything in the main file
application-stag.yml:
spring:
datasource:
url:
username:
password:
As you can see in application-stag.yml I have empty properties, they are just a placeholder.
So when I run the app locally, the datasource url is retrieved and replaced from the param store.
BUT when I run the app in AWS the application file for the stag profile overrides the freshly read parameter from the store.
Deleting the placeholders in application-stag.yml did the trick, but I think this isn't good.
Type: Bug
Component: Parameter Store
io.awspring.cloud:spring-cloud-aws-starter-parameter-store version 3.2.1
Describe the bug
I'm importing my params from the store:
Params:
My problem is that testing locally the System property values are correctly evaluated from the parameter store. example:
But when I deploy my app to ECS, reading url (and others) value from System.property result in empty string:
The result is that the hikari DataSource class initialization fails because there is no DB url.
This is the way I create the datasource:
Is it something related to order initialization?
Or something related?
I can't figure out what to do with this problem.
Thanks
The text was updated successfully, but these errors were encountered: