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

Comment From: spring-projects-issues

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?

Comment From: snicoll

Closing due to the lack of feedback.