2010-05-28 2 views
0

하이에서 스프링 빈을 초기화하기 위해, 나는 봄 보안을 사용하고 내 설정은 데이터베이스에?방법 데이터베이스

public class SnsPropertyResourceConfigurer extends GrailsPlaceholderConfigurer{ 

    private BeanFactory beanFactory; 

    protected void loadProperties(Properties props) throws IOException { 
      setSystemPropertiesMode(2); 
      ConfigObject config = ConfigurationHolder.getConfig(); 
      if(config != null) { 
       props.putAll(config.toProperties()); 
      } 
       Properties add = addProperties(); 
       if(add != null){ 
        props.putAll(add); 

      } 
     } 

    private Properties addProperties(){ 

     InfoFetchClientRpcService infoFetchRpcService = (InfoFetchClientRpcService)beanFactory.getBean("infoFetchRpcService"); 
     Map<String, Application> apps = infoFetchRpcService.getAppInfo(); 
     Application thisApp = apps.get("sns"); 
     Application casApp = apps.get("cas"); 
     Properties props = new Properties(); 
     props.setProperty("cas.loginUrl", "11111111"); 
     props.setProperty("cas.logoutUrl", "222222222222"); 
     props.setProperty("cas.validator", casApp.getUrl()); 
     props.setProperty("cas.service",thisApp.getUrl()+"/j_spring_cas_security_check"); 
     props.setProperty("cas.defaultTargetUrl", thisApp.getSuccessUrl()); 
     props.setProperty("cas.defaultFailureUrl", thisApp.getFailureUrl()); 
     props.setProperty("cas.logout", thisApp.getLogoutUrl()); 
     props.setProperty("cas.logoutSuccessUrl", thisApp.getUrl()); 
     props.setProperty("cas.ticket.key", "sns"); 
     return props; 
    } 

    public void setBeanFactory(BeanFactory beanFactory) { 
     this.beanFactory = beanFactory; 
    } 
} 

<bean name="snsPropertyResourceConfigurer" class="com.ai.sns.init.SnsPropertyResourceConfigurer"> 
    </bean> 

있지만 영향을주지 ...

+0

왜 :

인용 모든 사람들을위한 우물

THK 'PropertyPlaceholderConfigurer'보다는'GrailsPlaceholderConfigurer'를 서브 클래 싱하는 것입니까? – skaffman

+0

나는 grails를 사용하기 때문에 Grails는 GrailsPlaceholderConfigurer를 사용합니다. – user340017

+1

@skaffman 그래서 거기에. – Andy

답변

2

서브 클래스 PropertyPlaceholderConfigurer 및 데이터베이스에서로드 기능을 구현 :

그래서, 나는이 작업을 수행. 작동 내가이 문제를 해결

관련 문제