All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.spring.cfg.SqlClientInitializer Maven / Gradle / Ivy

There is a newer version: 0.9.19
Show newest version
package org.babyfish.jimmer.spring.cfg;

import org.babyfish.jimmer.sql.JSqlClient;
import org.babyfish.jimmer.sql.kt.KSqlClient;
import org.babyfish.jimmer.sql.kt.impl.KSqlClientImplementor;
import org.babyfish.jimmer.sql.runtime.JSqlClientImplementor;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

import java.util.List;

public class SqlClientInitializer implements ApplicationRunner {

    private final List javaSqlClients;

    private final List kotlinSqlClients;

    public SqlClientInitializer(List javaSqlClients, List kotlinSqlClients) {
        this.javaSqlClients = javaSqlClients;
        this.kotlinSqlClients = kotlinSqlClients;
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        for (JSqlClient sqlClient : javaSqlClients) {
            ((JSqlClientImplementor) sqlClient).initialize();
        }
        for (KSqlClient sqlClient : kotlinSqlClients) {
            ((KSqlClientImplementor) sqlClient).initialize();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy