use of org.springframework.context.annotation.Primary in project xm-ms-entity by xm-online.
the class XmAuthContextHolderDefaultTestConfiguration method xmAuthenticationContextHolder.
@Bean
@Primary
public XmAuthenticationContextHolder xmAuthenticationContextHolder() {
XmAuthenticationContext context = mock(XmAuthenticationContext.class);
when(context.hasAuthentication()).thenReturn(true);
when(context.getLogin()).thenReturn(Optional.of("testLogin"));
when(context.getUserKey()).thenReturn(Optional.of("ACCOUNT.TEST"));
XmAuthenticationContextHolder holder = mock(XmAuthenticationContextHolder.class);
when(holder.getContext()).thenReturn(context);
return holder;
}
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 hub-alert by blackducksoftware.
the class DatabaseDataSource method jpaTransactionManager.
@Bean
@Primary
public JpaTransactionManager jpaTransactionManager(DataSource dataSource) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setDataSource(dataSource);
return transactionManager;
}
use of org.springframework.context.annotation.Primary in project mybatis.flying by limeng32.
the class SqlSessionFactoryConfig method createSqlSessionFactoryBean.
@Bean(name = "sqlSessionFactory")
@Primary
public SqlSessionFactoryBean createSqlSessionFactoryBean() throws IOException {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
/**
* 设置datasource
*/
sqlSessionFactoryBean.setDataSource(dataSource1);
VFS.addImplClass(SpringBootVFS.class);
/**
* 设置mybatis configuration 扫描路径
*/
sqlSessionFactoryBean.setConfigLocation(new ClassPathResource("Configuration.xml"));
/**
* 设置typeAlias 包扫描路径
*/
sqlSessionFactoryBean.setTypeAliasesPackage("indi.mybatis.flying");
/**
* 添加mapper 扫描路径
*/
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] ra1 = resolver.getResources("classpath*:indi/mybatis/flying/mapper*/*.xml");
// 扫描映射文件
sqlSessionFactoryBean.setMapperLocations(ra1);
return sqlSessionFactoryBean;
}
use of org.springframework.context.annotation.Primary in project summer by foxsugar.
the class WechatPayConfig method wxPayService.
@Bean(name = "wxPayService")
@Primary
public WxPayService wxPayService() {
WxPayService wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(wxPayConfig());
return wxPayService;
}
Aggregations