use of org.springframework.beans.factory.config.MethodInvokingFactoryBean in project vip by guangdada.
the class ShiroConfig method methodInvokingFactoryBean.
/**
* 在方法中 注入 securityManager,进行代理控制
*/
@Bean
public MethodInvokingFactoryBean methodInvokingFactoryBean(DefaultWebSecurityManager securityManager) {
MethodInvokingFactoryBean bean = new MethodInvokingFactoryBean();
bean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager");
bean.setArguments(new Object[] { securityManager });
return bean;
}
use of org.springframework.beans.factory.config.MethodInvokingFactoryBean in project spring-framework by spring-projects.
the class ProxyTargetClassTrueConfig method testAspectsAreApplied.
@Test
public void testAspectsAreApplied() {
ClassPathXmlApplicationContext bf = newContext("aspects.xml");
ITestBean tb = (ITestBean) bf.getBean("adrian");
assertThat(tb.getAge()).isEqualTo(68);
MethodInvokingFactoryBean factoryBean = (MethodInvokingFactoryBean) bf.getBean("&factoryBean");
assertThat(AopUtils.isAopProxy(factoryBean.getTargetObject())).isTrue();
assertThat(((ITestBean) factoryBean.getTargetObject()).getAge()).isEqualTo(68);
}
use of org.springframework.beans.factory.config.MethodInvokingFactoryBean in project zhcet-web by zhcet-amu.
the class SecurityBeans method methodInvokingFactoryBean.
/**
* Spring Security Context is limited to local thread and hence every asynchronous method gets
* null logged in user info. We modify the SecurityContextHolder here to leverage auditing capabilities
* in asynchronous methods as well by enabling MODE_INHERITABLETHREADLOCAL
* @return MethodInvokingFactoryBean
*/
@Bean
public MethodInvokingFactoryBean methodInvokingFactoryBean() {
MethodInvokingFactoryBean methodInvokingFactoryBean = new MethodInvokingFactoryBean();
methodInvokingFactoryBean.setTargetClass(SecurityContextHolder.class);
methodInvokingFactoryBean.setTargetMethod("setStrategyName");
methodInvokingFactoryBean.setArguments((Object[]) new String[] { SecurityContextHolder.MODE_INHERITABLETHREADLOCAL });
return methodInvokingFactoryBean;
}
use of org.springframework.beans.factory.config.MethodInvokingFactoryBean in project spring-framework by spring-projects.
the class TestBeanAdvisor method testAspectsAreApplied.
@Test
public void testAspectsAreApplied() {
ClassPathXmlApplicationContext bf = newContext("aspects.xml");
ITestBean tb = (ITestBean) bf.getBean("adrian");
assertEquals(68, tb.getAge());
MethodInvokingFactoryBean factoryBean = (MethodInvokingFactoryBean) bf.getBean("&factoryBean");
assertTrue(AopUtils.isAopProxy(factoryBean.getTargetObject()));
assertEquals(68, ((ITestBean) factoryBean.getTargetObject()).getAge());
}
use of org.springframework.beans.factory.config.MethodInvokingFactoryBean in project dhis2-core by dhis2.
the class HibernateEncryptionConfig method addProvider.
@Bean
public MethodInvokingFactoryBean addProvider() {
MethodInvokingFactoryBean methodInvokingFactoryBean = new MethodInvokingFactoryBean();
methodInvokingFactoryBean.setStaticMethod("java.security.Security.addProvider");
methodInvokingFactoryBean.setArguments(new BouncyCastleProvider());
return methodInvokingFactoryBean;
}
Aggregations