@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(); }
@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(); }
/** * 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; }
@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; }
@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); }
@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; }
/** * 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(); }
@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(); }
@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; }
@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(); }
@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(); }
@Bean @ConditionalOnMissingBean public TraceServiceClient traceServiceClient( @Qualifier("traceExecutorProvider") ExecutorProvider executorProvider) throws IOException { return TraceServiceClient.create( TraceServiceSettings.newBuilder() .setCredentialsProvider( StackdriverTraceAutoConfiguration.this.finalCredentialsProvider) .setExecutorProvider(executorProvider) .build()); }
@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; }
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; }
@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); }
@Bean(name = "studentSqlSessionFactory") public SqlSessionFactory studentSqlSessionFactory(@Qualifier("studentDataSource") DataSource studentDataSource) throws Exception { final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); sessionFactory.setDataSource(studentDataSource); return sessionFactory.getObject(); }
@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); }
@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; }
@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); }
@Bean @Qualifier("mainDataSource") public DataSource dataSource(){ EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); EmbeddedDatabase db = builder .setType(EmbeddedDatabaseType.H2) .build(); return db; }
@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(); }
@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); }
/** * Instantiates a new Success. * @param view the view */ @Autowired public Success(@Qualifier("cas3JstlSuccessView") final AbstractUrlBasedView view) { super(view); super.setSuccessResponse(true); }
@Autowired public IgniteOperationRepository(@Qualifier("operationIgniteClient") Ignite ignite, KafkaTemplate kafkaTemplate) { this.ignite = ignite; operationCache = ignite.cache("operationCache"); this.kafkaTemplate = kafkaTemplate; }
@Autowired public ProfChoperSecurityConfig(@Qualifier("profChoperDataSource") DataSource dataSource, AccessDeniedHandler accessDeniedHandler, AuthenticationSuccessHandler successHandler) { this.dataSource = dataSource; this.accessDeniedHandler = accessDeniedHandler; this.successHandler = successHandler; }
/** * Instantiates a new Success. * @param view the view */ @Autowired public Success(@Qualifier("cas2JstlSuccessView") final View view) { super(view); super.setSuccessResponse(true); }
@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; }
/** * 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<>(); }
@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()); }
@Bean @Qualifier("tokenStore") public TokenStore tokenStore() { System.out.println("Created JwtTokenStore"); return new JwtTokenStore(jwtTokenEnhancer()); }
@Autowired ServiceRegistryInitializer(@Qualifier("jsonServiceRegistryDao") final ServiceRegistryDao jsonServiceRegistryDao, @Qualifier("serviceRegistryDao") final ServiceRegistryDao serviceRegistryDao) { this.jsonServiceRegistryDao = jsonServiceRegistryDao; this.serviceRegistryDao = serviceRegistryDao; }
@Bean(name = ConfigConstant.NAME_DS_SSF_SLAVE) public SqlSessionFactory mafSlaveSqlSessionFactory(@Qualifier(ConfigConstant.NAME_DS_SLAVE) DataSource mafSlaveDataSource) throws Exception { logger.info("----- MAFIA slave data source sql session factory INIT -----"); final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); sessionFactory.setDataSource(mafSlaveDataSource); sessionFactory.setConfigLocation(new ClassPathResource(ConfigConstant.NAME_MYBATIS_CONFIG)); return sessionFactory.getObject(); }
@Bean(name = "dataSource_one") @Qualifier("custom") public DataSource dataSource() { DefaultBasicDataSource ds = new DefaultBasicDataSource(); ds.setUrl("jdbc:h2:mem:testdb1"); ds.setUsername("sa"); return ds; }
@Autowired(required=false) @Override public void setPrincipalNameTransformer(@Qualifier("mongoPrincipalNameTransformer") final PrincipalNameTransformer principalNameTransformer) { if (principalNameTransformer != null) { super.setPrincipalNameTransformer(principalNameTransformer); } }
@Autowired(required = false) @Override public void setPasswordEncoder(@Qualifier("stormpathPasswordEncoder") final PasswordEncoder passwordEncoder) { if (passwordEncoder != null) { super.setPasswordEncoder(passwordEncoder); } }
@Autowired(required=false) @Override public void setPrincipalNameTransformer(@Qualifier("stormpathPrincipalNameTransformer") final PrincipalNameTransformer principalNameTransformer) { if (principalNameTransformer != null) { super.setPrincipalNameTransformer(principalNameTransformer); } }
@Autowired(required=false) @Override public final void setPrincipalNameTransformer(@Qualifier("tokenPrincipalNameTransformer") final PrincipalNameTransformer principalNameTransformer) { if (principalNameTransformer != null) { super.setPrincipalNameTransformer(principalNameTransformer); } }
@ConditionalOnProperty(prefix = "cas.authn.mfa.gauth.cleaner", name = "enabled", havingValue = "true", matchIfMissing = true) @Bean @Autowired public OneTimeTokenRepositoryCleaner googleAuthenticatorTokenRepositoryCleaner(@Qualifier("oneTimeTokenAuthenticatorTokenRepository") final OneTimeTokenRepository oneTimeTokenAuthenticatorTokenRepository) { return new GoogleAuthenticatorOneTimeTokenRepositoryCleaner(oneTimeTokenAuthenticatorTokenRepository); }
@Bean(name = "dao") @Primary public Dao dao(@Qualifier("daoMapper")DaoMapper daoMapper) throws Exception { return new Dao(daoMapper,new DaoConfig() { @Override public DataBase getDataBase() { // TODO Auto-generated method stub return DataBase.MYSQL; } }); }