AndServer
AndServer copied to clipboard
WebConfig 是怎么使用的?
@Config
public class AppConfig implements WebConfig {
@Override
public void onConfig(Context context, Delegate delegate) {
delegate.addWebsite(new AssetsWebsite(context, "/web"));
delegate.setMultipart(Multipart.newBuilder()
.allFileMaxSize(1024 * 1024 * 20) // 20M
.fileMaxSize(1024 * 1024 * 5) // 5M
.maxInMemorySize(1024 * 10) // 1024 * 10 bytes
.uploadTempDir(new File(context.getCacheDir(), "_server_upload_cache_"))
.build());
}
}
在Demo中是这样写的 这个是不是 等同于配置了 AssetsWebsite 。@Config 注解在API里面没有阐述作用,作者能在文档里面添加一下嘛?谢谢
可以认为@Config等价于Springboot里的@Configuration,个人推测AndServer启动时应该是会执行onConfig方法的