NutzCN Logo
问答 初始化时取得配置文件键值
发布于 2912天前 作者 threefish 1533 次浏览 复制 上一个帖子 下一个帖子
标签:
 public class MainSetup implements Setup {
    @Override
    public void init(NutConfig nutConfig) {
      //想在这里取得配置文件键值内容
   }
}

如何操作呢?

4 回复

假设名叫conf

Ioc ioc = nutConfig.getIoc();
PropertiesProxy conf = ioc.get(PropertiesProxy.class, "conf");

@wendal 我的配置文件
文件名sys.properties

#是否开发模式
isDeveloper=true

以下两种方式都没有获取到,我没写对吧

PropertiesProxy conf = ioc.get(PropertiesProxy.class, "sys");
PropertiesProxy conf = ioc.get(PropertiesProxy.class, "isDeveloper");

@qq_a0db4426 不是key的名字,是dao.js里面PropertiesProxy的定义名称

如果不知道我在说啥,先看 新手入门

添加回复
请先登陆
回到顶部