Tag: configuration

在clojure中加载configuration文件作为数据结构

clojure中是否有读取函数来parsingclojure数据结构? 我的用例是读取configuration属性文件,一个属性的值应该是一个列表。 我想能够写这个: file.properties: property1 = ["value1" "value2"] 并在clojure: (load-props "file.properties") 并获取值为{property1,[“value1”“value2”]的地图 现在,我正在做下面的,具有相同的input文件“file.properties”: (defn load-props [filename] (let [io (java.io.FileInputStream. filename) prop (java.util.Properties.)] (.load prop io) (into {} prop))) ;; returns: ;; {"property1" "[\"valu1\", \"valu2\"]"} (load-props "file.properties") 但是我无法将结果parsing为clojure的向量。 我基本上在寻找Erlang的文件:consult / 1函数。 任何想法如何做到这一点?

读取C#中的自定义configuration文件(Framework 4.0)

我正在C#框架下开发一个应用程序4.0。 在我的应用程序中,我想创build不是app.config文件的单独的configuration文件。 configuration文件包含我们为产品开发的自定义configuration部分。 我不想从app.config使用configSource引用这个文件。 我想在运行时加载它并阅读它的内容。 我的意思就是log4net的一个例子,它允许你在log4net.config文件中写configuration。 任何人都可以帮助如何做到这一点,而无需编写代码来模拟框架中存在的代码? 更新: 基于Kaido的回答,我写了一个工具类,它读取自定义的configuration文件,并且能够在文件系统上的文件改变时刷新configuration内容。 这个类的用法如下: 获取configuration文件内容 // Create configuration reader that reads the files once var configFileReader = new CustomConfigurationFileReader("c:\\myconfig.config"); var config = configFileReader.Config; // Do any action you want with the config object like: config.GetSection("my.custom.section"); // or, var someVal = config.AppSettings.Settings["someKey"]; configuration文件更改时收到通知 // Create configuration reader that notifies when […]

根据.properties文件中的属性导入Springconfiguration文件

在我的Spring xmlconfiguration中,我试图让这样的工作: <beans> <import resource="${file.to.import}" /> <!– Other bean definitions –> </beans> 我想根据属性文件中的属性来决定要导入哪个文件。 我知道我可以使用System属性,但是我无法在启动时将属性添加到JVM。 注意:PropertyPlaceHolderConfigurer将不起作用。 在任何BeanFactoryPostProcessors运行之前,导入都被parsing。 导入元素只能parsingSystem.properties。 有没有人有一个简单的解决scheme呢? 我不想开始子类化框架类等… 谢谢

什么是承诺处理器模式?

我已经读了几个地方的承诺处理器模式,但我不知道它是什么。 有人build议我在代码中使用它,如下所示: function getDb(){ return myDbDriver.getConnection(); } var users = getDb().then(function(conn){ return conn.query("SELECT name FROM users").finally(function(users){ conn.release(); }); }); 什么是承诺处理器模式,它在这里如何适用? 注意 – 在本地的承诺中,我.finally “添加拒绝和履行处理程序,返回价值,但执行一个行动”。 在这种情况下,我正在使用蓝鸟。

我如何在Vim中进行shift +空格键翻页?

我在我的.vimrc中有一个条目,当我点击空格键时,它使页面向下翻页。 它看起来像这样: map <Space> <PageDown> 我想创build另一个按键映射,当按住shift键并按空格键时,将视口向上翻页。 我已经尝试了以下条目: map <Shift><Space> <PageUp> map <S-Space> <PageUp> 既没有工作。 任何人都知道如何实现这个function?

如何在单个项目中使用具有logback的多个configuration?

logback的configuration文件可以在类path中find,因此是Eclipse-project-specific,这不是我想要的。 我使用多个Java实用程序,所有这些实用程序驻留在一个单独的项目(这共享类path),我需要使用一些特定的configuration。 我试过variables替代和Joramconfiguration器,但没有为我工作。 这很可能是我的错,有一天我会解决它,但现在我需要一个简单的解决scheme。

春季启动:是否有可能使用外部application.properties文件在任何目录与胖胖的jar?

是否有可能有多个application.properties文件? ( 编辑 :请注意,这个问题演变为标题上的问题。) 我试图有2个文件。 第一个是应用程序Jar中的根文件夹。 第二个是在classpath中指定的目录。 2个文件都被命名为“application.properties”。 是否有可能“合并”这两个文件的内容? (和第二个的属性值覆盖第一个)或者,如果我有一个文件,那么其他文件被忽略? 更新1 :可以“合并”内容。 昨天好像第一个被忽略了,但是好像是因为那个东西被打破了。 现在它运作良好。 更新2 :它又回来了! 同样,只有两个文件中的一个正在被应用。 这很奇怪…它是在我使用Spring Tool Suite创build应用程序jar文件之后开始的。 而且Jar版本似乎总是忽略第二个(在classpath中),而在STS上运行的扩展版本的行为却不尽相同。 从哪里可以开始调查? 更新3 : Jar版本的行为其实是正确的。 这是java.exe的规范。 当指定-jar选项时,java.exe忽略-classpath选项和CLASSPATH环境variables,而类path将仅包含jar文件。 因此,classpath上的第二个application.properties文件将被忽略。 现在,我该如何让classpath上的第二个application.properties被加载? 更新4 : 我设法加载一个application.properties文件在外部path中使用-jar选项。 关键是PropertiesLauncher。 要使用PropertiesLauncher,必须像这样更改pom.xml文件: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!– added –> <layout>ZIP</layout> <!– to use PropertiesLaunchar –> </configuration> </plugin> </plugins> </build> 为此,我引用了下面的StackOverflow问题: spring启动属性启动器无法使用 […]

Eclipsetypes的层次结构…与@Configurable注释不一致

我正在开发一个Spring / Vaadin / Hibernate应用程序。 一切正常,但我仍然在Eclipse STS 2.8.1中有以下错误标记: The hierarchy of the type BankView is inconsistent The hierarchy of the type AbstractEntityView is inconsistent 我的观点如下: public class BankView extends AbstractEntityView { @Resource private BankService bankService; public void buildLayout() { super.buildLayout(); // Use of the service here } } public abstract class AbstractEntityView extends AbstractView { […]

你如何dynamic地重新加载鱼configuration文件,就像你在bash中?

我正在寻找相当于Fish的source .bashrc 。

不能使用前导../来退出顶层目录

我有一个asp.net的网站,我们有pipe理员只有pipe理员的login页面的所有网站是允许所有 – 我需要问如何定义正确的安全configuration,因为我得到这个错误 不能使用前导..从顶端目录之上退出。 说明:执行当前Web请求期间发生未处理的exception。 请查看堆栈跟踪,了解有关错误的更多信息以及源代码的位置。 exception详细信息:System.Web.HttpException:不能使用前导..以退出顶部目录。 源错误: 在执行当前Web请求期间生成未处理的exception。 有关exception的来源和位置的信息可以使用下面的exception堆栈跟踪来标识。 堆栈跟踪: [HttpException(0x80004005):不能使用前导..以退出顶部目录。] System.Web.Util.UrlPath.ReduceVirtualPath(String path)+8862087 System.Web.Util.UrlPath.Reduce(String path)+52 System.Web.Util.UrlPath.Combine(stringappPath,stringbasepath,string相对)+214 System.Web.UI.Control.ResolveClientUrl(String relativeUrl)+180 System.Web.UI.WebControls.Image.AddAttributesToRender(HtmlTextWriter作家)+68 System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter作家)+20 System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter作家)+20 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter作家,ControlAdapter适配器)+27 System.Web.UI.Control.RenderControl(HtmlTextWriter作家,ControlAdapter适配器)+99 System.Web.UI.Control.RenderControl(HtmlTextWriter作家)+25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter作家,ICollection的孩子)+134 System.Web.UI.Control.RenderChildren(HtmlTextWriter作家)+19 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter作家)+163 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter作家)+32 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter输出)+51 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter作家,ControlAdapter适配器)+27 System.Web.UI.Control.RenderControl(HtmlTextWriter作家,ControlAdapter适配器)+99 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter作家)+40 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter作家,ICollection的孩子)+134 System.Web.UI.Control.RenderChildren(HtmlTextWriter作家)+19 System.Web.UI.Control.Render(HtmlTextWriter作家)+10 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter作家,ControlAdapter适配器)+27 System.Web.UI.Control.RenderControl(HtmlTextWriter作家,ControlAdapter适配器)+99 System.Web.UI.Control.RenderControl(HtmlTextWriter作家)+25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter作家,ICollection的孩子)+134 System.Web.UI.Control.RenderChildren(HtmlTextWriter作家)+19 System.Web.UI.Page.Render(HtmlTextWriter作家)+29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter作家,ControlAdapter适配器)+27 System.Web.UI.Control.RenderControl(HtmlTextWriter作家,ControlAdapter适配器)+99 System.Web.UI.Control.RenderControl(HtmlTextWriter作家)+25 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+1266 我的configuration文件: <authentication mode="Forms"> <forms name=".ASPXFORMSAUTH" protection="All" loginUrl="Admin/LoginPage.aspx" path="/" enableCrossAppRedirects="true"> […]