Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@

package org.fireflyframework.core.actuator.config;

import org.fireflyframework.core.actuator.health.LoggingHealthIndicator;
import org.fireflyframework.core.logging.config.LoggingProperties;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration;
import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -70,5 +73,10 @@ public DiskSpaceHealthIndicator diskSpaceHealthIndicator() {
return new DiskSpaceHealthIndicator(new File(diskSpace.getPath()), threshold);
}


@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(LoggingProperties.class)
public LoggingHealthIndicator loggingHealthIndicator(LoggingProperties loggingProperties) {
return new LoggingHealthIndicator(loggingProperties);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
import org.fireflyframework.core.logging.config.LoggingProperties;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
Expand All @@ -42,9 +38,6 @@
* <li>Overall system performance</li>
* </ul>
*/
@Component
@ConditionalOnClass(name = "org.springframework.boot.actuate.health.HealthIndicator")
@ConditionalOnBean(LoggingProperties.class)
public class LoggingHealthIndicator implements HealthIndicator {

private final LoggingProperties loggingProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
@Slf4j
@Component
@RequiredArgsConstructor
@ConditionalOnProperty(name = "webclient.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(name = "firefly.webclient.enabled", havingValue = "true", matchIfMissing = true)
public class WebClientBuilderCustomizer {

private final WebClientProperties properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.fireflyframework.core.config;

import org.fireflyframework.core.web.client.WebClientTemplate;
import org.fireflyframework.core.web.resilience.ResilientWebClient;
import io.github.resilience4j.bulkhead.BulkheadRegistry;
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
Expand All @@ -26,7 +27,9 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.ClientRequest;
Expand Down Expand Up @@ -65,7 +68,8 @@
*/
@Slf4j
@Configuration
@ConditionalOnProperty(name = "webclient.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(name = "firefly.webclient.enabled", havingValue = "true", matchIfMissing = true)
@EnableConfigurationProperties(WebClientProperties.class)
public class WebClientConfig {

private final CircuitBreakerRegistry circuitBreakerRegistry;
Expand Down Expand Up @@ -165,4 +169,10 @@ WebClient.Builder webClientBuilder() {

return builder;
}

@Bean
@ConditionalOnMissingBean
WebClientTemplate webClientTemplate(WebClient webClient, WebClientProperties properties) {
return new WebClientTemplate(webClient, properties);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;
import java.util.HashMap;
Expand Down Expand Up @@ -53,8 +52,7 @@
* - `@Getter`, `@Setter`: Lombok annotations to automatically generate
* getter and setter methods for the fields.
*/
@Configuration
@ConfigurationProperties(prefix = "webclient")
@ConfigurationProperties(prefix = "firefly.webclient")
@Getter
@Setter
public class WebClientProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
@Configuration
@ConditionalOnClass(name = "org.springframework.cloud.config.client.ConfigServicePropertySourceLocator")
@ConditionalOnProperty(prefix = "cloud.config", name = "enabled", havingValue = "true")
@ConditionalOnProperty(prefix = "firefly.cloud.config", name = "enabled", havingValue = "true")
@EnableConfigurationProperties(CloudConfigProperties.class)
@Slf4j
public class CloudConfigAutoConfiguration {
Expand All @@ -69,7 +69,7 @@ public CloudConfigAutoConfiguration(CloudConfigProperties properties, Environmen
*/
@Bean
@ConditionalOnClass(name = "org.springframework.cloud.context.scope.refresh.RefreshScope")
@ConditionalOnProperty(prefix = "cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = "firefly.cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public RefreshScope refreshScope() {
log.info("Creating refresh scope");
Expand All @@ -83,7 +83,7 @@ public RefreshScope refreshScope() {
*/
@Bean
@ConditionalOnClass(name = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshProperties")
@ConditionalOnProperty(prefix = "cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = "firefly.cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public RefreshProperties refreshProperties() {
log.info("Creating refresh properties");
Expand All @@ -99,7 +99,7 @@ public RefreshProperties refreshProperties() {
*/
@Bean
@ConditionalOnClass(name = "org.springframework.cloud.context.refresh.ContextRefresher")
@ConditionalOnProperty(prefix = "cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = "firefly.cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public ContextRefresher contextRefresher(RefreshScope refreshScope, RefreshProperties refreshProperties) {
log.info("Creating context refresher");
Expand All @@ -114,7 +114,7 @@ public ContextRefresher contextRefresher(RefreshScope refreshScope, RefreshPrope
*/
@Bean
@ConditionalOnClass(name = "org.springframework.cloud.endpoint.RefreshEndpoint")
@ConditionalOnProperty(prefix = "cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = "firefly.cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public RefreshEndpoint refreshEndpoint(ContextRefresher contextRefresher) {
log.info("Enabling configuration refresh endpoint");
Expand All @@ -129,7 +129,7 @@ public RefreshEndpoint refreshEndpoint(ContextRefresher contextRefresher) {
* @return the refresh event listener
*/
@Bean
@ConditionalOnProperty(prefix = "cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = "firefly.cloud.config", name = "refresh-enabled", havingValue = "true", matchIfMissing = true)
public ApplicationListener<RefreshScopeRefreshedEvent> refreshEventListener() {
return event -> log.info("Configuration refreshed: {}", event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
* Configuration properties for Spring Cloud Config.
Expand All @@ -31,8 +30,7 @@
* Properties can be configured in application.yml or application.properties using
* the prefix "cloud.config".
*/
@Configuration
@ConfigurationProperties(prefix = "cloud.config")
@ConfigurationProperties(prefix = "firefly.cloud.config")
@Getter
@Setter
public class CloudConfigProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* client dependency is present and the service.registry.enabled property is set to true.
*/
@Configuration
@ConditionalOnProperty(prefix = "service.registry", name = "enabled", havingValue = "true")
@ConditionalOnProperty(prefix = "firefly.service.registry", name = "enabled", havingValue = "true")
@EnableConfigurationProperties(ServiceRegistryProperties.class)
@Slf4j
public class ServiceRegistryAutoConfiguration {
Expand All @@ -63,7 +63,7 @@ public ServiceRegistryAutoConfiguration(ServiceRegistryProperties properties, En
*/
@Configuration
@ConditionalOnClass(name = "org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration")
@ConditionalOnProperty(prefix = "service.registry", name = "type", havingValue = "EUREKA", matchIfMissing = true)
@ConditionalOnProperty(prefix = "firefly.service.registry", name = "type", havingValue = "EUREKA", matchIfMissing = true)
public static class EurekaClientConfiguration {

private final ServiceRegistryProperties properties;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void configureEurekaClient() {
*/
@Configuration
@ConditionalOnClass(name = "org.springframework.cloud.consul.discovery.ConsulDiscoveryClientConfiguration")
@ConditionalOnProperty(prefix = "service.registry", name = "type", havingValue = "CONSUL")
@ConditionalOnProperty(prefix = "firefly.service.registry", name = "type", havingValue = "CONSUL")
public static class ConsulClientConfiguration {

private final ServiceRegistryProperties properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
* Configuration properties for service registry.
Expand All @@ -32,8 +31,7 @@
* Properties can be configured in application.yml or application.properties using
* the prefix "service.registry".
*/
@Configuration
@ConfigurationProperties(prefix = "service.registry")
@ConfigurationProperties(prefix = "firefly.service.registry")
@Getter
@Setter
public class ServiceRegistryProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.fireflyframework.core.logging.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
* Configuration properties for the enhanced structured logging system.
Expand All @@ -29,8 +28,7 @@
* Properties can be configured in application.yml or application.properties using the
* 'logging' prefix.
*/
@Component
@ConfigurationProperties(prefix = "logging")
@ConfigurationProperties(prefix = "firefly.logging")
public class LoggingProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Arrays;

@Service
@Slf4j
@RequiredArgsConstructor
public class WebClientTemplate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* <li><strong>Bulkhead:</strong> Limits the number of concurrent calls to a service</li>
* </ul>
*/
@ConfigurationProperties(prefix = "webclient.resilience")
@ConfigurationProperties(prefix = "firefly.webclient.resilience")
@Getter
@Setter
public class WebClientResilienceProperties {
Expand Down