net core 简单读取json配置文件
2024-08-29 22:35:42
//添加 json 文件路径
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
//创建配置根对象
var configurationRoot = builder1.Build();
//读取到ioc IOptions<SuperAppsettings> setting 依赖注入
services.Configure<SuperAppsettings>(configurationRoot.GetSection("super")); // 依赖注入
最新文章
- 由Collections.unmodifiableList引发的重构
- java中静态的代码块,静态变量,静态方法
- 1890. Money out of Thin Air(线段树 dfs转换区间)
- android实现json数据的解析和把数据转换成json格式的字符串
- 玩转Web之Jsp(三)-----Jsp+SQLServer 用sql语句实现分页
- google code 上源码的下载方法
- JVM-1.编译
- UVW源码漫谈(二)
- doubi -- 初创
- RBM如何训练?
- amaze UI 如何添加原生表单验证
- Intellij IDEA 4种配置热部署的方法【转】【补】
- [Swift]LeetCode843. 猜猜这个单词 | Guess the Word
- 9 个 Yoinkmac使用小技巧,提升你的 Mac 文档解决效率
- php中按值传递和按引用传递的一个问题
- [转帖]/etc/security/limits.conf的含义
- what&#39;s the python之异常处理
- react 首屏加载优化
- PostMessage实现多窗口之间的数据传递
- 谈谈Linux下的数据流重定向和管道命令
热门文章
- 栈与队列基本操作 Java实现
- C++常用数据类型和Windows常见数据类型
- python 高阶函数 lamdad reduce map
- 从入门到自闭之Python--MySQL数据库的操作命令
- dos2unix、diff命令
- tensorflow零起点快速入门(3)
- JSONObject 的使用
- 怎样使用 v-on 指令?
- Eclipse连接数据库报错Local variable passwd defined in an enclosing scope must be final or effectively final
- Bootstrap3基础教程 02 网格布局