Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The overall architecture of MyBatis

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

I. Overview of modules

Module name

Action

Main category

Reflection module

Encapsulated JAVA API, easy to use, optimized for cache

Type conversion module

Bind arguments and map query result sets

Log module

Locate BUG to solve bottleneck

Resource loading module

Class loader, determining the order in which the class loader is used

Parser module

Xpath, initialize parsing mybatis-confg.xml,mapper.xml

Dynamic SQL placeholder

XPathParser

TokenHandler

EntityResolver

Data source module

Transaction management module

Abstract processing

Cache module

Provide primary and secondary caching

Binding module

Custom Mapper interface is associated with a mapping statement

Second, module analysis

2.1 Parser module

As the name implies: provides parsing of XML files.

GenericTokenParser: a universal placeholder parser.

TokenHandler: parsing placeholder

2.2 reflection Toolbox

Reflector: a Reflector corresponds to a class, caching the meta-information of the class needed for reflection.

ReflectorFactory: generate cache Reflector

TypeParameterResolver: utility class, parsing fields in the specified class, method return value, type of method parameter.

PropertyTokenizer is an Iterator interface that implements nested attribute parsing.

MetaClass: encapsulation and processing of class-level meta-information

ObjectWrapper: the wrapper of the object, abstracts the attribute information of the object, defines the method of updating the attribute and querying the attribute information.

ObjectFactory: create objects of a specified type

MetaObject: call ObjectWrapper to complete the detection, acquisition, setting and other functions of object attributes.

3. Type conversion

JDBC to JAVA type conversion and JAVA type to JDBC type conversion, two different types of bridge.

ResolverUtil: finds the class under the specified package based on the specified criteria.

3. Log module

Adapts to the differences of third-party log interfaces.

JDBC debugging: through the JDK dynamic proxy mode, the JDBC operation is printed through the specified log framework.

4.Binding

MapperProxy: proxy object

The registry for the MapperRegistry:Mapper interface and corresponding proxy object factory.

MapperMethod: encapsulates the information of the corresponding method in the Mapper interface, as well as the SQL statement information.

The method parameters defined by the ParamNameResolver:Mapper interface. Record the correspondence between the location index and the parameter name in the parameter list

Information about the methods defined in the MethodSignature:Mapper interface.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report