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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations