Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rotoshine
Created March 19, 2012 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rotoshine/2108254 to your computer and use it in GitHub Desktop.
Save rotoshine/2108254 to your computer and use it in GitHub Desktop.
Spring Social을 위한 Spring Context
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
">
<context:component-scan base-package="net.roto.github">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service" />
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!-- dataSource -->
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/oauth" />
<!-- ConnectionFactoryLocation를 구현한 bean 설정 -->
<bean id="connectionFactoryLocator" class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
<property name="connectionFactories">
<list>
<bean class="org.springframework.social.github.connect.GitHubConnectionFactory">
<constructor-arg value="consumer key를 여기에 입력" />
<constructor-arg value="consumer secret을 여기에 입력" />
</bean>
</list>
</property>
</bean>
<bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors" factory-method="noOpText" />
<!-- usersConnectionRepository 구현체 bean 등록 -->
<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="connectionRepository"
factory-bean="usersConnectionRepository"
factory-method="createConnectionRepository"
scope="request">
<!-- 팩토리 메소드 호출 시마다 아래의 파라메터가 넘어가는데, 현재는 임시값으로 rotoshine 설정 -->
<constructor-arg value="rotoshine"/>
<aop:scoped-proxy proxy-target-class="false"/>
</bean>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment