[jira] [Resolved] (DELTASPIKE-1445) Dynamic Config injection via a Supplier

2021-12-08 Thread Mark Struberg (Jira)


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

Mark Struberg resolved DELTASPIKE-1445.
---
Resolution: Fixed

> Dynamic Config injection via a Supplier
> --
>
> Key: DELTASPIKE-1445
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1445
> Project: DeltaSpike
>  Issue Type: New Feature
>  Security Level: public(Regular issues) 
>  Components: Configuration
>Affects Versions: 1.9.5
>Reporter: Mark Struberg
>Assignee: Mark Struberg
>Priority: Major
> Fix For: 1.9.6
>
>
> We should support injecting Configuration via {{Supplier}}.
> That way we can {{get()}} to access the current value. 
> The code to use the feature might look like:
> {code}
> @Inject
> @ConfigProperty(name = "address.header.line", cacheFor = 10, cacheUnit = 
> TimeUnit.MINUTES)
> private Supplier addressHeaderLine;
> {code}



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


[jira] [Resolved] (DELTASPIKE-1444) Create POJO and Record based Config

2021-12-08 Thread Mark Struberg (Jira)


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

Mark Struberg resolved DELTASPIKE-1444.
---
Resolution: Fixed

> Create POJO and Record based Config
> ---
>
> Key: DELTASPIKE-1444
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1444
> Project: DeltaSpike
>  Issue Type: New Feature
>  Security Level: public(Regular issues) 
>  Components: Configuration
>Affects Versions: 1.9.5
>Reporter: Mark Struberg
>Assignee: Mark Struberg
>Priority: Major
> Fix For: 1.9.6
>
>
> Right now we only support Interface based configuration with the 
> {{@Configuration}} annotation. We could also support injecting POJOs directly 
> and even Java14 Records.
> E.g. a class 
> {code}
> public record Endpoint(String host, Integer port, String path){}
> {code}
> or with a parameter ct:
> {code}
> public class Endpoint {
>  private final String host;
>  ... 
> public Endpoint(
> @ConfigProperty(name="host") String host, 
> @ConfigProperty(name="port") Integer port, 
> @ConfigProperty(name="path") String path){
> this.host = host;
> 
> }
> }
> {code}
> Note that the {{@ConfigProperty}} annotation might get omitted if the class 
> gets compiled with the {{javac -parameters}} option.
> or with a default ct and field parameters:
> {code}
> public class Endpoint {
>  private String host;
>  private Integer port;
>  private String path;
>  ... 
> }
> {code}
> Resolving of all the required properties must be performed atomically.
> The solution might either be done via the built-in algorithms as shown above, 
> in which case the following call might be used to denote that a bean should 
> get resolved which consists of mulitple attributes:
> {code}
> ServerEndpointPojoWithCt someServer = 
> ConfigResolver.resolve("myapp.some.server")
> .asBean(ServerEndpointPojoWithCt.class)
> .getValue();
> {code} 
> or via an explicit Converter function:
> {code}
> final ServerEndpointPojoWithCt someServer = 
> ConfigResolver.resolve("myapp.some.server")
> .asBean(ServerEndpointPojoWithCt.class, (cfg, key) -> new 
> ServerEndpointPojoWithCt(
> cfg.resolve(key + ".host").getValue(),
> cfg.resolve(key + ".port").as(Integer.class).getValue(),
> cfg.resolve(key + ".path").getValue());)
> .getValue();
> {code}



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


[jira] [Commented] (DELTASPIKE-1444) Create POJO and Record based Config

2021-12-08 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/DELTASPIKE-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456019#comment-17456019
 ] 

ASF subversion and git services commented on DELTASPIKE-1444:
-

Commit 422a78a3c1c25b8040fa4516dfa080da0baa7ed8 in deltaspike's branch 
refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=deltaspike.git;h=422a78a ]

DELTASPIKE-1444 make BeanConverter a non-static factory

otherwise we might create mem leaks, as rightfully noted by rmannibucau


> Create POJO and Record based Config
> ---
>
> Key: DELTASPIKE-1444
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1444
> Project: DeltaSpike
>  Issue Type: New Feature
>  Security Level: public(Regular issues) 
>  Components: Configuration
>Affects Versions: 1.9.5
>Reporter: Mark Struberg
>Assignee: Mark Struberg
>Priority: Major
> Fix For: 1.9.6
>
>
> Right now we only support Interface based configuration with the 
> {{@Configuration}} annotation. We could also support injecting POJOs directly 
> and even Java14 Records.
> E.g. a class 
> {code}
> public record Endpoint(String host, Integer port, String path){}
> {code}
> or with a parameter ct:
> {code}
> public class Endpoint {
>  private final String host;
>  ... 
> public Endpoint(
> @ConfigProperty(name="host") String host, 
> @ConfigProperty(name="port") Integer port, 
> @ConfigProperty(name="path") String path){
> this.host = host;
> 
> }
> }
> {code}
> Note that the {{@ConfigProperty}} annotation might get omitted if the class 
> gets compiled with the {{javac -parameters}} option.
> or with a default ct and field parameters:
> {code}
> public class Endpoint {
>  private String host;
>  private Integer port;
>  private String path;
>  ... 
> }
> {code}
> Resolving of all the required properties must be performed atomically.
> The solution might either be done via the built-in algorithms as shown above, 
> in which case the following call might be used to denote that a bean should 
> get resolved which consists of mulitple attributes:
> {code}
> ServerEndpointPojoWithCt someServer = 
> ConfigResolver.resolve("myapp.some.server")
> .asBean(ServerEndpointPojoWithCt.class)
> .getValue();
> {code} 
> or via an explicit Converter function:
> {code}
> final ServerEndpointPojoWithCt someServer = 
> ConfigResolver.resolve("myapp.some.server")
> .asBean(ServerEndpointPojoWithCt.class, (cfg, key) -> new 
> ServerEndpointPojoWithCt(
> cfg.resolve(key + ".host").getValue(),
> cfg.resolve(key + ".port").as(Integer.class).getValue(),
> cfg.resolve(key + ".path").getValue());)
> .getValue();
> {code}



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


