我的属性未注入到我的 person-servlet.xml (Maven2) 中

发布于 2024-09-17 21:45:52 字数 1850 浏览 2 评论 0原文

我不明白为什么我的属性没有注入到我的 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}"/>

我的 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">  
<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>

事实上,当我在我的 FacebookOAuthHelper bean,读取的值是:

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

Tomcat部署正常。

你能帮我吗?

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">  
<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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铃予 2024-09-24 21:45:52

Maven 并不真正“注入”属性(正如初始标记所建议的那样),Maven 会过滤资源,同时将资源复制到构建目录,并在此过程中用值替换令牌。

不幸的是,您没有展示任何内容来了解​​如何在项目中设置过滤以及为什么事情在 Tomcat 下工作(是吗?)而不是“在调试模式下”。

您需要告诉我们更多信息,解释上述含义、您到底在做什么,并显示 pom.xml 的相关部分。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文