Search in sources :

Example 51 with Autowired

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);
    }
}
Also used : Advised(org.springframework.aop.framework.Advised) Advisor(org.springframework.aop.Advisor) Advice(org.aopalliance.aop.Advice) Autowired(org.springframework.beans.factory.annotation.Autowired)

Example 52 with Autowired

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);
    }
}
Also used : Theme(org.asqatasun.entity.reference.Theme) Autowired(org.springframework.beans.factory.annotation.Autowired)

Example 53 with Autowired

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;
}
Also used : DefaultAuditTrailExecutionPlan(org.apereo.cas.audit.spi.DefaultAuditTrailExecutionPlan) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 54 with Autowired

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;
}
Also used : DefaultAuditTrailRecordResolutionPlan(org.apereo.cas.audit.spi.DefaultAuditTrailRecordResolutionPlan) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 55 with Autowired

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;
}
Also used : PersonDirectoryPrincipalResolver(org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver) ChainingPrincipalResolver(org.apereo.cas.authentication.principal.resolvers.ChainingPrincipalResolver) EchoingPrincipalResolver(org.apereo.cas.authentication.principal.resolvers.EchoingPrincipalResolver) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Autowired (org.springframework.beans.factory.annotation.Autowired)68 Bean (org.springframework.context.annotation.Bean)49 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)24 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)16 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)8 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)8 ThrottleProperties (org.apereo.cas.configuration.model.support.throttle.ThrottleProperties)4 OpenSamlConfigBean (org.apereo.cas.support.saml.OpenSamlConfigBean)3 Field (java.lang.reflect.Field)2 PersonDirectoryPrincipalResolver (org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver)2 MonitorProperties (org.apereo.cas.configuration.model.core.monitor.MonitorProperties)2 EncryptionRandomizedSigningJwtCryptographyProperties (org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties)2 DynamoDbTicketRegistryProperties (org.apereo.cas.configuration.model.support.dynamodb.DynamoDbTicketRegistryProperties)2 CasWebflowEventResolver (org.apereo.cas.web.flow.resolver.CasWebflowEventResolver)2 V3ServiceValidateController (org.apereo.cas.web.v3.V3ServiceValidateController)2 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)2 EhCacheFactoryBean (org.springframework.cache.ehcache.EhCacheFactoryBean)2 EhCacheManagerFactoryBean (org.springframework.cache.ehcache.EhCacheManagerFactoryBean)2 Lazy (org.springframework.context.annotation.Lazy)2 DeviceResponseMessageSender (com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.DeviceResponseMessageSender)1