use of org.springframework.context.annotation.Primary in project ontrack by nemerosa.
the class GitMockConfig method repositoryClientFactory.
@Bean
@Primary
public GitRepositoryClientFactory repositoryClientFactory() {
GitRepositoryClientFactory factory = mock(GitRepositoryClientFactory.class);
when(factory.getClient(any(GitRepository.class))).thenReturn(testGitRepositoryClient());
return factory;
}
use of org.springframework.context.annotation.Primary in project spring-boot-api-seed-project by selfassu.
the class DruidConfigurer method dataSource.
@Bean
@Primary
public DataSource dataSource() {
logger.info("DruidConfigurer ==> starting init druid datasource.....");
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUsername(username);
dataSource.setPassword(password);
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url);
dataSource.setInitialSize(initialSize);
dataSource.setMaxActive(maxActive);
dataSource.setMinIdle(minIdle);
dataSource.setMaxWait(maxWait);
dataSource.setPoolPreparedStatements(poolPreparedStatements);
dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
dataSource.setValidationQuery(validationQuery);
dataSource.setValidationQueryTimeout(validationQueryTimeout);
dataSource.setTestOnBorrow(testOnBorrow);
dataSource.setTestOnReturn(testOnReturn);
dataSource.setTestWhileIdle(testWhileIdle);
dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
dataSource.setAsyncCloseConnectionEnable(asyncCloseConnectionEnable);
logger.info("DruidConfigurer ==> starting init druid datasource completed.....");
return dataSource;
}
use of org.springframework.context.annotation.Primary in project spring-boot by spring-projects.
the class JmxAutoConfiguration method mbeanExporter.
@Bean
@Primary
@ConditionalOnMissingBean(value = MBeanExporter.class, search = SearchStrategy.CURRENT)
public AnnotationMBeanExporter mbeanExporter(ObjectNamingStrategy namingStrategy) {
AnnotationMBeanExporter exporter = new AnnotationMBeanExporter();
exporter.setRegistrationPolicy(RegistrationPolicy.FAIL_ON_EXISTING);
exporter.setNamingStrategy(namingStrategy);
String server = this.propertyResolver.getProperty("server", "mbeanServer");
if (StringUtils.hasLength(server)) {
exporter.setServer(this.beanFactory.getBean(server, MBeanServer.class));
}
return exporter;
}
use of org.springframework.context.annotation.Primary in project rhino by PLOS.
the class RhinoConfiguration method transactionManager.
@Bean
// and a JmsTransactionManager.
@Primary
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager manager = new HibernateTransactionManager();
manager.setSessionFactory(sessionFactory);
return manager;
}
use of org.springframework.context.annotation.Primary in project perry by ca-cwds.
the class CMSConfiguration method entityManagerFactory.
@Bean
@Primary
@Autowired
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setJpaPropertyMap(jpaProperties().getHibernateProperties(dataSource));
em.setPackagesToScan("gov.ca.cwds.data.persistence.auth", "gov.ca.cwds.data.auth");
em.setPersistenceUnitName("default");
em.setJpaVendorAdapter(jpaVendorAdapter());
return em;
}
Aggregations