Search in sources :

Example 1 with Lazy

use of org.springframework.context.annotation.Lazy in project cas by apereo.

the class GoogleAuthenticatorJpaConfiguration method googleAuthenticatorEntityManagerFactory.

@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean googleAuthenticatorEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean bean = Beans.newHibernateEntityManagerFactoryBean(new JpaConfigDataHolder(jpaGoogleAuthenticatorVendorAdapter(), "jpaGoogleAuthenticatorContext", jpaPackagesToScanGoogleAuthenticator(), dataSourceGoogleAuthenticator()), casProperties.getAuthn().getMfa().getGauth().getJpa().getDatabase());
    bean.getJpaPropertyMap().put("hibernate.enable_lazy_load_no_trans", Boolean.TRUE);
    return bean;
}
Also used : JpaConfigDataHolder(org.apereo.cas.configuration.model.support.jpa.JpaConfigDataHolder) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 2 with Lazy

use of org.springframework.context.annotation.Lazy in project cas by apereo.

the class EhcacheTicketRegistryConfiguration method cacheManager.

@Lazy
@Bean
public EhCacheManagerFactoryBean cacheManager() {
    final EhcacheProperties cache = casProperties.getTicket().getRegistry().getEhcache();
    final EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
    bean.setConfigLocation(cache.getConfigLocation());
    bean.setShared(cache.isShared());
    bean.setCacheManagerName(cache.getCacheManagerName());
    return bean;
}
Also used : EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) EhcacheProperties(org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties) Lazy(org.springframework.context.annotation.Lazy) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with Lazy

use of org.springframework.context.annotation.Lazy in project camel by apache.

the class CamelCloudServiceFilterAutoConfiguration method serviceFilter.

@Lazy
@Bean(name = "service-filter")
public CamelCloudServiceFilter serviceFilter(CamelCloudConfigurationProperties properties) {
    BlacklistServiceFilter blacklist = new BlacklistServiceFilter();
    Map<String, List<String>> services = properties.getServiceFilter().getBlacklist();
    for (Map.Entry<String, List<String>> entry : services.entrySet()) {
        for (String part : entry.getValue()) {
            String host = StringHelper.before(part, ":");
            String port = StringHelper.after(part, ":");
            if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) {
                blacklist.addServer(entry.getKey(), host, Integer.parseInt(port));
            }
        }
    }
    return new CamelCloudServiceFilter(Arrays.asList(new HealthyServiceFilter(), blacklist));
}
Also used : HealthyServiceFilter(org.apache.camel.impl.cloud.HealthyServiceFilter) List(java.util.List) BlacklistServiceFilter(org.apache.camel.impl.cloud.BlacklistServiceFilter) Map(java.util.Map) Lazy(org.springframework.context.annotation.Lazy) Bean(org.springframework.context.annotation.Bean)

Example 4 with Lazy

use of org.springframework.context.annotation.Lazy in project camel by apache.

the class SalesforceUpsertContactConnectorAutoConfiguration method configureSalesforceUpsertContactComponent.

@Lazy
@Bean(name = "salesforce-upsert-contact-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(org.foo.salesforce.contact.SalesforceUpsertContactComponent.class)
public SalesforceUpsertContactComponent configureSalesforceUpsertContactComponent(CamelContext camelContext, SalesforceUpsertContactConnectorConfiguration configuration) throws Exception {
    SalesforceUpsertContactComponent connector = new SalesforceUpsertContactComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null, false);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), connector, parameters);
    connector.setComponentOptions(parameters);
    return connector;
}
Also used : HashMap(java.util.HashMap) SalesforceUpsertContactComponent(org.foo.salesforce.contact.SalesforceUpsertContactComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with Lazy

use of org.springframework.context.annotation.Lazy in project camel by apache.

the class TwitterMentionConnectorAutoConfiguration method configureTwitterMentionComponent.

@Lazy
@Bean(name = "twitter-mention-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(org.foo.mention.TwitterMentionComponent.class)
public TwitterMentionComponent configureTwitterMentionComponent(CamelContext camelContext, TwitterMentionConnectorConfiguration configuration) throws Exception {
    TwitterMentionComponent connector = new TwitterMentionComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null, false);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), connector, parameters);
    connector.setComponentOptions(parameters);
    return connector;
}
Also used : HashMap(java.util.HashMap) TwitterMentionComponent(org.foo.mention.TwitterMentionComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Lazy (org.springframework.context.annotation.Lazy)235 Bean (org.springframework.context.annotation.Bean)234 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)223 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)223 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)220 HashMap (java.util.HashMap)113 Map (java.util.Map)108 List (java.util.List)3 JpaConfigDataHolder (org.apereo.cas.configuration.model.support.jpa.JpaConfigDataHolder)2 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)2 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 PersistenceConfiguration (net.sf.ehcache.config.PersistenceConfiguration)1 SLF4JLogChute (net.shibboleth.utilities.java.support.velocity.SLF4JLogChute)1 MemcachedClientFactoryBean (net.spy.memcached.spring.MemcachedClientFactoryBean)1 CoAPComponent (org.apache.camel.coap.CoAPComponent)1 AhcComponent (org.apache.camel.component.ahc.AhcComponent)1 WsComponent (org.apache.camel.component.ahc.ws.WsComponent)1 AMQPComponent (org.apache.camel.component.amqp.AMQPComponent)1 ApnsComponent (org.apache.camel.component.apns.ApnsComponent)1