Search in sources :

Example 36 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 37 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 38 with Autowired

use of org.springframework.beans.factory.annotation.Autowired in project uPortal by Jasig.

the class RDBMUserLayoutStore method setPlatformTransactionManager.

@Autowired
public void setPlatformTransactionManager(@Qualifier(BasePortalJpaDao.PERSISTENCE_UNIT_NAME) PlatformTransactionManager platformTransactionManager) {
    this.transactionOperations = new TransactionTemplate(platformTransactionManager);
    final DefaultTransactionDefinition nextStructTransactionDefinition = new DefaultTransactionDefinition();
    nextStructTransactionDefinition.setPropagationBehavior(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
    this.nextStructTransactionOperations = new TransactionTemplate(platformTransactionManager, nextStructTransactionDefinition);
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) Autowired(org.springframework.beans.factory.annotation.Autowired)

Aggregations

Autowired (org.springframework.beans.factory.annotation.Autowired)38 Bean (org.springframework.context.annotation.Bean)23 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)9 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)5 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)3 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)3 V3ProxyValidateController (org.apereo.cas.web.v3.V3ProxyValidateController)2 V3ServiceValidateController (org.apereo.cas.web.v3.V3ServiceValidateController)2 Logger (org.slf4j.Logger)2 Qualifier (org.springframework.beans.factory.annotation.Qualifier)2 File (java.io.File)1 Constructor (java.lang.reflect.Constructor)1 Executable (java.lang.reflect.Executable)1 Field (java.lang.reflect.Field)1 Parameter (java.lang.reflect.Parameter)1 Properties (java.util.Properties)1 Resource (javax.annotation.Resource)1 Inject (javax.inject.Inject)1 PersistenceConfiguration (net.sf.ehcache.config.PersistenceConfiguration)1 CacheEntryFactory (net.sf.ehcache.constructs.blocking.CacheEntryFactory)1