2012-04-27 2 views
1

이미 스프링 소셜 문서를 읽었지 만 구성의 일부는 Java 기반이지만 프로젝트의 구성은 XML 기반입니다. 그러니 스프링 XML 설정 파일에서 어떻게 설정을 바꿔야하는지 알려주세요. 고맙습니다. 불쌍한 영어에 대해 감사드립니다.spring social xml config

+1

주십시오이 코드를 기반으로 설정하거나,에서 적어도 그것에 연결하십시오. 또는 더 나은 방법 : 코드 기반 구성 (http://static.springsource.org/spring-framework/docs/current/spring-framework-reference/html/beans.html#beans-java) 및 포트 예제에 대한 설명서를 직접 읽어보십시오. . –

+0

@ Sejuju - 질문에 조금 더 노력하면 더 나은 응답을 얻을 수 있습니다. 당신은 문서를 읽었습니다. 그것은 좋은 시작입니다. 이제 당신이 시도한 것을 보여 주면 좋은 반응을 얻게 될 것입니다. – Marijn

답변

0

당신은 사회 구성 XML 파일을 생성해야하고 그럴 필요 root-context.xml 파일로 가져 오기. 또한 스프링 보안으로 앱을 구성 할 수도 있습니다. 프로젝트 아키텍처에 따라 다릅니다.

샘플 봄 사회 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:context="http://www.springframework.org/schema/context" 
     xmlns:social="http://www.springframework.org/schema/social" 
     xmlns:facebook="http://www.springframework.org/schema/social/facebook" xmlns:bean="http://java.sun.com/jsf/core" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd 
     http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd 
     http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd"> 

<!-- Ensures that configuration properties are read from a property file --> 
<context:property-placeholder location="file:${sampleapp.appdir}/conf/appparam.txt"/> 

<!-- 
    Configures FB and Twitter support. 
--> 
<facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" /> 

<!-- 
    Configures the connection repository. This application uses JDBC 
    connection repository which saves connection details to database. 
    This repository uses the data source bean for obtaining database 
    connection. 
--> 
<social:jdbc-connection-repository data-source-ref="sampleappDS" connection-signup-ref="accountConnectionSignup"/> 



<!-- 
    This bean is custom account connection signup bean for your registeration logic. 
    --> 
    <bean id="accountConnectionSignup" class="com.sampleapp.social.AccountConnectionSignup"></bean> 

<!-- 
    This bean manages the connection flow between the account provider and 
    the example application. 
--> 
<bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor"> 
    <constructor-arg index="0" ref="connectionFactoryLocator"/> 
    <constructor-arg index="1" ref="connectionRepository"/> 
</bean> 

샘플 루트의 context.xml :

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:cache="http://www.springframework.org/schema/cache" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd 
     http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> 

<!-- Scan for Spring beans declared via annotations. --> 
<context:component-scan base-package="com.sampleapp"/> 

<context:annotation-config/> 

<context:property-placeholder location="file:${sampleapp.appdir}/conf/appparam.txt"/> 

<cache:annotation-driven/> 

<!-- Root Context: defines shared resources visible to all other web components --> 
<import resource="security-config.xml"/> 
<import resource="classpath*:spring/bean-context.xml"/> 
<import resource="classpath*:spring/persistence-config.xml"/> 
<import resource="social-config.xml"/> 

<aop:aspectj-autoproxy proxy-target-class="true"/>