java类org.springframework.beans.factory.annotation.Qualifier的实例源码

BusinessDatabaseConfig.java 文件源码 项目:busi-support 阅读 34 收藏 0 点赞 0 评论 0
@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();
}
BusinessDatabaseConfig.java 文件源码 项目:springbootWeb 阅读 32 收藏 0 点赞 0 评论 0
@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();
}
MovieContributionPersistenceServiceImpl.java 文件源码 项目:REST-Web-Services 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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;
}
CasValidationConfiguration.java 文件源码 项目:cas-5.1.0 阅读 26 收藏 0 点赞 0 评论 0
@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;
}
NoiseMap.java 文件源码 项目:emergentmud 阅读 20 收藏 0 点赞 0 评论 0
@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);
}
MySqlSource1Config.java 文件源码 项目:only-short-poc 阅读 17 收藏 0 点赞 0 评论 0
@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;
}
Read1DruidDataSourceConfig.java 文件源码 项目:SpringBoot-Study 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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();
}
ManualGraphQLQuerySchema.java 文件源码 项目:research-graphql 阅读 23 收藏 0 点赞 0 评论 0
@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();
}
ShiroConfig.java 文件源码 项目:lemcloud 阅读 30 收藏 0 点赞 0 评论 0
@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;
}
DataSourceConfig.java 文件源码 项目:DanmuChat 阅读 21 收藏 0 点赞 0 评论 0
@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();
}
MasterDataSourceConfig.java 文件源码 项目:springboot 阅读 30 收藏 0 点赞 0 评论 0
@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();
}
StackdriverTraceAutoConfiguration.java 文件源码 项目:spring-cloud-gcp 阅读 25 收藏 0 点赞 0 评论 0
@Bean
@ConditionalOnMissingBean
public TraceServiceClient traceServiceClient(
        @Qualifier("traceExecutorProvider") ExecutorProvider executorProvider)
        throws IOException {
    return TraceServiceClient.create(
            TraceServiceSettings.newBuilder()
            .setCredentialsProvider(
                    StackdriverTraceAutoConfiguration.this.finalCredentialsProvider)
            .setExecutorProvider(executorProvider)
            .build());
}
SurrogateWebflowEventResolutionConfiguration.java 文件源码 项目:cas-5.1.0 阅读 19 收藏 0 点赞 0 评论 0
@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;
}
UaaWebSecurityConfiguration.java 文件源码 项目:xm-uaa 阅读 27 收藏 0 点赞 0 评论 0
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;
}
O2iConfigRedisConfig.java 文件源码 项目:MonitorPlatform 阅读 20 收藏 0 点赞 0 评论 0
@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);
}
StudentDataSourceConfig.java 文件源码 项目:autotest 阅读 21 收藏 0 点赞 0 评论 0
@Bean(name = "studentSqlSessionFactory")
public SqlSessionFactory studentSqlSessionFactory(@Qualifier("studentDataSource") DataSource studentDataSource)
        throws Exception {
    final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
    sessionFactory.setDataSource(studentDataSource);
    return sessionFactory.getObject();
}
DigestAuthenticationConfiguration.java 文件源码 项目:cas-5.1.0 阅读 28 收藏 0 点赞 0 评论 0
@Autowired
@Bean
public DigestAuthenticationAction digestAuthenticationAction(@Qualifier("defaultDigestCredentialRetriever")
                                                             final DigestHashedCredentialRetriever defaultDigestCredentialRetriever) {
    return new DigestAuthenticationAction(initialAuthenticationAttemptWebflowEventResolver,
            serviceTicketRequestWebflowEventResolver,
            adaptiveAuthenticationPolicy,
            casProperties.getAuthn().getDigest().getRealm(),
            casProperties.getAuthn().getDigest().getAuthenticationMethod(),
            defaultDigestCredentialRetriever);
}
ReceiverApplication.java 文件源码 项目:spring-cloud-gcp 阅读 20 收藏 0 点赞 0 评论 0
@Bean
public PubSubInboundChannelAdapter messageChannelAdapter(
        @Qualifier("pubsubInputChannel") MessageChannel inputChannel,
        PubSubOperations pubSubTemplate) {
    PubSubInboundChannelAdapter adapter =
            new PubSubInboundChannelAdapter(pubSubTemplate, "exampleSubscription");
    adapter.setOutputChannel(inputChannel);
    adapter.setAckMode(AckMode.MANUAL);

    return adapter;
}
MonitorRedisConfig.java 文件源码 项目:MonitorPlatform 阅读 20 收藏 0 点赞 0 评论 0
@Primary
@Bean(name="monitorJedisPool")
public JedisPool getJedisPool(@Qualifier("monitorJedisPoolConfig") JedisPoolConfig config,   
        @Value("${spring.redis.monitor.host}")String host,   
        @Value("${spring.redis.monitor.port}")int port, 
        @Value("${spring.redis.monitor.timeOut}")int timeOut) {
    return new JedisPool(config, host, port, timeOut);
}
DemoOauth2Application.java 文件源码 项目:Oauth2-Stateless-Authentication-with-Spring-and-JWT-Token 阅读 20 收藏 0 点赞 0 评论 0
@Bean @Qualifier("mainDataSource")
public DataSource dataSource(){
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder
            .setType(EmbeddedDatabaseType.H2)
            .build();
    return db;
}
ManualGraphQLQuerySchema.java 文件源码 项目:research-graphql 阅读 23 收藏 0 点赞 0 评论 0
@Bean
@Qualifier("UserType")
public GraphQLObjectType getUserType() {
    return newObject()
            .name("UserDto")
            .field(newFieldDefinition()
                    .name("userId")
                    .type(GraphQLID)
                    .dataFetcher(dfe -> ((UserDto) dfe.getSource()).getId()))
            .field(newFieldDefinition()
                    .name("title")
                    .type(GraphQLString))
            .field(newFieldDefinition()
                    .name("firstname")
                    .type(GraphQLString)
                    .dataFetcher(dfe -> ((UserDto) dfe.getSource()).getGivenName()))
            .field(newFieldDefinition()
                    .name("lastname")
                    .type(GraphQLString)
                    .dataFetcher(dfe -> ((UserDto) dfe.getSource()).getFamilyName()))
            .field(newFieldDefinition()
                    .name("email")
                    .type(GraphQLString))
            .field(newFieldDefinition()
                    .name("dob")
                    .type(GraphQLString)
                    .dataFetcher(dfe -> ((UserDto) dfe.getSource()).getBday().toLocalDate().toString()))
            .build();
}
CasCoreConfiguration.java 文件源码 项目:cas-5.1.0 阅读 20 收藏 0 点赞 0 评论 0
@Autowired
@Bean
@ConditionalOnMissingBean(name = "centralAuthenticationService")
public CentralAuthenticationService centralAuthenticationService(
        @Qualifier("authenticationServiceSelectionPlan")
        final AuthenticationServiceSelectionPlan selectionStrategies,
        @Qualifier("principalFactory")
        final PrincipalFactory principalFactory,
        @Qualifier("protocolTicketCipherExecutor")
        final CipherExecutor cipherExecutor) {
    return new DefaultCentralAuthenticationService(ticketRegistry, ticketFactory, servicesManager, logoutManager,
            selectionStrategies, authenticationPolicyFactory(), principalFactory, cipherExecutor);
}
Cas30ResponseView.java 文件源码 项目:cas-server-4.2.1 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Instantiates a new Success.
 * @param view the view
 */
