Class XMLMyBatisModule

java.lang.Object
com.google.inject.AbstractModule
org.mybatis.guice.XMLMyBatisModule
All Implemented Interfaces:
com.google.inject.Module

public abstract class XMLMyBatisModule extends com.google.inject.AbstractModule
Easy to use helper Module that alleviates users to write the boilerplate google-guice bindings to create the SqlSessionFactory, via XML configuration.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final com.google.inject.matcher.AbstractMatcher<Method>
     
    protected static final com.google.inject.matcher.AbstractMatcher<Method>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    Add the variables will be used to replace placeholders in the MyBatis configuration.
    protected void
    bind transactional interceptors.
    protected final void
     
    protected static Set<Class<?>>
    getClasses(String packageName)
    Return a set of all classes contained in the given package.
    protected static Set<Class<?>>
    getClasses(org.apache.ibatis.io.ResolverUtil.Test test, String packageName)
    Return a set of all classes contained in the given package that match with the given test requirement.
    protected final ClassLoader
    Gets the resource class loader.
    protected abstract void
    Initialize.
    protected final void
    setClassPathResource(String classPathResource)
    Set the MyBatis configuration class path resource.
    protected final void
    setEnvironmentId(String environmentId)
    Set the MyBatis configuration environment id.
    void
    Use jdbc driver class loader.
    void
    useResourceClassLoader(ClassLoader resourceClassLoader)
    Use resource class loader.

    Methods inherited from class com.google.inject.AbstractModule

    addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestInjection, requestStaticInjection, requireBinding, requireBinding

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DECLARED_BY_OBJECT

      protected static final com.google.inject.matcher.AbstractMatcher<Method> DECLARED_BY_OBJECT
    • SYNTHETIC

      protected static final com.google.inject.matcher.AbstractMatcher<Method> SYNTHETIC
  • Constructor Details

    • XMLMyBatisModule

      public XMLMyBatisModule()
  • Method Details

    • setClassPathResource

      protected final void setClassPathResource(String classPathResource)
      Set the MyBatis configuration class path resource.
      Parameters:
      classPathResource - the MyBatis configuration class path resource
    • setEnvironmentId

      protected final void setEnvironmentId(String environmentId)
      Set the MyBatis configuration environment id.
      Parameters:
      environmentId - the MyBatis configuration environment id
    • addProperties

      protected final void addProperties(Properties properties)
      Add the variables will be used to replace placeholders in the MyBatis configuration.
      Parameters:
      properties - the variables will be used to replace placeholders in the MyBatis configuration
    • getClasses

      protected static Set<Class<?>> getClasses(String packageName)
      Return a set of all classes contained in the given package.
      Parameters:
      packageName - the package has to be analyzed.
      Returns:
      a set of all classes contained in the given package.
    • getClasses

      protected static Set<Class<?>> getClasses(org.apache.ibatis.io.ResolverUtil.Test test, String packageName)
      Return a set of all classes contained in the given package that match with the given test requirement.
      Parameters:
      test - the class filter on the given package.
      packageName - the package has to be analyzed.
      Returns:
      a set of all classes contained in the given package.
    • configure

      protected final void configure()
      Overrides:
      configure in class com.google.inject.AbstractModule
    • bindTransactionInterceptors

      protected void bindTransactionInterceptors()
      bind transactional interceptors.
    • useResourceClassLoader

      public void useResourceClassLoader(ClassLoader resourceClassLoader)
      Use resource class loader.
      Parameters:
      resourceClassLoader - the resource class loader
      Since:
      3.3
    • getResourceClassLoader

      protected final ClassLoader getResourceClassLoader()
      Gets the resource class loader.
      Returns:
      the resource class loader
      Since:
      3.3
    • useJdbcDriverClassLoader

      public void useJdbcDriverClassLoader(ClassLoader driverClassLoader)
      Use jdbc driver class loader.
      Parameters:
      driverClassLoader - the driver class loader
      Since:
      3.3
    • initialize

      protected abstract void initialize()
      Initialize.