-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Spring Boot 3.2 compatibility #884
Comments
Did quick temporary solution: @Configuration
public class JobRunrConfig {
@Bean
public StorageProvider dataSource(JobMapper jobMapper, MongoClient mongoClient, @Value("${org.jobrunr.database.database-name}") String dbName) {
new MyMongoDBCreator(mongoClient, dbName).runMigrations();
var storageProvider = new MongoDBStorageProvider(mongoClient, "example-jobrunr", StorageProviderUtils.DatabaseOptions.SKIP_CREATE);
storageProvider.setJobMapper(jobMapper);
return storageProvider;
}
public record MyNoSqlMigration(String className) implements NoSqlMigration {
@Override
public String getClassName() {
return className;
}
@Override
public Class<?> getMigrationClass() throws ClassNotFoundException {
return Class.forName(className);
}
@Override
public <T> T getMigration() throws IOException, ClassNotFoundException {
try {
return (T) Class.forName(className).getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
// TODO it's temporary solution until JobRunr fix it
// https://github.com/jobrunr/jobrunr/issues/884
public static class MyMongoDBCreator extends MongoDBCreator {
public MyMongoDBCreator(MongoClient mongoClient, String dbName) {
super(mongoClient, dbName);
}
@Override
protected Stream<NoSqlMigration> getMigrations() {
return Stream.of(
M001_CreateJobCollection.class.getName(),
M002_CreateRecurringJobCollection.class.getName(),
M003_CreateBackgroundJobServerCollection.class.getName(),
M004_CreateJobStatsCollection.class.getName(),
M005_CreateMetadataCollectionAndDropJobStats.class.getName(),
M006_UpdateRecurringJobsCollectionAddCreatedAtIndex.class.getName(),
M007_UpdateJobsCollectionReplaceIndices.class.getName()
).map(MyNoSqlMigration::new);
}
}
} |
Thanks for the issue @oleh-melnyk. We tried but cannot reproduce it (see https://github.com/jobrunr/example-java-mag/tree/issue/884). Could you create a repository that reproduces this? |
@auloin reproduced on the same example by adding |
Thanks @oleh-melnyk, I'm now able to reproduce it. A fix will be published as soon as we're able to determine and understand the impact of Spring Boot 3.2 on JobRunr. |
Root cause is found: see commit spring-projects/spring-boot@7ad4a98 |
I'm investigating what we can do in Spring Boot to fix this. In the meantime, you can revert to the classic jar loader by configuring the Maven plugin as follows: <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<loaderImplementation>CLASSIC</loaderImplementation>
</configuration>
</plugin>
</plugins>
</build> |
Wauw, thanks @philwebb for taking the time to respond here - appreciate it! |
This will automatically be solved with the release of Spring Boot 3.2.1. |
JobRunr Version
6.3.3
JDK Version
OpenJDK Temurin-21+35
Your SQL / NoSQL database
mongo:latest
What happened?
Attempting to create the
StorageProvider
bean is failing due to path resolving issues. This issue is observed only with Spring Boot version 3.2.How to reproduce?
create simple project with the following dependencies:
Here is my
JobRunrStorageConfig
:And simple service:
The I just build (
mvn clean install
) and run my simple app (java -jar target/springboot3-jobrunr-error-0.0.1-SNAPSHOT.jar
)Relevant log output
The text was updated successfully, but these errors were encountered: