How-to configure Spring Social via XML How-to configure Spring Social via XML spring spring

How-to configure Spring Social via XML


I have a configuration that worked for Spring Social Facebook integration. (I have twitter configuration in it, But I haven't tested the twitter part in it)

<bean class="org.springframework.social.connect.web.ProviderSignInController"><!-- relies on by-type autowiring for the constructor-args -->    <constructor-arg ref="signInAdapter" /> </bean><bean id="connectionFactoryLocator"   class="org.springframework.social.connect.support.ConnectionFactoryRegistry"><property name="connectionFactories">    <list>        <bean class="org.springframework.social.twitter.connect.TwitterConnectionFactory">            <constructor-arg value="${twitter.consumerKey}" />            <constructor-arg value="${twitter.consumerSecret}" />                       </bean>        <bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">            <constructor-arg value="${facebook.clientId}" />            <constructor-arg value="${facebook.clientSecret}" />                        </bean>    </list></property></bean><bean id="connectionRepository" factory-method="createConnectionRepository"   factory-bean="usersConnectionRepository" scope="request"><constructor-arg value="#{request.userPrincipal.name}" /><aop:scoped-proxy proxy-target-class="false" /></bean><bean id="signInAdapter" class="com.test.social.SimpleSignInAdapter"/><bean id="usersConnectionRepository"   class="org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository"><constructor-arg ref="dataSource" /><constructor-arg ref="connectionFactoryLocator" /><constructor-arg ref="textEncryptor" /></bean><bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors"         factory-method="noOpText" />

I have primarily referred the documentation which is small enough to read and a tutorial which had more to do with integration with spring security. I hope this helps in some way.


I have a working xml spring-mvc/spring-social configuration for tomcat7 inthis question I posted.

This question was posted a long time ago but maybe the configuration in my post will save some people some time. It took me quite some time to set up with XML configuration and latest spring 4.2.4 MVC including spring-social(1.1.4) and spring-social-twitter(1.1.2) twitter connection.I write versions here, because there are quite a few things different between spring versions.