You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Mark Struberg (Jira)" <ji...@apache.org> on 2022/04/06 15:27:00 UTC

[jira] [Closed] (DELTASPIKE-1084) Integrate configuration sources expressed as URLs.

     [ https://issues.apache.org/jira/browse/DELTASPIKE-1084?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg closed DELTASPIKE-1084.
-------------------------------------
    Resolution: Won't Fix

closing due to no patch since a long time

> Integrate configuration sources expressed as URLs.
> --------------------------------------------------
>
>                 Key: DELTASPIKE-1084
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1084
>             Project: DeltaSpike
>          Issue Type: Improvement
>          Components: Configuration
>            Reporter: Pablo Pita Leira
>            Assignee: Mark Struberg
>            Priority: Minor
>
> The PropertyFileUtils class can load the properties file as follows :
> {code}
>         String root = System.getProperty("user.dir");
>     	String path = root + "/src/test/resources/myurlconfig.properties";
>         String urlPath = "file:/" + path;
>     	URL propertyFileUrl = new URL(urlPath);
> 	Poperties p = PropertyFileUtils.loadProperties(propertyFileUrl);
> {code}
> Using the following code to incorporate the properties does not work:
> {code}
> public class MyUrlCustomPropertyFileConfig implements PropertyFileConfig
> {
> 	
>     @Override
>     public String getPropertyFileName()
>     {
>     	String root = System.getProperty("user.dir");
>     	String path = root + "/src/test/resources/myurlconfig.properties";
>         return "file:/" + path;
>     }
>     @Override
>     public boolean isOptional()
>     {
>         return false;
>     }
> }
> {code}
> I get an exception as follows:
> {code}
> java.lang.IllegalStateException: com.example.MyUrlCustomPropertyFileConfig points to an invalid file: 'file:/D:\Dev\GIT\example-test/src/test/resources/myurlconfig.properties'
> 	at org.apache.deltaspike.core.impl.config.ConfigurationExtension.createPropertyConfigSource(ConfigurationExtension.java:210)
> 	at org.apache.deltaspike.core.impl.config.ConfigurationExtension.registerUserConfigSources(ConfigurationExtension.java:135)
> 	at org.apache.deltaspike.core.impl.config.ConfigurationExtension$Proxy$_$$_WeldClientProxy.registerUserConfigSources(ConfigurationExtension$Proxy$_$$_WeldClientProxy.java)
> {code}
> By looking into the test code in DeltaSpike I do not see any usage of the URL mechanism as a property configuration source. This should be improved.
> There should be a way to integrate easily configuration sources expressed as URLs. As user, I would like that the way to integrate URL paths as configuration sources is also documented (including those starting with file:/).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)