當前位置: 首頁>>代碼示例>>Java>>正文


Java Qualifier類代碼示例

本文整理匯總了Java中org.springframework.beans.factory.annotation.Qualifier的典型用法代碼示例。如果您正苦於以下問題:Java Qualifier類的具體用法?Java Qualifier怎麽用?Java Qualifier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Qualifier類屬於org.springframework.beans.factory.annotation包,在下文中一共展示了Qualifier類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: businessSqlSessionFactory

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean
@Primary
public SqlSessionFactory businessSqlSessionFactory(@Qualifier("businessDataSource") DruidDataSource businessDataSource) throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(businessDataSource);
    //mybatis分頁
    PageHelper pageHelper = new PageHelper();
    Properties props = new Properties();
    props.setProperty("dialect", "mysql");
    props.setProperty("reasonable", "true");
    props.setProperty("supportMethodsArguments", "true");
    props.setProperty("returnPageInfo", "check");
    props.setProperty("params", "count=countSql");
    pageHelper.setProperties(props);
    //添加插件
    sqlSessionFactoryBean.setPlugins(new Interceptor[]{pageHelper});
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources(MAPPERXML_LOCATION));
    return sqlSessionFactoryBean.getObject();
}
 
開發者ID:DomKing,項目名稱:busi-support,代碼行數:21,代碼來源:BusinessDatabaseConfig.java

示例2: entityManagerFactory

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean(EntityManagerFactoryBeanName)
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
        @Qualifier(DataSourceBeanName) DataSource dataSource,
        @Qualifier(JpaVendorAdapterBeanName) JpaVendorAdapter vendorAdapter) {

    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
    entityManagerFactoryBean.setPackagesToScan(Organization.class.getPackage().getName());
    entityManagerFactoryBean.setPersistenceUnitName("mysqlsource1");
    entityManagerFactoryBean.afterPropertiesSet();

    return entityManagerFactoryBean;
}
 
開發者ID:omacarena,項目名稱:only-short-poc,代碼行數:17,代碼來源:MySqlSource1Config.java

示例3: shiroFilter

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean(name="shiroFilter")
public ShiroFilterFactoryBean shiroFilter(@Qualifier("securityManager")SecurityManager manager) {
    ShiroFilterFactoryBean bean=new ShiroFilterFactoryBean();
    bean.setSecurityManager(manager);
    //配置登錄的url和登錄成功的url
    bean.setLoginUrl("/login");
    bean.setSuccessUrl("/home");
    //配置訪問權限
    LinkedHashMap<String, String> filterChainDefinitionMap=new LinkedHashMap<>();
    filterChainDefinitionMap.put("/login", "anon"); //表示可以匿名訪問
    filterChainDefinitionMap.put("/common/**", "anon"); 
    filterChainDefinitionMap.put("/js/**","anon");
    filterChainDefinitionMap.put("/druid/**","anon");
    filterChainDefinitionMap.put("/captcha","anon");
    filterChainDefinitionMap.put("/**", "authc");//表示需要認證才可以訪問
    bean.setFilterChainDefinitionMap(filterChainDefinitionMap);
    return bean;
}
 
開發者ID:ranji1221,項目名稱:lemcloud,代碼行數:19,代碼來源:ShiroConfig.java

示例4: businessSqlSessionFactory

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean
@Primary
public SqlSessionFactory businessSqlSessionFactory(@Qualifier("businessDataSource") DruidDataSource businessDataSource) throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(businessDataSource);
    //mybatis分頁
    Properties props = new Properties();
    props.setProperty("dialect", "mysql");
    props.setProperty("reasonable", "true");
    props.setProperty("supportMethodsArguments", "true");
    props.setProperty("returnPageInfo", "check");
    props.setProperty("params", "count=countSql");
    PageHelper pageHelper = new PageHelper();
    pageHelper.setProperties(props);
    //添加插件
    sqlSessionFactoryBean.setPlugins(new Interceptor[]{pageHelper});
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources(MAPPERXML_LOCATION));
    return sqlSessionFactoryBean.getObject();
}
 
開發者ID:DomKing,項目名稱:springbootWeb,代碼行數:21,代碼來源:BusinessDatabaseConfig.java

示例5: MovieContributionPersistenceServiceImpl

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
/**
 * Constructor.
 *
 * @param movieRepository The movie repository to use
 * @param movieInfoRepository The movie info repository to use
 * @param contributionRepository The contribution repository to use
 * @param userRepository The user repository to use
 * @param moviePersistenceService The movie persistence service to use
 * @param storageService The storage service to use
 */
