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
This is a variation of already fixed issue with JdbcTemplate#13155. But this is for NamedParameterJdbcTemplate.
The fix (4881925) doesn't take into account another kind of JdbcTemplate - NamedParameterJdbcTemplate, which implements NamedParameterJdbcOperations (and doesn't implement JdbcOperations).
So, if an application doesn't create JdbcTemplate bean but only creates NamedParameterJdbcTemplate bean (using it's NamedParameterJdbcTemplate(DataSource dataSource) constructor), this bean still created before migration tool (e.g. Flyway) runs their migrations. So any @PostConstruct, that uses NamedParameterJdbcTemplate, runs earlier than migration. What is worse: there is not always the case. Sometimes migrations runs earlier. I think this is more or less "random" order because there is no explicit @DependsOn here.
So I think it's need to create a NamedParameterJdbcOperationsDependsOnPostProcessor in line with JdbcOperationsDependsOnPostProcessor and Flyway/Liqbase childs of it.
Spring Boot version tested: 2.0.5. But I don't see any NamedParameterJdbcOperations postprocessors in master, so I think this bug affects current version too.
The text was updated successfully, but these errors were encountered:
This is a variation of already fixed issue with
JdbcTemplate
#13155. But this is forNamedParameterJdbcTemplate
.The fix (4881925) doesn't take into account another kind of
JdbcTemplate
-NamedParameterJdbcTemplate
, which implementsNamedParameterJdbcOperations
(and doesn't implementJdbcOperations
).So, if an application doesn't create
JdbcTemplate
bean but only createsNamedParameterJdbcTemplate
bean (using it'sNamedParameterJdbcTemplate(DataSource dataSource)
constructor), this bean still created before migration tool (e.g. Flyway) runs their migrations. So any@PostConstruct
, that usesNamedParameterJdbcTemplate
, runs earlier than migration. What is worse: there is not always the case. Sometimes migrations runs earlier. I think this is more or less "random" order because there is no explicit@DependsOn
here.So I think it's need to create a
NamedParameterJdbcOperationsDependsOnPostProcessor
in line withJdbcOperationsDependsOnPostProcessor
and Flyway/Liqbase childs of it.Spring Boot version tested: 2.0.5. But I don't see any
NamedParameterJdbcOperations
postprocessors in master, so I think this bug affects current version too.The text was updated successfully, but these errors were encountered: