2

I have two classes extending the same parent class; AbstractVaultConfiguration. My base classes @override the same two methods from AbstractVaultConfiguration which are clientAuthentication and and sessionManager.

The AbstractVaultConfiguration class is part of Spring Vault, which provides integration with HashiCorp Vault for Spring applications.

To use AbstractVaultConfiguration, I have included the Spring Vault dependency.

<dependency>
    <groupId>org.springframework.vault</groupId>
    <artifactId>spring-vault-core</artifactId>
    <version>3.1.2</version>  <!-- Use the latest version -->
</dependency>

This is the error obtained:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionManager' defined in class path resource [abc.class]: No matching factory method found on class [abc.MsConfig]: factory bean 'mssConfig'; factory method 'sessionManager()'. Check that a method with the specified name exists and that it is non-static.

Example:

@Configuration
public class A extends AbstractVaultConfiguration{
    @Override
    public VaultEndpoint vaultEndpoint(){
        // Some Custom Implementation
        ...
    }

    @Override
    @Bean
    public ClientAuthentication clientAuthentication(){
        // Some Custom Implementation
        ...
    }
    @Override
    public SessionManager sessionManager(){
        // Some Custom Implementation
        ...
    }
}

@Configuration
public class B extends AbstractVaultConfiguration{
    @Override
    public VaultEndpoint vaultEndpoint(){
        // Some Custom Implementation
        ...
    }

    @Override
    @Bean(name = "customClientAuthentication")
    public ClientAuthentication clientAuthentication(){
        // Some Custom Implementation
        ...
    }

    @Override
    @Bean(name = "customSessionManager")
    public SessionManager sessionManager(){
        // Some Custom Implementation
        ...
    }
}

I have tried removing @Override and changing the method names to customClientAuthentication and customSessionManager in class B. When I do this the build is successful and my code works as expected, however the same fails in my pod. I am using java 17 temurin.

4
  • Hello tharika, can you edit your question and add your class AbstractVaultConfiguration?. Commented Mar 7 at 14:24
  • Hi @MarcePuente , I have updated my question. Do Check it out. Commented Mar 7 at 17:12
  • I'm not sure if that's your whole problem, but in both classes you're missing implementing vaultEndpoint which is declared as abstract in AbstractVaultConfiguration. Commented Mar 7 at 18:11
  • vaultEndpoint is implemented in my code,I forgot to mention that. This issue is a bit strange since the same solution was working before we published the stable version of this JAR. Commented Mar 7 at 18:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.