@Autowired
public MovieContributionPersistenceServiceImpl(
        @NotNull final MovieRepository movieRepository,
        @NotNull final MovieInfoRepository movieInfoRepository,
        @NotNull final ContributionRepository contributionRepository,
        @NotNull final UserRepository userRepository,
        @NotNull final MoviePersistenceService moviePersistenceService,
        @Qualifier("googleStorageService") @NotNull final StorageService storageService
) {
    this.movieRepository = movieRepository;
    this.movieInfoRepository = movieInfoRepository;
    this.contributionRepository = contributionRepository;
    this.userRepository = userRepository;
    this.moviePersistenceService = moviePersistenceService;
    this.storageService = storageService;
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:27,代碼來源:MovieContributionPersistenceServiceImpl.java

示例6: v3ProxyValidateController

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Autowired
@Bean
@ConditionalOnMissingBean(name = "v3ProxyValidateController")
public V3ProxyValidateController v3ProxyValidateController(@Qualifier("argumentExtractor") final ArgumentExtractor argumentExtractor,
                                                           @Qualifier("defaultAuthenticationSystemSupport")
                                                           final AuthenticationSystemSupport authenticationSystemSupport) {
    final V3ProxyValidateController c = new V3ProxyValidateController();
    c.setValidationSpecification(cas20ProtocolValidationSpecification);
    c.setSuccessView(cas3ServiceSuccessView());
    c.setFailureView(cas3ServiceFailureView);
    c.setProxyHandler(proxy20Handler);
    c.setAuthenticationSystemSupport(authenticationSystemSupport);
    c.setServicesManager(servicesManager);
    c.setCentralAuthenticationService(centralAuthenticationService);
    c.setArgumentExtractor(argumentExtractor);
    c.setMultifactorTriggerSelectionStrategy(multifactorTriggerSelectionStrategy);
    c.setAuthenticationContextValidator(authenticationContextValidator);
    c.setJsonView(cas3ServiceJsonView());
    c.setAuthnContextAttribute(casProperties.getAuthn().getMfa().getAuthenticationContextAttribute());
    return c;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:22,代碼來源:CasValidationConfiguration.java

示例7: NoiseMap

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Inject
public NoiseMap(@Qualifier("worldSeedElevation") long seedElevation,
                @Qualifier("worldSeedMoisture") long seedMoisture,
                @Qualifier("worldExtent") int worldExtent,
                @Qualifier("worldScale") double worldScale,
                @Qualifier("worldOctaves") int worldOctaves) {

    WORLD_EXTENT = worldExtent;
    HYPOTENUSE = Math.sqrt(Math.pow(WORLD_EXTENT / 2, 2) + Math.pow(WORLD_EXTENT / 2, 2));

    Noise2D noiseElevation = new SimplexNoise();
    Noise2D noiseMoisture = new SimplexNoise();

    ((SimplexNoise)noiseElevation).setSeed(seedElevation);
    ((SimplexNoise)noiseMoisture).setSeed(seedMoisture);

    elevation = new Fbm2D(noiseElevation);
    elevation.setFrequency(worldScale);
    elevation.setOctaves(worldOctaves);

    moisture = new Fbm2D(noiseMoisture);
    moisture.setFrequency(worldScale);
    moisture.setOctaves(worldOctaves);
}
 
開發者ID:scionaltera,項目名稱:emergentmud,代碼行數:25,代碼來源:NoiseMap.java

示例8: read1SqlSessionFactory

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
/**
 * SqlSessionFactory配置
 *
 * @return
 * @throws Exception
 */
@Bean(name = "read1SqlSessionFactory")
public SqlSessionFactory read1SqlSessionFactory(
        @Qualifier("read1DataSource") DataSource dataSource
) throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSource);

    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    // 配置mapper文件位置
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources(read1MapperLocations));

    //配置分頁插件
    PageHelper pageHelper = new PageHelper();
    Properties properties = new Properties();
    properties.setProperty("reasonable", "true");
    properties.setProperty("supportMethodsArguments", "true");
    properties.setProperty("returnPageInfo", "check");
    properties.setProperty("params", "count=countSql");
    pageHelper.setProperties(properties);

    //設置插件
    sqlSessionFactoryBean.setPlugins(new Interceptor[]{pageHelper});
    return sqlSessionFactoryBean.getObject();
}
 
開發者ID:Lengchuan,項目名稱:SpringBoot-Study,代碼行數:31,代碼來源:Read1DruidDataSourceConfig.java

示例9: getOrderItemType

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean
@Qualifier("OrderItemType")
public GraphQLObjectType getOrderItemType() {
    return newObject()
            .name("OrderItemDto")
            .field(newFieldDefinition()
                    .name("productId")
                    .type(GraphQLString))
            .field(newFieldDefinition()
                    .name("quantity")
                    .type(GraphQLInt))
            .field(newFieldDefinition()
                    .name("product")
                    .type(getProductType())
                    .dataFetcher(new OrderItemProductFetcher(productAdaptor)))
            .build();
}
 
開發者ID:roybailey,項目名稱:research-graphql,代碼行數:18,代碼來源:ManualGraphQLQuerySchema.java

示例10: sqlSessionFactory

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean
public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception{
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSource);
    //bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mybatis/mapper/test1/*.xml"));
    return sqlSessionFactoryBean.getObject();
}
 
開發者ID:SnackMen,項目名稱:DanmuChat,代碼行數:8,代碼來源:DataSourceConfig.java

示例11: masterSqlSessionFactory

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean(name = "masterSqlSessionFactory")
@Primary
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource) throws Exception{
	final SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
	sqlSessionFactoryBean.setDataSource(masterDataSource);
	sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MasterDataSourceConfig.MAPPER_LOCATION));
	return sqlSessionFactoryBean.getObject();
}
 
開發者ID:viakiba,項目名稱:springboot,代碼行數:9,代碼來源:MasterDataSourceConfig.java

示例12: traceServiceClient

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean
public TraceServiceClient traceServiceClient(
		@Qualifier("traceExecutorProvider") ExecutorProvider executorProvider)
		throws IOException {
	return TraceServiceClient.create(
			TraceServiceSettings.newBuilder()
			.setCredentialsProvider(
					StackdriverTraceAutoConfiguration.this.finalCredentialsProvider)
			.setExecutorProvider(executorProvider)
			.build());
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-gcp,代碼行數:13,代碼來源:StackdriverTraceAutoConfiguration.java

示例13: surrogateWebflowEventResolver

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean
public CasWebflowEventResolver surrogateWebflowEventResolver(@Qualifier("defaultAuthenticationSystemSupport") 
                                                                 final AuthenticationSystemSupport authenticationSystemSupport) {
    final CasWebflowEventResolver r = new SurrogateWebflowEventResolver(authenticationSystemSupport, centralAuthenticationService,
            servicesManager, ticketRegistrySupport, warnCookieGenerator,
            authenticationRequestServiceSelectionStrategies,
            selector, surrogateAuthenticationService);
    this.initialAuthenticationAttemptWebflowEventResolver.addDelegate(r);
    return r;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:11,代碼來源:SurrogateWebflowEventResolutionConfiguration.java

示例14: UaaWebSecurityConfiguration

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
public UaaWebSecurityConfiguration(UserDetailsService userDetailsService,
    AuthenticationManagerBuilder authenticationManagerBuilder,
    @Qualifier("authenticationProviderResolver") AuthenticationProviderResolver authenticationProviderResolver,
    @Lazy PasswordEncoder passwordEncoder) {
    this.userDetailsService = userDetailsService;
    this.authenticationManagerBuilder = authenticationManagerBuilder;
    this.authenticationProviderResolver = authenticationProviderResolver;
    this.passwordEncoder = passwordEncoder;
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:10,代碼來源:UaaWebSecurityConfiguration.java

示例15: getJedisPool

import org.springframework.beans.factory.annotation.Qualifier; //導入依賴的package包/類
@Bean(name="o2iConfigJedisPool")
public JedisPool getJedisPool(@Qualifier("o2iConfigJedisPoolConfig") JedisPoolConfig config,   
        @Value("${spring.redis.o2iConfig.host}")String host,   
        @Value("${spring.redis.o2iConfig.port}")int port, 
        @Value("${spring.redis.o2iConfig.timeOut}")int timeOut) {
    return new JedisPool(config, host, port, timeOut);
}
 
開發者ID:Zigin,項目名稱:MonitorPlatform,代碼行數:8,代碼來源:O2iConfigRedisConfig.java


注:本文中的org.springframework.beans.factory.annotation.Qualifier類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。