简体   繁体   中英

xml spring social xmlns:facebook

I want to build a login with spring social, and I have implemented a *xml whit the next configuration, but the url http://www.springframework.org/schema/social/facebook is wrong?

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


    <context:property-placeholder location="classpath:/itrippingWeb/src/main/resources/application.properties" />

    <facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" app-namespace="socialshowcase" />


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

And this xml retrieve me the next exception:

Multiple annotations found at this line:
    - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 
     'facebook:config'.
    - schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/social/spring-
     social-facebook.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element 
     of the document is not <xsd:schema>.

Anybody knows the problem?

thank you!!!!

I think this has to do with your pom missing some of the dependencies. Is spring-social-security in your dependency?

 <dependency>
     <groupId>org.springframework.social</groupId>
   <artifactId>spring-social-security</artifactId>
<version>1.1.0.RELEASE</version>

Here is a similar application with the same config as your spring xml above. Here is the pom it uses https://github.com/spring-projects/spring-social-samples/blob/master/attic/spring-social-showcase-xml/pom.xml

Here is a reference to a similar error resolved by fixing the pom dependency https://github.com/spring-projects/spring-social-facebook/issues/79

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM