content: package com.us.config;
  
  import org.apache.ibatis.plugin.Interceptor;
  import org.apache.ibatis.type.JdbcType;
  import org.mybatis.spring.SqlSessionFactoryBean;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  import javax.sql.DataSource;
  import java.util.Properties;
  
  @Configuration
  public class MyBatisConfig {
  
  	@Autowired
  	private DataSource dataSource;
  
  	@Bean(name = "sqlSessionFactory")
  	public SqlSessionFactoryBean sqlSessionFactory(
  			ApplicationContext applicationContext) throws Exception {
  		SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
  		sessionFactory.setDataSource(dataSource);
  
  		org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
  		configuration.setMapUnderscoreToCamelCase(true);
  		configuration.setJdbcTypeForNull(JdbcType.NULL);
  		sessionFactory.setMapperLocations(applicationContext.getResources("classpath:mapper/*.xml"));
  
  
  		return sessionFactory;
  	}
  
  }
  