静态映射
前者后面只能直接跟文件名,后者后面可以跟多级目录,再跟文件名
/* 代表后面只能直接跟文件 : http://localhost:10011/aaa/002.html
/aaa/002.html ------》D:/aaa/002.html
/**
* 代表后面只能直接跟文件 http://localhost:10011/aaa/002.html /aaa/002.html ------》/aaa/002.html
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.
addResourceHandler("/swagger-ui/**","/aaa/*")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/","file:D:/aaa/")
.resourceChain(false);
}
/** 代表后面能跟多个个目录,如 访问 http://localhost:10011/aaa/report/ddd/005.html /aaa/report/ddd/005.html----->D:/aaa/report/ddd/005.html
/**
* /** 代表后面能跟多个个目录,如 访问 http://localhost:10011/aaa/report/ddd/005.html report/ddd/005.html----->D:/aaa/report/ddd/005.html
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.
addResourceHandler("/swagger-ui/**","/aaa/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/","file:D:/aaa/")
.resourceChain(false);
}
指定路径
在mybatis中指定xml文件所在的位置时
/**
*1. 只可以找到mapper目录下以 .xml 为后缀的文件
*/
static final String MAPPER_LOCATION = "classpath:mybatis/db/mapper/*.xml";
1.所有的xml文件只能直接放在mapper下,不能放在子文件夹中
2.只能放在mapper下的一级子目录(一级文件夹),如必须直接放在a文件下,如果直接放在mapper下或者放在a文件的子目录b文件夹,就会报错:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.leilankeji.mailboxes.db.dao.UserMapper.selectUsers
static final String MAPPER_LOCATION = "classpath:mybatis/db/mapper/*/*.xml";
3.不论放在mapper下的哪个位置都可以找到
static final String MAPPER_LOCATION = "classpath:mybatis/db/mapper/**/*.xml";