@Autowired
public Success(@Qualifier("cas3JstlSuccessView")
               final AbstractUrlBasedView view) {
    super(view);
    super.setSuccessResponse(true);
}
IgniteOperationRepository.java 文件源码 项目:eventapis 阅读 21 收藏 0 点赞 0 评论 0
@Autowired
public IgniteOperationRepository(@Qualifier("operationIgniteClient") Ignite ignite, KafkaTemplate kafkaTemplate) {
    this.ignite = ignite;
    operationCache = ignite.cache("operationCache");

    this.kafkaTemplate = kafkaTemplate;
}
ProfChoperSecurityConfig.java 文件源码 项目:InfoSys-1D 阅读 18 收藏 0 点赞 0 评论 0
@Autowired
public ProfChoperSecurityConfig(@Qualifier("profChoperDataSource") DataSource dataSource,
                                AccessDeniedHandler accessDeniedHandler,
                                AuthenticationSuccessHandler successHandler) {

    this.dataSource = dataSource;
    this.accessDeniedHandler = accessDeniedHandler;
    this.successHandler = successHandler;
}
Cas20ResponseView.java 文件源码 项目:springboot-shiro-cas-mybatis 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Instantiates a new Success.
 * @param view the view
 */
@Autowired
public Success(@Qualifier("cas2JstlSuccessView")
               final View view) {
    super(view);
    super.setSuccessResponse(true);
}
Cas30ResponseView.java 文件源码 项目:springboot-shiro-cas-mybatis 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Instantiates a new Success.
 * @param view the view
 */
@Autowired
public Success(@Qualifier("cas3JstlSuccessView")
               final AbstractUrlBasedView view) {
    super(view);
    super.setSuccessResponse(true);
}
CronyxAutoConfiguration.java 文件源码 项目:taboola-cronyx 阅读 22 收藏 0 点赞 0 评论 0
@Bean(name = "listenerAdapter")
public TriggerListener listenerAdapter(@Qualifier("listenerRegistry") Registry<String, Pair<ListenerMatcher, FiringListener>> listenerRegistry,
                                       @Qualifier("contextRegistry") Registry<String, CronyxExecutionContext> contextRegistry,
                                       @Qualifier("mainScheduler") Scheduler scheduler,
                                       @Qualifier("jobExecutionContextToFiringContext") JobExecutionContextToFiringContext jobExecutionContextToFiringContext) throws SchedulerException {
    TriggerListener adapter = new QuartzTriggerListenerAdapter(listenerRegistry, contextRegistry, jobExecutionContextToFiringContext);
    scheduler.getListenerManager().addTriggerListener(adapter);
    return adapter;
}
HekateJdkCodecConfigurer.java 文件源码 项目:hekate 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Constructs a new instance of {@link JdkCodecFactory}.
 *
 * @return Codec factory.
 */
@Bean
@Qualifier("default")
@ConfigurationProperties(prefix = "hekate.codec.jdk")
public JdkCodecFactory<Object> jdkCodecFactory() {
    return new JdkCodecFactory<>();
}
CasCookieConfiguration.java 文件源码 项目:cas-5.1.0 阅读 19 收藏 0 点赞 0 评论 0
@Autowired
@Bean
@RefreshScope
public CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator(@Qualifier("cookieCipherExecutor") final CipherExecutor cipherExecutor) {
    final TicketGrantingCookieProperties tgc = casProperties.getTgc();
    final int rememberMeMaxAge = Long.valueOf(tgc.getRememberMeMaxAge()).intValue();
    return new TGCCookieRetrievingCookieGenerator(cookieValueManager(cipherExecutor), 
            tgc.getName(),
            tgc.getPath(), tgc.getDomain(),
            rememberMeMaxAge, tgc.isSecure(), 
            tgc.getMaxAge(),
            tgc.isHttpOnly());
}


问题


面经


文章

微信
公众号

扫码关注公众号