Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpMessageConverterExtractor (v. 5.3.22) not respecting response class / responds type of VaultResponses #653

Open
akuzni2 opened this issue Aug 29, 2022 · 1 comment

Comments

@akuzni2
Copy link

akuzni2 commented Aug 29, 2022

spring cloud version: 2021.0.3
spring version: 2.7.3 (Spring boot starter)

the vault library doesn't seem to be respecting the response type as it passes it in to HttpMessageConverterExtractor
internally.

** note** please look at the screenshots of my debugger - you will see that HttpMessageConverterExtractor cannot properly parse VaultResponses

Ex:

public class SomeClass {
}
@SpringBootApplication
public class VaultdebugApplication {
	@Bean void createBean() {
		List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
		messageConverters.add(new ByteArrayHttpMessageConverter());
		messageConverters.add(new StringHttpMessageConverter());
		messageConverters.add(new ResourceHttpMessageConverter(false));
		HttpMessageConverterExtractor x = new HttpMessageConverterExtractor(SomeClass.class, messageConverters);
	}
	public static void main(String[] args) {
		SpringApplication.run(VaultdebugApplication.class, args);
	}
}

the above works - HttpMessageConverterExtractor recognizes SomeClass.class as the response type one I trace it through the debugger.

image

however - when I try to read a secret from a vault Versioned backend (kv2) for whatever reason running the debugger at that same place shows that HttpMessageConverterExtractor will not recognize SomeClass.class.

@SpringBootApplication
public class VaultdebugApplication {
	@Bean
	public Secrets secrets(VaultTemplate operations) {
		VaultResponseSupport<SomeClass> response = operations.read("some/vault/path", SomeClass.class);
		System.out.println(response.getRequiredData()); // results in null
		System.out.println(response.getData()); // results in null

		return null;
	}
	public static void main(String[] args) {
		SpringApplication.run(VaultdebugApplication.class, args);
	}
}

image

in fact you can even see that - whatever is passed into Type responseType field isn't a class but an instance of VaultResponses.

@mp911de
Copy link
Member

mp911de commented Mar 28, 2023

Would you mind providing a complete minimal reproducer along with the data structures present in Vault so we can debug the issue on our own?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants