use of org.springframework.aop.framework.Advised in project spring-framework by spring-projects.
the class CountingAspectJAdvice method testIsProxy.
@Test
public void testIsProxy() throws Exception {
ITestBean bean = getTestBean();
assertThat(AopUtils.isAopProxy(bean)).as("Bean is not a proxy").isTrue();
// check the advice details
Advised advised = (Advised) bean;
Advisor[] advisors = advised.getAdvisors();
assertThat(advisors.length > 0).as("Advisors should not be empty").isTrue();
}
use of org.springframework.aop.framework.Advised in project cxf by apache.
the class SpringClassUnwrapper method getRealObject.
@Override
public Object getRealObject(Object o) {
if (o instanceof Advised) {
try {
Advised advised = (Advised) o;
Object target = advised.getTargetSource().getTarget();
// could be a proxy of a proxy.....
return getRealObject(target);
} catch (Exception ex) {
// ignore
}
}
return o;
}
use of org.springframework.aop.framework.Advised in project spring-security-oauth by spring-projects.
the class AbstractIntegrationTests method clear.
private void clear(TokenStore tokenStore) throws Exception {
if (tokenStore instanceof Advised) {
Advised advised = (Advised) tokenStore;
TokenStore target = (TokenStore) advised.getTargetSource().getTarget();
clear(target);
return;
}
if (tokenStore instanceof InMemoryTokenStore) {
((InMemoryTokenStore) tokenStore).clear();
}
if (tokenStore instanceof JdbcTokenStore) {
JdbcTemplate template = new JdbcTemplate(dataSource);
template.execute("delete from oauth_access_token");
template.execute("delete from oauth_refresh_token");
template.execute("delete from oauth_client_token");
template.execute("delete from oauth_code");
}
}
use of org.springframework.aop.framework.Advised in project spring-security-oauth by spring-projects.
the class AbstractIntegrationTests method clear.
private void clear(ApprovalStore approvalStore) throws Exception {
if (approvalStore instanceof Advised) {
Advised advised = (Advised) tokenStore;
ApprovalStore target = (ApprovalStore) advised.getTargetSource().getTarget();
clear(target);
return;
}
if (approvalStore instanceof InMemoryApprovalStore) {
((InMemoryApprovalStore) approvalStore).clear();
}
if (approvalStore instanceof JdbcApprovalStore) {
JdbcTemplate template = new JdbcTemplate(dataSource);
template.execute("delete from oauth_approvals");
}
}
use of org.springframework.aop.framework.Advised in project spring-framework by spring-projects.
the class EnableCachingIntegrationTests method assertCacheProxying.
private void assertCacheProxying(AnnotationConfigApplicationContext ctx) {
FooRepository repo = ctx.getBean(FooRepository.class);
boolean isCacheProxy = false;
if (AopUtils.isAopProxy(repo)) {
for (Advisor advisor : ((Advised) repo).getAdvisors()) {
if (advisor instanceof BeanFactoryCacheOperationSourceAdvisor) {
isCacheProxy = true;
break;
}
}
}
assertTrue("FooRepository is not a cache proxy", isCacheProxy);
}
Aggregations