Skip to content
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

Database migrations for Quartz scheduler is not working [SPR-17125] #21662

Open
spring-projects-issues opened this issue Aug 6, 2018 · 1 comment
Labels
in: data status: waiting-for-triage

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 6, 2018

Chandan Kumar opened SPR-17125 and commented

Spring-boot's auto-configure for Quartz is failing at the data migration step. This appears to be either a fault of the SQL migration file or the ScriptUtils.splitSqlScript of the Spring-JDBC project. I think it might be the splitSQLScript method, since the SQL file seems to be working fine if run manually through MySQL CLI.

ScriptUtils:

https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java#L139

SQL Migration file:

https://github.com/quartz-scheduler/quartz/blob/master/quartz-core/src/main/resources/org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql

As a workaround, I have copied the migration to my project, which seems to be working fine.

 


No further details from SPR-17125

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 25, 2018

krueger commented

Hi Thomas,

I tried to reproduce the problem but everything works fine:

public class Main {

    public static void main(String[] args) {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(RootConfiguration.class);
        Service service = ctx.getBean(Service.class);
        for (MyBean myBean : service.myBeans) {
            System.out.println(myBean.name);
        }
    }

}

@Configuration
@ComponentScan(basePackages = "spring")
public class RootConfiguration {

    @Bean
    @Qualifier("myBean1")
    MyBean myBean1() {
        return new MyBean("bean1", this::functionMyBean1);
    }

    @Bean
    @Qualifier("myBean2")
    MyBean myBean2() {
        return new MyBean("bean2", this::functionMyBean2);
    }

    private String functionMyBean1(String in) {
        return in + "_1";
    }

    private String functionMyBean2(String in) {
        return in + "_2";
    }

}

public class MyBean {

    String name;

    Function<String, String> function;

    public MyBean(String name, Function<String, String> function) {
        this.name = name;
        this.function = function;
    }

}

@org.springframework.stereotype.Service
public class Service {

    @Autowired
    protected List<MyBean> myBeans;

}

Can you show me hot to reproduce it?

@spring-projects-issues spring-projects-issues added type: bug status: waiting-for-triage in: data and removed type: bug labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data status: waiting-for-triage
Projects
None yet
Development

No branches or pull requests

1 participant