【发布时间】:2013-03-31 11:21:43
【问题描述】:
我使用 XML 尝试了 Spring Social Showcase,但它似乎在 XML 中有错误。
XML 文件不工作。我已经阅读了第 23 到 27 行的 x 标记。
<facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" app-namespace="socialshowcase" />
<twitter:config app-id="${twitter.consumerKey}" app-secret="${twitter.consumerSecret}"/>
<linkedin:config app-id="${linkedin.consumerKey}" app-secret="${linkedin.consumerSecret}"/>
<social:jdbc-connection-repository/>
我尝试检查架构 (http://www.springframework.org/schema/social/) 并将其粘贴到 URL 中,但它说它找不到。 我试图检查 springframework.org/schema/ 的根目录,但找不到与 Spring Social 相关的孩子。
春季社交的 xmnls 或架构位置是否有新链接?
这是我的 XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:facebook="http://www.springframework.org/schema/social/facebook"
xmlns:twitter="http://www.springframework.org/schema/social/twitter"
xmlns:social="http://www.springframework.org/schema/social"
xmlns:linkedin="http://www.springframework.org/schema/social/linkedin"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd
http://www.springframework.org/schema/social/linkedin http://www.springframework.org/schema/social/spring-social-linkedin.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/social/twitter http://www.springframework.org/schema/social/spring-social-twitter.xsd
http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder location="classpath:/org/springframework/social/showcase/config/application.properties" />
<facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" app-namespace="socialshowcase" />
<twitter:config app-id="${twitter.consumerKey}" app-secret="${twitter.consumerSecret}"/>
<linkedin:config app-id="${linkedin.consumerKey}" app-secret="${linkedin.consumerSecret}"/>
<social:jdbc-connection-repository/>
<bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" />
<bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor">
<property name="connectInterceptors">
<list>
<bean class="org.springframework.social.showcase.facebook.PostToWallAfterConnectInterceptor" />
<bean class="org.springframework.social.showcase.twitter.TweetAfterConnectInterceptor" />
</list>
</property>
</bean>
<bean id="psc" class="org.springframework.social.connect.web.ProviderSignInController" autowire="constructor" />
<bean id="signInAdapter" class="org.springframework.social.showcase.signin.SimpleSignInAdapter" autowire="constructor" />
<bean id="disconnectController" class="org.springframework.social.facebook.web.DisconnectController"
c:_0-ref="usersConnectionRepository" c:_1="${facebook.clientSecret}" />
</beans>
【问题讨论】:
-
你用的是什么版本的 Spring Social?
-
我使用的是 Spring Social 1.1.0 版本。我需要降级还是什么?
-
你的意思是1.1.0.M1吗?还是 1.1.0.M2?试试最新的。检查 jar 中是否存在相应的 xsd 文件。如果它不适合您,那么您可以尝试快照构建,如this 示例中所示。如果您构建一些用于生产的应用程序,那么最好降级到 1.0.2.RELEASE(没有 xml 命名空间支持,但我现在看不到有什么大的优势)
-
尝试了您所说的一切(例如更改为最新的或尝试那些构建),但仍然无法删除 XML 中那些行中的红色 X。但奇怪的是,当我尝试运行它时,控制台并没有产生这样的错误。该应用程序实际上运行良好,但有一个红色 X。怎么会?
-
尝试在您的 IDE 中强制更新验证结果。在 Eclipse 的情况下,尝试 Project -> Clean...-> Clean all projects。
标签: xml spring config spring-social