use of org.springframework.beans.factory.annotation.Autowired in project spring-boot by spring-projects.
the class MockitoAopProxyTargetInterceptor method applyTo.
@Autowired
public static void applyTo(Object source) {
Assert.state(AopUtils.isAopProxy(source), "Source must be an AOP proxy");
try {
Advised advised = (Advised) source;
for (Advisor advisor : advised.getAdvisors()) {
if (advisor instanceof MockitoAopProxyTargetInterceptor) {
return;
}
}
Object target = AopTestUtils.getUltimateTargetObject(source);
Advice advice = new MockitoAopProxyTargetInterceptor(source, target);
advised.addAdvice(0, advice);
} catch (Exception ex) {
throw new IllegalStateException("Unable to apply Mockito AOP support", ex);
}
}
use of org.springframework.beans.factory.annotation.Autowired in project Asqatasun by Asqatasun.
the class AuditStatisticsFactory method setThemeDataService.
@Autowired
public final void setThemeDataService(ThemeDataService themeDataService) {
Collection<Theme> themeList = themeDataService.findAll();
if (fullThemeMapByRef == null) {
fullThemeMapByRef = new HashMap();
}
// to be associated with a criterion
for (Theme theme : themeList) {
if (!theme.getCriterionList().isEmpty()) {
String referenceCode = theme.getCriterionList().iterator().next().getReference().getCode();
if (!fullThemeMapByRef.containsKey(referenceCode)) {
Collection<Theme> themeListByRef = new ArrayList();
themeListByRef.add(theme);
fullThemeMapByRef.put(referenceCode, themeListByRef);
} else {
fullThemeMapByRef.get(referenceCode).add(theme);
}
}
}
for (Collection<Theme> entry : fullThemeMapByRef.values()) {
sortThemeList(entry);
}
}
use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.
the class CasCoreAuditConfiguration method auditTrailExecutionPlan.
@Autowired
@ConditionalOnMissingBean(name = "auditTrailExecutionPlan")
@Bean
public AuditTrailExecutionPlan auditTrailExecutionPlan(final List<AuditTrailExecutionPlanConfigurer> configurers) {
final DefaultAuditTrailExecutionPlan plan = new DefaultAuditTrailExecutionPlan();
configurers.forEach(c -> {
final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
LOGGER.debug("Registering audit trail manager [{}]", name);
c.configureAuditTrailExecutionPlan(plan);
});
return plan;
}
use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.
the class CasCoreAuditConfiguration method auditTrailRecordResolutionPlan.
@Autowired
@ConditionalOnMissingBean(name = "auditTrailRecordResolutionPlan")
@Bean
public AuditTrailRecordResolutionPlan auditTrailRecordResolutionPlan(final List<AuditTrailRecordResolutionPlanConfigurer> configurers) {
final DefaultAuditTrailRecordResolutionPlan plan = new DefaultAuditTrailRecordResolutionPlan();
configurers.forEach(c -> {
final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
LOGGER.debug("Registering audit trail manager [{}]", name);
c.configureAuditTrailRecordResolutionPlan(plan);
});
return plan;
}
use of org.springframework.beans.factory.annotation.Autowired in project cas by apereo.
the class CasCoreAuthenticationPrincipalConfiguration method personDirectoryPrincipalResolver.
@Autowired
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "personDirectoryPrincipalResolver")
public PrincipalResolver personDirectoryPrincipalResolver(@Qualifier("principalFactory") final PrincipalFactory principalFactory) {
final PersonDirectoryPrincipalResolver bean = new PersonDirectoryPrincipalResolver(attributeRepository, principalFactory, casProperties.getPersonDirectory().isReturnNull(), casProperties.getPersonDirectory().getPrincipalAttribute());
final ChainingPrincipalResolver resolver = new ChainingPrincipalResolver();
if (!attributeRepositories.isEmpty()) {
LOGGER.debug("Attribute repository sources are defined and available for the principal resolution chain. " + "The principal resolver will use a combination of attributes collected from attribute repository sources " + "and whatever may be collected during the authentication phase where results are eventually merged.");
resolver.setChain(CollectionUtils.wrapList(bean, new EchoingPrincipalResolver()));
} else {
LOGGER.debug("Attribute repository sources are not available for principal resolution so principal resolver will echo " + "back the principal resolved during authentication directly.");
resolver.setChain(CollectionUtils.wrapList(new EchoingPrincipalResolver()));
}
return resolver;
}
Aggregations