Skip to content

restore .vm usage lost in .xdoc to .md migration #759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Introduction

## Translations
#[[##]]# Translations

Users can read about MyBatis-Spring-Boot-Starter in the following translations:

Expand All @@ -9,7 +9,7 @@ Users can read about MyBatis-Spring-Boot-Starter in the following translations:
<li class="zh"><a href="./zh/index.html">简体中文</a></li>
</ul>

## What is MyBatis-Spring-Boot-Starter?
#[[##]]# What is MyBatis-Spring-Boot-Starter?

The MyBatis-Spring-Boot-Starter help you build quickly MyBatis applications on top of the [Spring Boot](https://spring.io/projects/spring-boot).

Expand All @@ -19,7 +19,7 @@ By using this module you will achieve:
* Reduce the boilerplate to almost zero
* Less XML configuration

## Requirements
#[[##]]# Requirements

The MyBatis-Spring-Boot-Starter requires following versions:

Expand All @@ -35,11 +35,11 @@ The MyBatis-Spring-Boot-Starter requires following versions:
| **~~1.1 (EOL)~~** | ~~1.3~~ | ~~1.3~~ | ~~6 or higher~~ |
| **~~1.0 (EOL)~~** | ~~1.2~~ | ~~1.3~~ | ~~6 or higher~~ |

## Installation
#[[##]]# Installation

To use the MyBatis-Spring-Boot-Starter module, you just need to include the `mybatis-spring-boot-autoconfigure.jar` file and its dependencies(`mybatis.jar`, `mybatis-spring.jar` and etc ...) in the classpath.

### Maven
#[[###]]# Maven

If you are using Maven just add the following dependency to your `pom.xml`:

Expand All @@ -51,7 +51,7 @@ If you are using Maven just add the following dependency to your `pom.xml`:
</dependency>
```

### Gradle
#[[###]]# Gradle

If using gradle add this to your `build.gradle`:

Expand All @@ -61,7 +61,7 @@ dependencies {
}
```

## Quick Setup
#[[##]]# Quick Setup

As you may already know, to use MyBatis with Spring you need at least an `SqlSessionFactory` and at least one mapper interface.

Expand Down Expand Up @@ -110,7 +110,7 @@ public class SampleMybatisApplication implements CommandLineRunner {

This is all you have to do. You application can now be run as a normal Spring Boot application.

## Advanced scanning
#[[##]]# Advanced scanning

The MyBatis-Spring-Boot-Starter will search, by default, for mappers marked with the `@Mapper` annotation.

Expand All @@ -119,7 +119,7 @@ You may want to specify a custom annotation or a marker interface for scanning.
The MyBatis-Spring-Boot-Starter will not start the scanning process if it finds at least one `MapperFactoryBean` in the Spring's context so if you want to stop the scanning at all you should register your mappers explicitly with `@Bean` methods.


## Using an SqlSession
#[[##]]# Using an SqlSession

An instance of a `SqlSessionTemplate` is created and added to the Spring context, so you can use the MyBatis API letting it be injected into your beans like follows(available on Spring 4.3+):

Expand All @@ -140,7 +140,7 @@ public class CityDao {
}
```

## Configuration
#[[##]]# Configuration

As any other Spring Boot application a MyBatis-Spring-Boot-Application configuration parameters are stored inside the `application.properties`(or `application.yml`).

Expand Down Expand Up @@ -191,7 +191,7 @@ mybatis:
...
```

## Using a ConfigurationCustomizer
#[[##]]# Using a ConfigurationCustomizer

The MyBatis-Spring-Boot-Starter provide opportunity to customize a MyBatis configuration generated by auto-configuration using Java Config.
The MyBatis-Spring-Boot-Starter will search beans that implement the `ConfigurationCustomizer` interface by automatically,
Expand All @@ -214,7 +214,7 @@ public class MyBatisConfig {
}
```

## Using a SqlSessionFactoryBeanCustomizer
#[[##]]# Using a SqlSessionFactoryBeanCustomizer

The MyBatis-Spring-Boot-Starter provide opportunity to customize a `SqlSessionFactoryBean` generated by auto-configuration using Java Config.
The MyBatis-Spring-Boot-Starter will search beans that implement the `SqlSessionFactoryBeanCustomizer` interface by automatically,
Expand All @@ -237,7 +237,7 @@ public class MyBatisConfig {
}
```

## Using the SpringBootVFS
#[[##]]# Using the SpringBootVFS

The MyBatis-Spring-Boot-Starter provides the `SpringBootVFS` as an implementation class of `VFS`.
The `VFS` is used for searching classes (e.g. target class of type alias, type handler class) from an application (or application server).
Expand All @@ -261,7 +261,7 @@ public class MyBatisConfig {
}
```

## Detecting MyBatis components
#[[##]]# Detecting MyBatis components

The MyBatis-Spring-Boot-Starter will detects beans that implements following interface provided by MyBatis.

Expand Down Expand Up @@ -300,12 +300,12 @@ public class MyBatisConfig {

<span class="label important">NOTE</span>: If detected `LangaugeDriver`'s count is one, it set to default scripting language automatically.

## Customization for LanguageDriver
#[[##]]# Customization for LanguageDriver

If you want to customize the `LanguageDriver` that creating by auto-configure,
please register user defined bean.

### ThymeleafLanguageDriver
#[[###]]# ThymeleafLanguageDriver

```java
@Configuration
Expand All @@ -319,7 +319,7 @@ public class MyBatisConfig {
}
```

### FreeMarkerLanguageDriverConfig
#[[###]]# FreeMarkerLanguageDriverConfig

```java
@Configuration
Expand All @@ -333,7 +333,7 @@ public class MyBatisConfig {
}
```

### VelocityLanguageDriver
#[[###]]# VelocityLanguageDriver

```java
@Configuration
Expand All @@ -347,7 +347,7 @@ public class MyBatisConfig {
}
```

### Running Samples
#[[###]]# Running Samples

The project provides two samples so you play and experiment with them:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 简介

## 文档的翻译版本
#[[##]]# 文档的翻译版本

可以阅读 MyBatis-Spring-Boot-Starter 文档的以下翻译版本:

Expand All @@ -9,7 +9,7 @@
<li class="zh"><a href="./../zh/index.html">简体中文</a></li>
</ul>

## 什么是 MyBatis-Spring-Boot-Starter?
#[[##]]# 什么是 MyBatis-Spring-Boot-Starter?

MyBatis-Spring-Boot-Starter 可以帮助你更快地在 [Spring Boot](https://spring.io/projects/spring-boot) 之上构建 MyBatis 应用。

Expand All @@ -19,7 +19,7 @@ MyBatis-Spring-Boot-Starter 可以帮助你更快地在 [Spring Boot](https://sp
* 将几乎不需要样板配置
* 使用更少的 XML 配置

## 要求
#[[##]]# 要求

MyBatis-Spring-Boot-Starter 要求以下版本:

Expand All @@ -35,11 +35,11 @@ MyBatis-Spring-Boot-Starter 要求以下版本:
| **~~1.1 (EOL)~~** | ~~1.3~~ | ~~1.3~~ | ~~6 或更高~~ |
| **~~1.0 (EOL)~~** | ~~1.2~~ | ~~1.3~~ | ~~6 或更高~~ |

## 安装
#[[##]]# 安装

要使用 MyBatis-Spring-Boot-Starter 模块,你只需要将 `mybatis-spring-boot-autoconfigure.jar` 文件以及它的依赖( `mybatis.jar`, `mybatis-spring.jar` 等) 放在类路径下。

### Maven
#[[###]]# Maven

如果你使用 Maven,只需要在你的 `pom.xml` 添加以下依赖:

Expand All @@ -51,7 +51,7 @@ MyBatis-Spring-Boot-Starter 要求以下版本:
</dependency>
```

### Gradle
#[[###]]# Gradle

如果使用 gradle,请在你的 `build.gradle` 中加入以下内容:

Expand All @@ -61,7 +61,7 @@ dependencies {
}
```

## 快速开始
#[[##]]# 快速开始

正如你已经知道的, 要与 Spring 一起使用 MyBatis,你至少需要一个 `SqlSessionFactory` 和一个 mapper 接口。

Expand Down Expand Up @@ -110,15 +110,15 @@ public class SampleMybatisApplication implements CommandLineRunner {

这就是你需要做的所有事情了。 你的 Spring boot 应用可以正常运行了。

## “扫描”的进阶用法
#[[##]]# “扫描”的进阶用法

MyBatis-Spring-Boot-Starter 将默认搜寻带有 `@Mapper` 注解的 mapper 接口。

你可能想指定一个自定义的注解或接口来扫描,如果那样的话,你就必须使用 `@MapperScan` 注解了。在 [MyBatis-Spring 参考页面](https://mybatis.org/spring/zh/mappers.html#scan) 中查看更多信息。

如果 MyBatis-Spring-Boot-Starter 发现至少有一个 `SqlSessionFactoryBean` ,它将不会开始扫描。 所以如果你想停止扫描,你应该用 `@Bean` 方法明确注册你的 mapper。

## 使用 SqlSession
#[[##]]# 使用 SqlSession

一个 `SqlSessionTemplate` 的实例被创建并添加到 Spring 的环境中,因此你可以使用 MyBatis API,让它像下面一样被注入到你的 bean 中(Spring 4.3 以上可用)。

Expand All @@ -139,7 +139,7 @@ public class CityDao {
}
```

## 配置
#[[##]]# 配置

像其他的 Spring Boot 应用一样,配置参数在 `application.properties` (或 `application.yml` )。

Expand Down Expand Up @@ -190,7 +190,7 @@ mybatis:
...
```

## 使用 ConfigurationCustomizer
#[[##]]# 使用 ConfigurationCustomizer

MyBatis-Spring-Boot-Starter 提供了使用 Java Config 来自定义 MyBatis 配置的可能。

Expand All @@ -213,7 +213,7 @@ public class MyBatisConfig {
}
```

## 使用 SqlSessionFactoryBeanCustomizer
#[[##]]# 使用 SqlSessionFactoryBeanCustomizer

MyBatis-Spring-Boot-Starter 提供了使用 Java Config 来自定义自动配置生成的 `SqlSessionFactoryBean` 。

Expand All @@ -236,7 +236,7 @@ public class MyBatisConfig {
}
```

## 使用 SpringBootVFS
#[[##]]# 使用 SpringBootVFS

MyBatis-Spring-Boot-Starter 提供了 `SpringBootVFS` 作为 `VFS` 的实现类。
`VFS` 用于从应用或应用服务器中寻找类 (例如: 类型别名的目标类,类型处理器类) 。
Expand All @@ -260,7 +260,7 @@ public class MyBatisConfig {
}
```

## 探测 MyBatis 组件
#[[##]]# 探测 MyBatis 组件

The MyBatis-Spring-Boot-Starter 将检测实现以下由 MyBatis 提供的接口的组件。

Expand Down Expand Up @@ -301,7 +301,7 @@ public class MyBatisConfig {

如果你想自定义 `LangaugeDriver` 的配置,请注册用户定义的组件。

### ThymeleafLanguageDriver
#[[###]]# ThymeleafLanguageDriver

```java
@Configuration
Expand All @@ -315,7 +315,7 @@ public class MyBatisConfig {
}
```

### FreeMarkerLanguageDriverConfig
#[[###]]# FreeMarkerLanguageDriverConfig

```java
@Configuration
Expand All @@ -329,7 +329,7 @@ public class MyBatisConfig {
}
```

### VelocityLanguageDriver
#[[###]]# VelocityLanguageDriver

```java
@Configuration
Expand All @@ -343,7 +343,7 @@ public class MyBatisConfig {
}
```

### 可以运行的样例
#[[###]]# 可以运行的样例

项目(为每个分类)提供了至少两个样例,可以为你所用。

Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/src/site</directory>
<targetPath>${project.build.directory}/site-src</targetPath>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
Expand All @@ -104,8 +99,6 @@
<artifactId>maven-site-plugin</artifactId>
<configuration>
<locales>en,zh_CN</locales>
<!-- Build using files that replace a placeholder using project properties -->
<siteDirectory>${project.build.directory}/site-src</siteDirectory>
</configuration>
</plugin>
<plugin>
Expand Down