Java Code Examples for org.apache.ibatis.builder.xml.XMLConfigBuilder#getConfiguration()

The following examples show how to use org.apache.ibatis.builder.xml.XMLConfigBuilder#getConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessEngineConfigurationImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
  XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties);
  Configuration configuration = parser.getConfiguration();

  if(databaseType != null) {
      configuration.setDatabaseId(databaseType);
  }

  configuration.setEnvironment(environment);

  initMybatisTypeHandlers(configuration);
  initCustomMybatisMappers(configuration);

  configuration = parseMybatisConfiguration(configuration, parser);
  return configuration;
}
 
Example 2
Source File: AbstractEngineConfiguration.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
    XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties);
    Configuration configuration = parser.getConfiguration();

    if (databaseType != null) {
        configuration.setDatabaseId(databaseType);
    }

    configuration.setEnvironment(environment);

    initCustomMybatisMappers(configuration);
    initMybatisTypeHandlers(configuration);
    initCustomMybatisInterceptors(configuration);
    if (isEnableLogSqlExecutionTime()) {
        initMyBatisLogSqlExecutionTimePlugin(configuration);
    }

    configuration = parseMybatisConfiguration(parser);
    return configuration;
}
 
Example 3
Source File: FormEngineConfiguration.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
  XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties);
  Configuration configuration = parser.getConfiguration();

  if (databaseType != null) {
    configuration.setDatabaseId(databaseType);
  }

  configuration.setEnvironment(environment);

  initCustomMybatisMappers(configuration);

  configuration = parseMybatisConfiguration(configuration, parser);
  return configuration;
}
 
Example 4
Source File: ProcessEngineConfigurationImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
 XMLConfigBuilder parser = new XMLConfigBuilder(reader,"", properties);
 Configuration configuration = parser.getConfiguration();
 configuration.setEnvironment(environment);
 
 initMybatisTypeHandlers(configuration);
 initCustomMybatisMappers(configuration);
 
 configuration = parseMybatisConfiguration(configuration, parser);
 return configuration;
}
 
Example 5
Source File: DmnEngineConfiguration.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
  XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties);
  Configuration configuration = parser.getConfiguration();

  if (databaseType != null) {
    configuration.setDatabaseId(databaseType);
  }

  configuration.setEnvironment(environment);

  initCustomMybatisMappers(configuration);

  configuration = parseMybatisConfiguration(configuration, parser);
  return configuration;
}
 
Example 6
Source File: ProcessEngineConfigurationImpl.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
    XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties);
    Configuration configuration = parser.getConfiguration();
    configuration.setEnvironment(environment);

    initMybatisTypeHandlers(configuration);
    initCustomMybatisMappers(configuration);

    configuration = parseMybatisConfiguration(configuration, parser);
    return configuration;
}
 
Example 7
Source File: SqlSessionFactoryBean.java    From gocd with Apache License 2.0 5 votes vote down vote up
private SqlSessionFactory buildSqlSessionFactory() throws IOException {
    SqlSessionFactoryBuilder factoryBuilder = new SqlSessionFactoryBuilder();

    XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(configLocation.getInputStream());
    Configuration configuration = xmlConfigBuilder.getConfiguration();
    configuration.setEnvironment(new Environment(getClass().getSimpleName(), new SpringManagedTransactionFactory(), this.dataSource));
    xmlConfigBuilder.parse();
    return factoryBuilder.build(configuration);
}
 
Example 8
Source File: MultipleSqlSessionFactoryBean.java    From super-cloudops with Apache License 2.0 3 votes vote down vote up
/**
 * Apply setting default configuration.
 * 
 * <pre>
 * mybatis-config.xml:
 * 
 * &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
 * &lt;!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
 * &lt;configuration&gt;
 *   &lt;settings&gt;
 *     &lt;!-- LOGBACK|SLF4J|LOG4J|LOG4J2|JDK_LOGGING|COMMONS_LOGGING|STDOUT_LOGGING|NO_LOGGING --&gt;
 *     &lt;setting name="logImpl" value="LOGBACK" /&gt;
 *     ...
 *   &lt;/settings&gt;
 * &lt;/configuration&gt;
 * </pre>
 * 
 * @throws IOException
 */
private void applyDefaultConfiguration() throws IOException {
	Resource configLocation = (Resource) getField(configLocationField, this);
	if (nonNull(configLocation)) {
		Properties props = (Properties) getField(configPropertiesField, this);
		XMLConfigBuilder builder = new XMLConfigBuilder(configLocation.getInputStream(), null, props);
		Configuration config = builder.getConfiguration();
		// Register support for logback.
		config.getTypeAliasRegistry().registerAlias("LOGBACK", LogbackImpl.class);
		setConfiguration(config);
	}
}