Skip to content

Latest commit

 

History

History
 
 

solon.extend.staticfiles

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

配置

solon.mime.json: "application/json"

solon.staticfiles:
  enabled: true
  maxAge: 6000

solon.extend: "!jt_ext" #!开头,表示如果没有扩展目录则自动创建 //用于支持 ExtendStaticRepository

代码

public class App {
    public static void main(String[] args) {
        Solon.start(App.class, args, app -> {
            //添加静态目录印射

            //1.添加扩展目录:${solon.extend}/static/
            StaticMappings.add("/", new ExtendStaticRepository());
            //2.添加本地绝对目录
            StaticMappings.add("/", new FileStaticRepository("/data/sss/water/water_ext/"));
            //3.添加资源路径
            StaticMappings.add("/", new ClassPathStaticRepository("user"));
        });
    }
}