Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 084342a

Browse files
cppwfssdeleuze
authored andcommitted
Added hint to support spring-integration-jdbc dependency.
Currently if this dependency is present in a project, schema-h2 (if h2 is specifed as datastore) is not found. ``` Caused by: org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from class path resource [org/springframework/integration/jdbc/schema-h2.sql]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/integration/jdbc/schema-h2.sql] cannot be opened because it does not exist org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:239) org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:254) org.springframework.jdbc.datasource.init.DatabasePopulatorUtils.execute(DatabasePopulatorUtils.java:49) org.springframework.boot.jdbc.AbstractDataSourceInitializer.initialize(AbstractDataSourceInitializer.java:71) org.springframework.boot.jdbc.AbstractDataSourceInitializer.afterPropertiesSet(AbstractDataSourceInitializer.java:55) [...] Caused by: java.io.FileNotFoundException: class path resource [org/springframework/integration/jdbc/schema-h2.sql] cannot be opened because it does not exist org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:187) org.springframework.core.io.support.EncodedResource.getReader(EncodedResource.java:146) org.springframework.jdbc.datasource.init.ScriptUtils.readScript(ScriptUtils.java:328) org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:236) ``` This PR adds a hint to resolve this issue.
1 parent 7037f56 commit 084342a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

spring-native-configuration/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
<artifactId>spring-integration-core</artifactId>
8585
<scope>provided</scope>
8686
</dependency>
87+
<dependency>
88+
<groupId>org.springframework.integration</groupId>
89+
<artifactId>spring-integration-jdbc</artifactId>
90+
<scope>provided</scope>
91+
</dependency>
8792
<dependency>
8893
<groupId>org.springframework.cloud</groupId>
8994
<artifactId>spring-cloud-task-batch</artifactId>

spring-native-configuration/src/main/java/org/springframework/integration/IntegrationHints.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.integration;
1818

19+
import org.springframework.integration.jdbc.store.JdbcMessageStore;
1920
import org.springframework.nativex.hint.AccessBits;
2021
import org.springframework.nativex.hint.InitializationHint;
2122
import org.springframework.nativex.hint.InitializationTime;
@@ -24,7 +25,15 @@
2425
import org.springframework.nativex.hint.ResourceHint;
2526
import org.springframework.nativex.hint.TypeHint;
2627
import org.springframework.nativex.type.NativeConfiguration;
27-
28+
@NativeHint(trigger = JdbcMessageStore.class,
29+
resources = @ResourceHint(patterns = {
30+
"org/springframework/integration/jdbc/schema-h2.sql",
31+
"org/springframework/integration/jdbc/schema-mysql.sql",
32+
"org/springframework/integration/jdbc/schema-oracle.sql",
33+
"org/springframework/integration/jdbc/schema-postgresql.sql",
34+
"org/springframework/integration/jdbc/schema-hsqldb.sql",
35+
"org/springframework/integration/jdbc/schema-sqlserver.sql",
36+
"org/springframework/integration/jdbc/schema-sybase.sql"}))
2837
@NativeHint(trigger = org.springframework.integration.config.EnableIntegration.class,
2938
initialization =
3039
@InitializationHint(initTime = InitializationTime.BUILD,

0 commit comments

Comments
 (0)