org.springframework.cloud.context.config.annotation.RefreshScope Java Examples
The following examples show how to use
org.springframework.cloud.context.config.annotation.RefreshScope.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DiscoveryClientConfig.java From api-layer with Eclipse Public License 2.0 | 6 votes |
@Bean(destroyMethod = "shutdown") @RefreshScope public ApimlDiscoveryClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config, EurekaInstanceConfig instance, @Autowired(required = false) HealthCheckHandler healthCheckHandler ) { ApplicationInfoManager appManager; if (AopUtils.isAopProxy(manager)) { appManager = ProxyUtils.getTargetObject(manager); } else { appManager = manager; } final ApimlDiscoveryClient discoveryClientClient = new ApimlDiscoveryClient(appManager, config, this.optionalArgs, this.context); discoveryClientClient.registerHealthCheck(healthCheckHandler); discoveryClientClient.registerEventListener(event -> { if (event instanceof CacheRefreshedEvent) { refreshableRouteLocators.forEach(RefreshableRouteLocator::refresh); zuulHandlerMapping.setDirty(true); } }); return discoveryClientClient; }
Example #2
Source File: DiscoveryClientTestConfig.java From api-layer with Eclipse Public License 2.0 | 6 votes |
@Bean(destroyMethod = "shutdown") @RefreshScope public ApimlDiscoveryClientStub eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config, EurekaInstanceConfig instance, @Autowired(required = false) HealthCheckHandler healthCheckHandler, ApplicationRegistry applicationRegistry ) { ApplicationInfoManager appManager; if (AopUtils.isAopProxy(manager)) { appManager = ProxyUtils.getTargetObject(manager); } else { appManager = manager; } final ApimlDiscoveryClientStub discoveryClient = new ApimlDiscoveryClientStub(appManager, config, this.optionalArgs, this.context, applicationRegistry); discoveryClient.registerHealthCheck(healthCheckHandler); discoveryClient.registerEventListener(event -> { if (event instanceof CacheRefreshedEvent) { refreshableRouteLocators.forEach(RefreshableRouteLocator::refresh); zuulHandlerMapping.setDirty(true); } }); return discoveryClient; }
Example #3
Source File: ConfigServerMvcConfiguration.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Bean @RefreshScope public EnvironmentController environmentController( EnvironmentRepository envRepository, ConfigServerProperties server) { EnvironmentController controller = new EnvironmentController( encrypted(envRepository, server), this.objectMapper); controller.setStripDocumentFromYaml(server.isStripDocumentFromYaml()); controller.setAcceptEmpty(server.isAcceptEmpty()); return controller; }
Example #4
Source File: MesosAutoConfiguration.java From spring-cloud-deployer-mesos with Apache License 2.0 | 5 votes |
@Bean @RefreshScope public Chronos chronos(ChronosTaskLauncherProperties chronosProperties, DcosClusterProperties dcosClusterProperties) { if (StringUtils.hasText(dcosClusterProperties.getAuthorizationToken())) { return ChronosClient.getInstance(chronosProperties.getApiEndpoint(), new DcosHeadersInterceptor(dcosClusterProperties.getAuthorizationToken())); } else { return ChronosClient.getInstance(chronosProperties.getApiEndpoint()); } }
Example #5
Source File: MesosAutoConfiguration.java From spring-cloud-deployer-mesos with Apache License 2.0 | 5 votes |
@Bean @RefreshScope public Marathon marathon(MarathonAppDeployerProperties marathonProperties, DcosClusterProperties dcosClusterProperties) { if (StringUtils.hasText(dcosClusterProperties.getAuthorizationToken())) { return MarathonClient.getInstance(marathonProperties.getApiEndpoint(), new DcosHeadersInterceptor(dcosClusterProperties.getAuthorizationToken())); } else { return MarathonClient.getInstance(marathonProperties.getApiEndpoint()); } }
Example #6
Source File: RefreshScopeConfigurationTests.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
private void refresh() { EnvironmentManager environmentManager = this.context .getBean(EnvironmentManager.class); environmentManager.setProperty("message", "Hello Dave!"); org.springframework.cloud.context.scope.refresh.RefreshScope scope = this.context .getBean( org.springframework.cloud.context.scope.refresh.RefreshScope.class); scope.refreshAll(); }
Example #7
Source File: SSOMailValidateConfiguration.java From sso with MIT License | 5 votes |
@Bean @ConditionalOnMissingBean(name = "defaultValidateService") @RefreshScope public DefaultValidateService defaultValidateService() { //默认的邮箱校验服务 DefaultValidateService service = new DefaultValidateService( mailInformativeGenerator(), mailStore(), validateMailSender(), mailValidator()); return service; }
Example #8
Source File: SSOMailValidateConfiguration.java From sso with MIT License | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateMailSender") public MailSender validateMailSender() { LOGGER.info("邮件发送验证码"); return new MailSender(mailSender); }
Example #9
Source File: SSOMailValidateConfiguration.java From sso with MIT License | 5 votes |
@Bean @ConditionalOnMissingBean(name = "mailStore") @RefreshScope public MailMemoryStore mailStore() { LOGGER.warn("验证码内存存储,应考虑放于数据库或缓存设备"); return new MailMemoryStore(); }
Example #10
Source File: ValidateWebflowConfiguation.java From sso with MIT License | 5 votes |
@ConditionalOnMissingBean(name = "validateLoginCaptchaAction") @Bean @RefreshScope public Action validateLoginCaptchaAction() { ValidateLoginCaptchaAction validateCaptchaAction = new ValidateLoginCaptchaAction(captchaResultProvider); return validateCaptchaAction; }
Example #11
Source File: DefautConfiguration.java From resilient-transport-service with Apache License 2.0 | 5 votes |
@RefreshScope @Bean public AbstractConfiguration archaiusConfiguration() throws Exception { LOGGER.info("Enable Archaius Configuration"); ConcurrentMapConfiguration concurrentMapConfiguration = new ConcurrentMapConfiguration(); return concurrentMapConfiguration; }
Example #12
Source File: ExtZuulContextConfig.java From onetwo with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnClass(name="com.netflix.zuul.ZuulFilter") @ConditionalOnProperty(BootJfishCloudConfig.ZUUL_FIXHEADERS_ENABLED) @RefreshScope public FixHeaderZuulFilter fixHeaderZuulFilter(){ FixHeaderZuulFilter filter = new FixHeaderZuulFilter(); // filter.setFixHeaders(cloudConfig.getZuul().getFixHeaders()); return filter; }
Example #13
Source File: SamplerAutoConfiguration.java From spring-cloud-sleuth with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean public Sampler defaultTraceSampler(SamplerProperties config) { // TODO: Rewrite: refresh should replace the sampler, not change its state // internally if (config.getProbability() != null) { return new ProbabilityBasedSampler(config); } return new RateLimitingSampler(config); }
Example #14
Source File: MyBatisOAuthConfig.java From mini-platform with MIT License | 5 votes |
@Primary @RefreshScope @Bean(name = "dataSourceOAuth") @ConfigurationProperties(prefix = "spring.datasource.oauth") public DataSource dataSourceOAuth() { return DataSourceBuilder.create().build(); }
Example #15
Source File: SwaggerConfig.java From dk-foundation with GNU Lesser General Public License v2.1 | 5 votes |
@Bean @RefreshScope public Docket customDocket() { Docket docket = new Docket(DocumentationType.SWAGGER_2).select() .apis(RequestHandlerSelectors.basePackage(basePackage)) .paths(Predicates.not(PathSelectors.regex("/error.*"))) .build() .apiInfo(apiInfo()) .enable(enable); if(!host.equals(HOST_NONE)){ docket.host(host); } return docket; }
Example #16
Source File: ExampleAutoConfiguration.java From super-cloudops with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConfigurationProperties(prefix = "example") public ExampleService exampleService() { System.out.println("@Bean create exampleService"); return new ExampleService(); }
Example #17
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #18
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #19
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #20
Source File: DataSourceAutoConfiguration.java From super-cloudops with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean public DruidDataSource dataSource(DruidProperties prop) { DruidDataSource datasource = new DruidDataSource(); datasource.setUrl(prop.getUrl()); datasource.setUsername(prop.getUsername()); String plain = prop.getPassword(); if (valueOf(env.getProperty("spring.profiles.active")).startsWith("pro")) { try { // TODO using dynamic cipherKey?? byte[] cipherKey = AES128ECBPKCS5.getEnvCipherKey("DEVOPS_CIPHER_KEY"); plain = new AES128ECBPKCS5().decrypt(cipherKey, CodecSource.fromHex(prop.getPassword())).toString(); } catch (Throwable th) { throw new IllegalStateException(format("Unable to decryption database password for '%s'", prop.getPassword()), th); } } datasource.setPassword(plain); datasource.setDriverClassName(prop.getDriverClassName()); datasource.setInitialSize(prop.getInitialSize()); datasource.setMinIdle(prop.getMinIdle()); datasource.setMaxActive(prop.getMaxActive()); datasource.setMaxWait(prop.getMaxWait()); datasource.setTimeBetweenEvictionRunsMillis(prop.getTimeBetweenEvictionRunsMillis()); datasource.setMinEvictableIdleTimeMillis(prop.getMinEvictableIdleTimeMillis()); datasource.setValidationQuery(prop.getValidationQuery()); datasource.setTestWhileIdle(prop.isTestWhileIdle()); datasource.setTestOnBorrow(prop.isTestOnBorrow()); datasource.setTestOnReturn(prop.isTestOnReturn()); try { datasource.setFilters(prop.getFilters()); } catch (SQLException e) { log.error("druid configuration initialization filter", e); } return datasource; }
Example #21
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #22
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #23
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #24
Source File: CustomerAuthWebflowConfiguration.java From CAS with Apache License 2.0 | 5 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(name = "validateLoginAction") public Action validateLoginAction() { ValidateLoginAction validateCaptchaAction = new ValidateLoginAction(); return validateCaptchaAction; }
Example #25
Source File: RefreshScopedRetryConfigurationTest.java From resilience4j with Apache License 2.0 | 4 votes |
@Test public void testRefreshScopedRateLimiterConfig() { Arrays.stream(RefreshScopedRetryAutoConfiguration.class.getMethods()) .filter(method -> method.isAnnotationPresent(Bean.class)) .forEach(method -> assertThat(method.isAnnotationPresent(RefreshScope.class)).isTrue()); }
Example #26
Source File: SpringCloudCommonTest.java From resilience4j with Apache License 2.0 | 4 votes |
@Test public void testRefreshScopedCircuitBreakerConfig() { Arrays.stream(RefreshScopedCircuitBreakerAutoConfiguration.class.getMethods()) .filter(method -> method.isAnnotationPresent(Bean.class)) .forEach(method -> assertThat(method.isAnnotationPresent(RefreshScope.class)).isTrue()); }
Example #27
Source File: ConfigurationPropertiesRebinderRefreshScopeIntegrationTests.java From spring-cloud-commons with Apache License 2.0 | 4 votes |
@Bean @RefreshScope protected TestProperties properties() { return new TestProperties(); }
Example #28
Source File: RefreshScopedRateLimiterConfigurationTest.java From resilience4j with Apache License 2.0 | 4 votes |
@Test public void testRefreshScopedRetryConfig() { Arrays.stream(RefreshScopedRateLimiterAutoConfiguration.class.getMethods()) .filter(method -> method.isAnnotationPresent(Bean.class)) .forEach(method -> assertThat(method.isAnnotationPresent(RefreshScope.class)).isTrue()); }
Example #29
Source File: SpringCloudCommonTest.java From resilience4j with Apache License 2.0 | 4 votes |
@Test public void testRefreshScopedTimeLimiterConfig() { Arrays.stream(RefreshScopedTimeLimiterAutoConfiguration.class.getMethods()) .filter(method -> method.isAnnotationPresent(Bean.class)) .forEach(method -> assertThat(method.isAnnotationPresent(RefreshScope.class)).isTrue()); }
Example #30
Source File: SpringCloudCommonTest.java From resilience4j with Apache License 2.0 | 4 votes |
@Test public void testRefreshScopedRateLimiterConfig() { Arrays.stream(RefreshScopedRateLimiterAutoConfiguration.class.getMethods()) .filter(method -> method.isAnnotationPresent(Bean.class)) .forEach(method -> assertThat(method.isAnnotationPresent(RefreshScope.class)).isTrue()); }