Hi Parin-

This is a WIP.

The **new** Annotation configuration model is based on work I started
in *Spring
Data GemFire* for Pivotal GemFire (*Ingalls, *1.9 M1
<https://github.com/spring-projects/spring-data-commons/wiki/Release-Train-Ingalls#spring-data-gemfire---19>
[1]
to be exact; see SGF-492 <https://jira.spring.io/browse/SGF-492> [2]).  I
will have an answer for this in *Spring Data GemFire* 1.9 GA along with *Spring
Data Geode* 1.1.0.RELEASE.

NOTE: *Ingalls* RC1 (i.e. SDG 1.9 RC1) is due *November 28th*, and *Ingalls*
GA (i.e. SDG 1.9 GA) is due on *December 12th*, as outlined on the SD *Ingalls
Release Train* Wiki page
<https://github.com/spring-projects/spring-data-commons/wiki/Release-Train-Ingalls>
 [3].

The main reason this has been delayed is that I am trying to decide on the
right approach to handle this properly and elegantly.

The obvious answer is that I could just support property placeholders
<http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-factory-placeholderconfigurer>
[4]
(${property:defaultValue}) and/or SpEL Expressions
<http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#expressions>
[5]
(#{expression}) in the Annotation attributes.  However, that would require
all Annotation attribute values to be loosely typed, as Strings, thus
giving up type-safety.  Additionally, this would increase the required
validation logic making maintenance more difficult.

NOTE: Annotation attributes cannot be typed as Object, thus allowing both
strongly typed values (e.g. Integers) as well as Strings, since Object is a
non-constant type. In addition Object is no better than String where type
safety is concerned.

Allowing property placeholders and/or SpEL Expressions as values in SDG
Annotation attributes is also inconsistent with how other, similar *Spring
Boot* Annotations are handled and work.

My current thinking is to introduce multiple *Configurer* bean types that
developers could declare in their Java config to "dynamically" configure
different aspects of the GemFire Server.  For instance...

@Bean
JmxManagerConfigurer jmxManagerConfigurer(@Value("${jmx-manager-port:1099}")
int port) {
  return new JmxManagerConfigurer().setPort(port);
}

Something of this nature.  The *Configurers* would use the Builder Design
Pattern.  The Java config, @Bean definition methods would allow either
property placeholders or SpEL expressions using the *Spring* @Value
annotation on method parameters (this is standard *Spring* Java config).
The other advantage here is that the @Bean definition Java config factory
methods could be annotated with @Profile to only be applied when certain
*Spring* Profiles are enabled.

Anyway, just thinking out loud here, but I need to weigh the options
carefully.  I will have an answer soon.

Thanks,
John


[1] https://github.com/spring-projects/spring-data-commons/
wiki/Release-Train-Ingalls#spring-data-gemfire---19
[2] https://jira.spring.io/browse/SGF-492
[3] https://github.com/spring-projects/spring-data-commons/
wiki/Release-Train-Ingalls
[4] http://docs.spring.io/spring/docs/current/spring-framework-reference/
htmlsingle/#beans-factory-placeholderconfigurer
[5] http://docs.spring.io/spring/docs/current/spring-framework-reference/
htmlsingle/#expressions


On Fri, Nov 18, 2016 at 11:28 AM, Parin dazz <[email protected]> wrote:

> Hi Team,
>
> I was referring to following example to quick start with geode.
>
> https://github.com/jxblum/actionable-spring-gemfire/blob/
> master/configuration-example/src/main/java/example/app/
> spring/data/geode/server/DataGeodeServerApplication.java
>
> With this approach, I see that values are available at compile time. If I
> want to make this values dynamic using annotations, how we can do that in
> spring boot application?
>
> I want to have multiple server nodes for which I want to use my same
> spring boot application to spawn multiple jvms. If I want to run 2 nodes on
> same machine, static values as per above annotations will conflict.
>
> Is there any good way to achieve this?
>
> Example : java -jar springbootapp.jar -DServerName=ServerA
> -DServerPort=40405 -DJmxManagerPort=1201
>
> Thanks,
> Parin
>



-- 
-John
503-504-8657
john.blum10101 (skype)

Reply via email to