[jira] [Commented] (DELTASPIKE-1444) Create POJO and Record based Config

2021-12-08 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/DELTASPIKE-1444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456018#comment-17456018
 ] 

ASF subversion and git services commented on DELTASPIKE-1444:
-

Commit facacde41ded50f3f98499354680356283fb3a99 in deltaspike's branch 
refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=deltaspike.git;h=facacde ]

DELTASPIKE-1444 add POJO based Config


> Create POJO and Record based Config
> ---
>
> Key: DELTASPIKE-1444
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1444
> Project: DeltaSpike
>  Issue Type: New Feature
>  Security Level: public(Regular issues) 
>  Components: Configuration
>Affects Versions: 1.9.5
>Reporter: Mark Struberg
>Assignee: Mark Struberg
>Priority: Major
> Fix For: 1.9.6
>
>
> Right now we only support Interface based configuration with the 
> {{@Configuration}} annotation. We could also support injecting POJOs directly 
> and even Java14 Records.
> E.g. a class 
> {code}
> public record Endpoint(String host, Integer port, String path){}
> {code}
> or with a parameter ct:
> {code}
> public class Endpoint {
>  private final String host;
>  ... 
> public Endpoint(
> @ConfigProperty(name="host") String host, 
> @ConfigProperty(name="port") Integer port, 
> @ConfigProperty(name="path") String path){
> this.host = host;
> 
> }
> }
> {code}
> Note that the {{@ConfigProperty}} annotation might get omitted if the class 
> gets compiled with the {{javac -parameters}} option.
> or with a default ct and field parameters:
> {code}
> public class Endpoint {
>  private String host;
>  private Integer port;
>  private String path;
>  ... 
> }
> {code}
> Resolving of all the required properties must be performed atomically.
> The solution might either be done via the built-in algorithms as shown above, 
> in which case the following call might be used to denote that a bean should 
> get resolved which consists of mulitple attributes:
> {code}
> ServerEndpointPojoWithCt someServer = 
> ConfigResolver.resolve("myapp.some.server")
> .asBean(ServerEndpointPojoWithCt.class)
> .getValue();
> {code} 
> or via an explicit Converter function:
> {code}
> final ServerEndpointPojoWithCt someServer = 
> ConfigResolver.resolve("myapp.some.server")
> .asBean(ServerEndpointPojoWithCt.class, (cfg, key) -> new 
> ServerEndpointPojoWithCt(
> cfg.resolve(key + ".host").getValue(),
> cfg.resolve(key + ".port").as(Integer.class).getValue(),
> cfg.resolve(key + ".path").getValue());)
> .getValue();
> {code}



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


[jira] [Commented] (DELTASPIKE-1445) Dynamic Config injection via a Supplier

2021-12-08 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/DELTASPIKE-1445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456020#comment-17456020
 ] 

ASF subversion and git services commented on DELTASPIKE-1445:
-

Commit 941e3717c18196dc7bcee1de8dcaac86e6f874c4 in deltaspike's branch 
refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=deltaspike.git;h=941e371 ]

DELTASPIKE-1445 implement Supplier support


> Dynamic Config injection via a Supplier
> --
>
> Key: DELTASPIKE-1445
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1445
> Project: DeltaSpike
>  Issue Type: New Feature
>  Security Level: public(Regular issues) 
>  Components: Configuration
>Affects Versions: 1.9.5
>Reporter: Mark Struberg
>Assignee: Mark Struberg
>Priority: Major
> Fix For: 1.9.6
>
>
> We should support injecting Configuration via {{Supplier}}.
> That way we can {{get()}} to access the current value. 
> The code to use the feature might look like:
> {code}
> @Inject
> @ConfigProperty(name = "address.header.line", cacheFor = 10, cacheUnit = 
> TimeUnit.MINUTES)
> private Supplier addressHeaderLine;
> {code}



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


[jira] [Created] (DELTASPIKE-1445) Dynamic Config injection via a Supplier

2021-12-08 Thread Mark Struberg (Jira)
Mark Struberg created DELTASPIKE-1445:
-

 Summary: Dynamic Config injection via a Supplier
 Key: DELTASPIKE-1445
 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1445
 Project: DeltaSpike
  Issue Type: New Feature
  Security Level: public (Regular issues)
  Components: Configuration
Affects Versions: 1.9.5
Reporter: Mark Struberg
Assignee: Mark Struberg
 Fix For: 1.9.6


We should support injecting Configuration via {{Supplier}}.
That way we can {{get()}} to access the current value. 

The code to use the feature might look like:
{code}
@Inject
@ConfigProperty(name = "address.header.line", cacheFor = 10, cacheUnit = 
TimeUnit.MINUTES)
private Supplier addressHeaderLine;
{code}




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