Package org.mybatis.guice
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
addProperties
(Properties properties) Add the variables will be used to replace placeholders in the MyBatis configuration.protected void
bind transactional interceptors.protected final void
getClasses
(String packageName) Return a set of all classes contained in the given package.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
useJdbcDriverClassLoader
(ClassLoader driverClassLoader) 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
-
Field Details
-
DECLARED_BY_OBJECT
-
SYNTHETIC
-
-
Constructor Details
-
XMLMyBatisModule
public XMLMyBatisModule()
-
-
Method Details
-
setClassPathResource
Set the MyBatis configuration class path resource.- Parameters:
classPathResource
- the MyBatis configuration class path resource
-
setEnvironmentId
Set the MyBatis configuration environment id.- Parameters:
environmentId
- the MyBatis configuration environment id
-
addProperties
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
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 classcom.google.inject.AbstractModule
-
bindTransactionInterceptors
protected void bindTransactionInterceptors()bind transactional interceptors. -
useResourceClassLoader
Use resource class loader.- Parameters:
resourceClassLoader
- the resource class loader- Since:
- 3.3
-
getResourceClassLoader
Gets the resource class loader.- Returns:
- the resource class loader
- Since:
- 3.3
-
useJdbcDriverClassLoader
Use jdbc driver class loader.- Parameters:
driverClassLoader
- the driver class loader- Since:
- 3.3
-
initialize
protected abstract void initialize()Initialize.
-