views:

13

answers:

1

I don't understand why my properties are not injected in my perso-servlet.xml :

<!--  Facebook OAuth helper -->
<bean id="FacebookOAuthHelper" class="com.myapp.businessservices.common.facebook.FacebookOAuthHelper"
    p:apiKey="${facebook.apiKey}"
    p:secretkey="${facebook.secretkey}"
    p:clientId="${facebook.clientId}"
    p:permissions="${facebook.permissions}"
    p:serverIPRedirectURI="${facebook.serverIPRedirectURI}"
    p:applicationRedirectURI="${facebook.applicationRedirectURI}"
    p:authFilterURI="${facebook.authFilterURI}"/>

My settings.xml (Maven 2) :

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                    http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;  
<profiles>
    <profile>
        <activation>
            <!-- This must be set to true to tell maven that we want to use this profile (by default). -->
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <!-- Enable the debug mode (for both Flex and Java modules)-->
            <debug>true</debug>

            <!-- Facebook plateform parameters -->

            <!-- General Sharehunter application parameters -->
            <facebook.apikey>xxxx</facebook.apikey>
            <facebook.secretkey>yyyyyy</facebook.secretkey>
            <facebook.clientId>zzzzz</facebook.clientId>

In fact, when I read (in debug mode) these properties in my FacebookOAuthHelper bean, the values read are :

${facebook.apiKey} => for apiKey property,
${facebook.secretkey}  => for secretkey property,
etc ...

The Tomcat deployement is ok.

Could you help me ?

+1  A: 

Maven doesn't really "inject" properties (as the initial tagging was suggesting), Maven filters resources while copying them to the build directory and replace token with values during this process.

Unfortunately, you're not showing anything allowing to understand how filtering is setup in your project and why things works under Tomcat (does them?) and not "in debug mode".

You need to tell us a bit more, to explain what the above means, what you're doing exactly, and to show the relevant bits of your pom.xml.

Pascal Thivent