Hi Jean-Noel, welcome to the Tamaya mailing list. You can easily subscribe by just send an email to mailto:[email protected] <[email protected]>
Normally you would avoid a direct dependency to the *DefaultXXX* implementation class. You can get a context builder from the provider singleton: ConfigurationContextBuiler builder = ConfigurationProvider.getConfigurationContextBuilder(); A new context builder is, by design, completely empty, thus also not containing any converters. This is to give full control to the users on how a possible context should be looking. You can add all the default converters to an empty builder by calling builder.addDefaultConverters(); Similar methods are also there for property sources and filters. NOTE: If you create a builder instance from an existing context, e.g. using ConfigurationContext@toBuilder() the builder is preinitialized with all corresponding filters, converters and property sources. Looking forward to your property source! J Anatole 2017-10-18 7:39 GMT+02:00 Jean-Noel Charpin <[email protected]>: > Hi tamaya team, > > I would like to subscribe to your dev. list. I got interested in the > project last year by attending Anatole's presentation at java one. > > I'm currently working on a JDBC property source, to store / update in a the > table a configuration. > > Either from an injected Data source or through a lookup or even raw > connection (my project is not making use of JPA). > > What I observed since I need to create my own context to have this property > source considered is that I then miss the default property converters. > e.g. the second test below is failing. > > Do I need to reference all default converters when using a context builder > ? > Could you let me know what is the suggested approach, appologize if I miss > something in your documentation ? > > Thanks and regards, > Jean-Noel > > @Test > public void testDefaultTamayaConfiguration() { > > Configuration config = ConfigurationProvider.getConfiguration(); > assertNotNull(config); > > assertEquals("1.8", config.get("java.specification.version")); > assertEquals(Double.valueOf(1.8), > config.get("java.specification.version", double.class)); > > } > > @Test > public void testCustomTamayaConfiguration() { > > ConfigurationContextBuilder configBuilder = new > DefaultConfigurationContextBuilder(); > configBuilder.addPropertySources(new SystemPropertySource()); > ConfigurationContext context = configBuilder.build(); > Configuration config = > ConfigurationProvider.createConfiguration(context); > assertNotNull(config); > > assertEquals("1.8", config.get("java.specification.version")); > assertEquals(Double.valueOf(1.8), > config.get("java.specification.version", double.class)); > > } > -- *Anatole Tresch* PPMC Member Apache Tamaya JCP Star Spec Lead *Switzerland, Europe Zurich, GMT+1* *maketechsimple.wordpress.com <http://maketechsimple.wordpress.com/> * *Twitter: @atsticks, @tamayaconf* *Speaking at:* [image: JSD_Speaker_2017][image: J-Con 2017 logo][image: JVM Con]
