Skip to content

Commit

Permalink
Reduce need for bean method proxying and disable where not needed.
Browse files Browse the repository at this point in the history
Closes gh-360.
  • Loading branch information
mp911de committed Oct 21, 2019
1 parent 62f8be6 commit b89e7d2
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* @author Mark Paluch
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(VaultAwsProperties.class)
public class VaultConfigAwsBootstrapConfiguration {

Expand Down Expand Up @@ -65,7 +65,7 @@ static SecretBackendMetadata forAws(final VaultAwsProperties properties) {

Assert.notNull(properties, "VaultAwsProperties must not be null");

final PropertyNameTransformer transformer = new PropertyNameTransformer();
PropertyNameTransformer transformer = new PropertyNameTransformer();
transformer.addKeyTransformation("access_key",
properties.getAccessKeyProperty());
transformer.addKeyTransformation("secret_key",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void shouldApplyCustomConfiguration() {
assertThat(metadata.getPath()).isEqualTo(this.properties.getRole());
}

@Configuration
@Configuration(proxyBeanMethods = false)
public static class CustomBootstrapConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* @author Mark Paluch
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(VaultConsulProperties.class)
public class VaultConfigConsulBootstrapConfiguration {

Expand Down Expand Up @@ -63,7 +63,7 @@ static SecretBackendMetadata forConsul(final VaultConsulProperties properties) {

Assert.notNull(properties, "VaultConsulProperties must not be null");

final PropertyNameTransformer transformer = new PropertyNameTransformer();
PropertyNameTransformer transformer = new PropertyNameTransformer();
transformer.addKeyTransformation("token", properties.getTokenProperty());

return new SecretBackendMetadata() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void shouldApplyCustomConfiguration() {
assertThat(metadata.getPath()).isEqualTo(this.properties.getRole());
}

@Configuration
@Configuration(proxyBeanMethods = false)
public static class CustomBootstrapConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @author Per Abich
* @author Sebastien Nahelou
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties({ VaultMySqlProperties.class,
VaultPostgreSqlProperties.class, VaultCassandraProperties.class,
VaultMongoProperties.class, VaultDatabaseProperties.class })
Expand Down Expand Up @@ -71,7 +71,7 @@ static SecretBackendMetadata forDatabase(

Assert.notNull(properties, "DatabaseSecretProperties must not be null");

final PropertyNameTransformer transformer = new PropertyNameTransformer();
PropertyNameTransformer transformer = new PropertyNameTransformer();
transformer.addKeyTransformation("username",
properties.getUsernameProperty());
transformer.addKeyTransformation("password",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void shouldApplyCustomConfiguration() {
assertThat(metadata.getPath()).isEqualTo(this.properties.getRole());
}

@Configuration
@Configuration(proxyBeanMethods = false)
public static class CustomBootstrapConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* @author Mark Paluch
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties
public class VaultConfigRabbitMqBootstrapConfiguration {

Expand Down Expand Up @@ -71,7 +71,7 @@ static SecretBackendMetadata forRabbitMq(

Assert.notNull(properties, "VaultRabbitMqProperties must not be null");

final PropertyNameTransformer transformer = new PropertyNameTransformer();
PropertyNameTransformer transformer = new PropertyNameTransformer();
transformer.addKeyTransformation("username",
properties.getUsernameProperty());
transformer.addKeyTransformation("password",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void shouldApplyCustomConfiguration() {
assertThat(metadata.getPath()).isEqualTo(this.properties.getRole());
}

@Configuration
@Configuration(proxyBeanMethods = false)
public static class CustomBootstrapConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @author Mark Paluch
* @since 1.1
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty("spring.cloud.vault.discovery.enabled")
@EnableConfigurationProperties(VaultProperties.class)
@Order(Ordered.LOWEST_PRECEDENCE - 2)
Expand Down Expand Up @@ -69,9 +69,8 @@ public VaultServiceInstanceProvider vaultServerInstanceProvider(
public VaultEndpointProvider vaultEndpointProvider(
VaultServiceInstanceProvider instanceProvider) {

final String serviceId = this.vaultProperties.getDiscovery().getServiceId();

final String fallbackScheme;
String serviceId = this.vaultProperties.getDiscovery().getServiceId();
String fallbackScheme;

if (StringUtils.hasText(this.vaultProperties.getUri())) {
fallbackScheme = URI.create(this.vaultProperties.getUri()).getScheme();
Expand All @@ -82,7 +81,7 @@ public VaultEndpointProvider vaultEndpointProvider(

ServiceInstance server = instanceProvider.getVaultServerInstance(serviceId);

final VaultEndpoint vaultEndpoint = VaultEndpoint.create(server.getHost(),
VaultEndpoint vaultEndpoint = VaultEndpoint.create(server.getHost(),
server.getPort());

if (server.getMetadata().containsKey("scheme")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* @author Spencer Gibb
* @author Mark Paluch
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.vault.enabled", matchIfMissing = true)
@EnableConfigurationProperties(VaultProperties.class)
@Order(Ordered.LOWEST_PRECEDENCE - 5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @author Mårten Svantesson
* @since 1.1
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.vault.enabled", matchIfMissing = true)
@EnableConfigurationProperties({ VaultGenericBackendProperties.class,
VaultKeyValueBackendProperties.class })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @author Mark Paluch
* @since 2.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnEnabledHealthIndicator("vault")
@ConditionalOnBean(VaultBootstrapConfiguration.class)
@ConditionalOnClass(HealthIndicator.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @author Mark Paluch
* @since 1.1
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(VaultOperations.class)
class VaultHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration<VaultHealthIndicator, VaultOperations> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
* @author Mark Paluch
* @since 2.0.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.vault.enabled", matchIfMissing = true)
@ConditionalOnExpression("${spring.cloud.vault.reactive.enabled:true}")
@ConditionalOnClass({ Flux.class, WebClient.class, ReactiveVaultOperations.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @author Mark Paluch
* @since 2.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Flux.class)
@ConditionalOnBean(ReactiveVaultOperations.class)
class VaultReactiveHealthIndicatorConfiguration extends
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void shouldNotRegisterBeansIfVaultDisabled() {

}

@Configuration
@Configuration(proxyBeanMethods = false)
static class DiscoveryConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static void main(String[] args) {

}

@Configuration
@Configuration(proxyBeanMethods = false)
public static class BootstrapConfiguration {

@ConditionalOnProperty("VaultConfigAppIdCustomMechanismTests.custom.config")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void shouldNotConfigureReactiveSupport() {
});
}

@Configuration
@Configuration(proxyBeanMethods = false)
static class AuthenticationFactoryConfiguration {

@Bean
Expand All @@ -119,7 +119,7 @@ AuthenticationStepsFactory authenticationStepsFactory() {

}

@Configuration
@Configuration(proxyBeanMethods = false)
static class TokenSupplierConfiguration {

@Bean
Expand Down

0 comments on commit b89e7d2

Please sign in to comment.