Search in sources :

Example 51 with Bean

use of org.springframework.context.annotation.Bean in project ORCID-Source by ORCID.

the class SocialConfig method connectionFactoryLocator.

@Bean
public ConnectionFactoryLocator connectionFactoryLocator() {
    logger.info("getting connectionFactoryLocator");
    ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
    registry.addConnectionFactory(new FacebookConnectionFactory(fb_key, fb_secret));
    registry.addConnectionFactory(new GoogleConnectionFactory(gg_key, gg_secret));
    return registry;
}
Also used : GoogleConnectionFactory(org.springframework.social.google.connect.GoogleConnectionFactory) FacebookConnectionFactory(org.springframework.social.facebook.connect.FacebookConnectionFactory) ConnectionFactoryRegistry(org.springframework.social.connect.support.ConnectionFactoryRegistry) InitializingBean(org.springframework.beans.factory.InitializingBean) Bean(org.springframework.context.annotation.Bean)

Example 52 with Bean

use of org.springframework.context.annotation.Bean in project Protocol-Adapter-IEC61850 by OSGP.

the class RtuSimulatorConfig method rtuSimulator.

@Bean
public RtuSimulator rtuSimulator(@Value("${rtu.icd:Pampus_v0.4.5.icd}") final String icdFilename, @Value("${rtu.port:60102}") final Integer port, @Value("${rtu.serverName:WAGO61850Server}") final String serverName, @Value("${rtu.stopGeneratingValues:false}") final Boolean stopGeneratingValues) throws IOException {
    final InputStream icdFile = resourceLoader.getResource("classpath:" + icdFilename).getInputStream();
    try {
        final RtuSimulator rtuSimulator = new RtuSimulator(port, icdFile, serverName);
        if (stopGeneratingValues) {
            rtuSimulator.ensurePeriodicDataGenerationIsStopped();
        }
        rtuSimulator.start();
        return rtuSimulator;
    } catch (final SclParseException e) {
        LOGGER.warn("Error parsing SCL/ICD file {}", e);
    } finally {
        icdFile.close();
    }
    return null;
}
Also used : InputStream(java.io.InputStream) SclParseException(org.openmuc.openiec61850.SclParseException) Bean(org.springframework.context.annotation.Bean)

Example 53 with Bean

use of org.springframework.context.annotation.Bean in project Protocol-Adapter-IEC61850 by OSGP.

the class MessagingConfig method iec61850RequestsMessageListenerContainer.

@Bean
public DefaultMessageListenerContainer iec61850RequestsMessageListenerContainer(final JmsConfiguration iec61850RequestJmsConfiguration) {
    final DefaultMessageListenerContainer messageListenerContainer = iec61850RequestJmsConfiguration.getMessageListenerContainer();
    messageListenerContainer.setErrorHandler(new ErrorHandler() {

        @Override
        public void handleError(final Throwable t) {
            // Implementing ErrorHandler to prevent logging at WARN level
            // when JMSException is thrown: Execution of JMS message
            // listener failed, and no ErrorHandler has been set.
            LOGGER.debug("iec61850RequestsMessageListenerContainer.ErrorHandler.handleError()", t);
        }
    });
    return messageListenerContainer;
}
Also used : DefaultMessageListenerContainer(org.springframework.jms.listener.DefaultMessageListenerContainer) ErrorHandler(org.springframework.util.ErrorHandler) Bean(org.springframework.context.annotation.Bean)

Example 54 with Bean

use of org.springframework.context.annotation.Bean in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850OsgpCoreDbApiPersistenceConfig method iec61850OsgpCoreDbApiTransactionManager.

/**
     * Method for creating the Transaction Manager.
     *
     * @return JpaTransactionManager
     * @throws ClassNotFoundException
     *             when class not found
     */
@Bean
public JpaTransactionManager iec61850OsgpCoreDbApiTransactionManager() throws Iec61850CoreDbApiException {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    try {
        transactionManager.setEntityManagerFactory(this.iec61850OsgpCoreDbApiEntityManagerFactory().getObject());
        transactionManager.setTransactionSynchronization(JpaTransactionManager.SYNCHRONIZATION_ALWAYS);
    } catch (final ClassNotFoundException e) {
        final String msg = "Error in creating transaction manager bean";
        LOGGER.error(msg, e);
        throw new Iec61850CoreDbApiException(msg, e);
    }
    return transactionManager;
}
Also used : Iec61850CoreDbApiException(com.alliander.osgp.core.db.api.iec61850.exceptions.Iec61850CoreDbApiException) JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 55 with Bean

use of org.springframework.context.annotation.Bean in project motan by weibocom.

the class SpringBootRpcServerDemo method motanAnnotationBean.

@Bean
public AnnotationBean motanAnnotationBean() {
    AnnotationBean motanAnnotationBean = new AnnotationBean();
    motanAnnotationBean.setPackage("com.weibo.motan.demo.server");
    return motanAnnotationBean;
}
Also used : AnnotationBean(com.weibo.api.motan.config.springsupport.AnnotationBean) ProtocolConfigBean(com.weibo.api.motan.config.springsupport.ProtocolConfigBean) AnnotationBean(com.weibo.api.motan.config.springsupport.AnnotationBean) BasicServiceConfigBean(com.weibo.api.motan.config.springsupport.BasicServiceConfigBean) Bean(org.springframework.context.annotation.Bean) RegistryConfigBean(com.weibo.api.motan.config.springsupport.RegistryConfigBean)

Aggregations

Bean (org.springframework.context.annotation.Bean)4059 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1090 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)444 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)393 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)309 lombok.val (lombok.val)294 HashMap (java.util.HashMap)285 Lazy (org.springframework.context.annotation.Lazy)257 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)194 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)158 Map (java.util.Map)152 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)112 Properties (java.util.Properties)100 Autowired (org.springframework.beans.factory.annotation.Autowired)93 ArrayList (java.util.ArrayList)85 Primary (org.springframework.context.annotation.Primary)84 Qualifier (org.springframework.beans.factory.annotation.Qualifier)75 CamelContextAware (org.apache.camel.CamelContextAware)69 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)69 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)61