// Path: src/main/java/org/auslides/security/repository/DbSetup.java
// public class DbSetup {
//     public static void runScript(DataSource ds, String resource) throws IOException, SQLException {
//         Connection connection = ds.getConnection();
//         try {
//             ScriptRunner runner = new ScriptRunner(connection);
//             runner.setAutoCommit(true);
//             runner.setStopOnError(false);
//             runner.setLogWriter(null);
//             runner.setErrorLogWriter(null);
//             runScript(runner, resource);
//         } finally {
//             connection.close();
//         }
//     }
//     public static void runScript(ScriptRunner runner, String resource) throws IOException, SQLException {
//         Reader reader = Resources.getResourceAsReader(resource);
//         try {
//             runner.runScript(reader);
//         } finally {
//             reader.close();
//         }
//     }
// }


import javax.sql.DataSource;
import org.auslides.security.repository.DbSetup;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import org.springframework.transaction.PlatformTransactionManager;
import java.sql.Driver;
package org.auslides.security.config;




@Configuration
@PropertySource(value = { "classpath:datasource.properties" })
@MapperScan("org.auslides.security.mapper")
public class MybatisConfig {
	@Value("${dev.app.jdbc.driver}")
    private String driverClass ;

	@Value("${dev.app.jdbc.url}")
	private String dbUrl ;

	@Bean
	public DataSource dataSource() {
		SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
        try {
            dataSource.setDriverClass((Class<Driver>)Class.forName(driverClass));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        dataSource.setUrl(dbUrl);
        dataSource.setUsername("");
		dataSource.setPassword("");

        initDb(dataSource);

		return dataSource;
	}

    private void initDb(DataSource dataSource) {
        try {
// Path: src/main/java/org/auslides/security/repository/DbSetup.java
// public class DbSetup {
//     public static void runScript(DataSource ds, String resource) throws IOException, SQLException {
//         Connection connection = ds.getConnection();
//         try {
//             ScriptRunner runner = new ScriptRunner(connection);
//             runner.setAutoCommit(true);
//             runner.setStopOnError(false);
//             runner.setLogWriter(null);
//             runner.setErrorLogWriter(null);
//             runScript(runner, resource);
//         } finally {
//             connection.close();
//         }
//     }
//     public static void runScript(ScriptRunner runner, String resource) throws IOException, SQLException {
//         Reader reader = Resources.getResourceAsReader(resource);
//         try {
//             runner.runScript(reader);
//         } finally {
//             reader.close();
//         }
//     }
// }


// Path: src/main/java/org/auslides/security/config/MybatisConfig.java
import javax.sql.DataSource;
import org.auslides.security.repository.DbSetup;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import org.springframework.transaction.PlatformTransactionManager;
import java.sql.Driver;

package org.auslides.security.config;




@Configuration
@PropertySource(value = { "classpath:datasource.properties" })
@MapperScan("org.auslides.security.mapper")
public class MybatisConfig {
	@Value("${dev.app.jdbc.driver}")
    private String driverClass ;

	@Value("${dev.app.jdbc.url}")
	private String dbUrl ;

	@Bean
	public DataSource dataSource() {
		SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
        try {
            dataSource.setDriverClass((Class<Driver>)Class.forName(driverClass));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        dataSource.setUrl(dbUrl);
        dataSource.setUsername("");
		dataSource.setPassword("");

        initDb(dataSource);

		return dataSource;
	}

    private void initDb(DataSource dataSource) {
        try {
            DbSetup.runScript(dataSource, TOKEN_DDL);