| MybatisProperties含有的属性: @ConfigurationProperties(prefix = "mybatis" ) public class MybatisProperties {  public static final String MYBATIS_PREFIX = "mybatis";  private static final ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();  private String configLocation;  private String[] mapperLocations;  private String typeAliasesPackage;  private Class<?> typeAliasesSuperType;  private String typeHandlersPackage;  private boolean checkConfigLocation = false;  private ExecutorType executorType;  private Properties configurationProperties;  @NestedConfigurationProperty  private Configuration configuration; } 
 C、使用MyBatis mybatis: config-location: classpath:mybatis.xml        # mybatis配置文件所在路径 type-aliases-package: com.creditease.permission.model    # 所有Entity别名类所在包 mapper-locations: classpath:mybatis/**/*.xml 
 从上面的MybatisProperties可以看出,mybatis可以指定一些configuration,比如自定义拦截器pageHelper。 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"     "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration>     <plugins>         <plugin interceptor="com.github.pagehelper.PageInterceptor"></plugin>         <plugin interceptor="com.creditease.permission.manager.MybatisInterceptor"></plugin>     </plugins> </configuration> 
 @MapperScan("com.creditease.permission.dao")//mapper类所在目录 public class SsoApplication {     public static void main(String[] args) {         SpringApplication.run(SsoApplication.class, args);     } } 
 4)事务 (编辑:92站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |