Class SpringBeanParameterResolver

java.lang.Object
io.fluxzero.sdk.configuration.spring.SpringBeanParameterResolver
All Implemented Interfaces:
io.fluxzero.common.handling.ParameterResolver<Object>

public class SpringBeanParameterResolver extends Object implements io.fluxzero.common.handling.ParameterResolver<Object>
Resolves handler method parameters annotated with Autowired from the Spring application context.

This resolver allows dependency injection of Spring-managed beans directly into handler methods. It supports both type-based and Qualifier-based resolution, and will prioritize beans marked as @Primary.

If no bean can be resolved unambiguously (e.g., multiple candidates and no qualifier or primary), the parameter is not injected and a warning is logged.

Example:


 @HandleCommand
 public void handle(MyCommand command, @Autowired MyService myService) {
     myService.performAction();
 }
 
  • Constructor Details

    • SpringBeanParameterResolver

      public SpringBeanParameterResolver()
  • Method Details

    • resolve

      public UnaryOperator<Object> resolve(Parameter p, Annotation methodAnnotation)
      Specified by:
      resolve in interface io.fluxzero.common.handling.ParameterResolver<Object>
    • matches

      public boolean matches(Parameter parameter, Annotation methodAnnotation, Object value)
      Specified by:
      matches in interface io.fluxzero.common.handling.ParameterResolver<Object>
    • computeParameterResolver

      protected UnaryOperator<Object> computeParameterResolver(Parameter p)
    • mayApply

      public boolean mayApply(Executable method, Class<?> targetClass)
      Specified by:
      mayApply in interface io.fluxzero.common.handling.ParameterResolver<Object>