deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Struberg (JIRA)" <>
Subject [jira] [Commented] (DELTASPIKE-215) Add a new annotation to override the location of the file
Date Wed, 04 Jul 2012 08:28:34 GMT


Mark Struberg commented on DELTASPIKE-215:

Folks, we have 2 ways to do the trick:

In both cases we need to extract the property files pickup logic from the DefaultConfigSourceProvider
to an own EnvironmentPropertyConfigSourceProvider class which takes the name of the properties
files as ct param.
Please see the attached file.

The options we have beyond this is to 

A.) move all the needed classes to core-api spi package:
EnvironmentPropertyConfigSourceProvider + BaseConfigSource + EnvironmentPropertyConfigSource

A user could then simply write something like 

MyPropertyConfig extends EnvironmentPropertyConfigSourceProvider {
  MyPropertyConfig() {

and register it via META-INF/services.

 * that would be quite some impl details in the public spi.
 * the user would still need to write the service provider file in META-INF/services

 * that would also work for configuring Extensions!
 * BaseConfigSource is nice to have in the spi anyway, as this shows pretty well how the ordinal
stuff could be done.

B.) The second option is easier for users. We would introduce a new interface:

public interface PropertyConfigSource
    String getPropertyFileName();

which a user can implement. We would @Observes ProcessAnnotatedType<PropertyConfigSource>
and call the EnvironmentPropertyConfigSourceProvider for each of them. 

 * only works for runtime stuff, not usable in CDI extensions
 * in the AfterBeanValidation phase we would need to add those additional ConfigSources and
clean the config. This means that after the boot the config might change. This is misconfiguration
and we might be able to detect it, but this means that we need to code more to make it fools-safe.

 * easier for users
 * much less stuff in the spi
> Add a new annotation to override the location of the file
> --------------------------------------------------------------------------------------
>                 Key: DELTASPIKE-215
>                 URL:
>             Project: DeltaSpike
>          Issue Type: New Feature
>            Reporter: Charles Moulliard
>         Attachments: DELTASPIKE-215-interface.patch
> I don't see a property (or annotation) that we can use to override the name to be used
to load the properties file (META-INF/ and its location like
we can do with Spring (@ContextConfiguration(locations = { "classpath:mycontext.xml" })).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message