fastmybatis 2.2.1 released, mybatis development tool

fastmybatis 2.2.1 is released, this update is as follows:

The biggest change in this update is that there is no need to rely on the spring framework. The specific usage is as follows:

public static void main(String[] args) {
    // 启动加载
    Fastmybatis.create()
        // 指定mybatis-config.xml文件classpath路径
        .configLocation("mybatis/mybatis-config.xml")
        // 指定mybatis sql文件classpath目录
        .mapperLocations("mybatis/mapper")
        // 指定Mapper接口package
        .basePackage("com.myapp.dao")
        .load();

    // 使用mapper
    TUser user = Mappers.run(TUserMapper.class, mapper -> {
        return mapper.getById(6);
    });
    System.out.println(user);
}

Because there is no dependency on the spring framework, SqlSession needs to be managed, such as commit, rollback, and shutdown. Therefore fastmybatis provides a simple tool class to automatically commit, close

Mappers.run(TUserMapper.class, mapper -> {
        return mapper.getById(6);
    });

If it is a Spring project, you can use dependency injection, @Autowired private TUserMapper mapper; 

For more usage, you can go to the project homepage to view.

About fastmybatis

fastmybatis is a mybatis development framework, its purpose is: simple, fast and effective.

  • Quick start with zero configuration, no need to rely on Spring
  • Add, delete, modify and check operations without writing xml files
  • 支持mysql、sqlserver、oracle、postgresql、sqlite
  • Support custom sql, no need to write SQL for basic addition, deletion, modification and query, other special SQL (such as statistical SQL) can be written in xml
  • Support integration with spring-boot, just rely on starter
  • Support plug-in writing
  • Support ActiveRecord mode
  • Support for multi-tenancy
  • Provide general service
  • Rich API, up to 40+ methods, to meet daily development needs.
  • Lightweight, non-invasive, an extension of the official mybatis

 

 

Guess you like

Origin www.oschina.net/news/190276/fastmybatis-2-2-1-released