mybatis (configuration of the core profile)

properties tag

<!-- 
    Use properties to import the content of the external properties configuration file;   resource: import resources under the classpath   url: Introduce resources under the network path or disk path --> <properties resource="jdbc.properties"></properties>

 

 

settings tab

 

typeAliases (configuration aliases related operations)

<typeAliases>
        <!-- 1 , typeAlias: alias a java type
                type: Specify the full class name of the type to be aliased; the default alias is the lowercase class name; employee
                alias: specify a new alias
         -->
        <!-- <typeAlias type="com.mybatis.bean.Employee" alias="emp"/> -->
        
        <!-- 2. package : batch alias all classes under a package
                name: Specify the package name (set a default alias (class name lowercase) for each class of the current package and all descendant packages below),)
        -->
        <package name="com.mybatis.bean"/>
        
        <!-- 3. In the case of batch aliasing, use the @Alias ​​annotation to specify a new alias for a type, so that duplicates can be placed -->
    </typeAliases>

 

typeHandlers tag (type handler related)

 

 

plugins tag (plug-in related)

 

environments (configure various environments)

<!--
        4. environments: environments, mybatis can configure a variety of environments, and default specifies the use of a certain environment. A fast switching environment can be achieved.
            environment: configure a specific environment information; there must be two labels; id represents the unique identifier of the current environment
                transactionManager: transaction manager;
                    type: The type of transaction manager; JDBC(JdbcTransactionFactory) | MANAGED(ManagedTransactionFactory)
                        Custom transaction manager: Implement the TransactionFactory interface. type is specified as the full class name
                
                dataSource: data source;
                    type: data source type; UNPOOLED(UnpooledDataSourceFactory)
                                |POOLED(PooledDataSourceFactory)
                                |JNDI(JndiDataSourceFactory)
                    Custom data source: implement the DataSourceFactory interface, type is the full class name
         -->
         

         
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"></transactionManager>
            <dataSource type="POOLED">
                <property name="driver" value="${jdbc.driver}" />
                <property name="url" value="${jdbc.url}" />
                <property name="username" value="${jdbc.username}" />
                <property name="password" value="${jdbc.password}" />
            </dataSource>
        </environment>
    
        <environment id="test">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="${orcl.driver}" />
                <property name="url" value="${orcl.url}" />
                <property name="username" value="${orcl.username}" />
                <property name="password" value="${orcl.password}" />
            </dataSource>
        </environment>
    </environments>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325808716&siteId=291194637
Recommended