To force config before the component, you need prerequisite=true.

Can you try:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"; 
name="oldalbum.roleadder.test">
    <feature name="${karaf-feature-name}-config">
        <config 
name="no.priv.bang.oldalbum.roleadder.test.ShiroRoleAdderForOldalbumTestEnvironment">
            username=${env:USERNAME:-admin}
            password=${env:PASSWORD:-admin}
            allowModify=${env:ALLOW_MODIFY:-true}
        </config>
    </feature>
    <feature name="${karaf-feature-name}">
        <feature prerequisite="true">${karaf-feature-name}-config</feature>
        <feature>scr</feature>
    </feature>
</features>

?

Regards
JB

> Le 20 sept. 2020 à 22:30, Steinar Bang <[email protected]> a écrit :
> 
>>>>>> Jean-Baptiste Onofré <[email protected]>:
> 
>> You can isolate the config in a dedicated feature and define this
>> feature as prerequisite of the feature containing the scr bundle.
> 
> Thanks! Unfortunately I can't get it to work.
> 
> I first tried putting it in a separate feature in the same feature
> repository as the component, ie. like so:
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"; 
> name="oldalbum.roleadder.test">
>     <feature name="${karaf-feature-name}-config">
>         <config 
> name="no.priv.bang.oldalbum.roleadder.test.ShiroRoleAdderForOldalbumTestEnvironment">
>             username=${env:USERNAME:-admin}
>             password=${env:PASSWORD:-admin}
>             allowModify=${env:ALLOW_MODIFY:-true}
>         </config>
>     </feature>
>     <feature name="${karaf-feature-name}">
>         <feature>${karaf-feature-name}-config</feature>
>         <feature>scr</feature>
>     </feature>
> </features>
> 
> But the first @Activate config method injection was still empty, except
> for the component.name and the component.id.
> 
> Is the feature repository significant?
> 
> Ie. should the feature reside in a separate feature repository?
> 
> Do the feature need to be alone in that feature repository?  Or can it
> share the repository with an existing feature? (i.e. can I put it into
> the feature repository of an existing bundle maven project or do I have
> to create a new project just for this feature?)
> 
> Thanks!
> 

Reply via email to