Commit a320e4c5 authored by Alex Segers's avatar Alex Segers

[AFP-91] 🎨 Create custom annotations & resolvers for 'ManagerController' (@asegers)

parent 4493d085
Pipeline #1702 failed with stage
in 39 seconds
package com.afp.ordermanagement.config;
import com.afp.ordermanagement.annotation.AccessTokenResolver;
import com.afp.ordermanagement.annotation.ManagerPayloadResolver;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
import org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer;
@Configuration
//@ConditionalOnClass(EnableWebFlux.class) // checks that WebFlux is on the classpath
//@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
//@EnableWebFlux
public class AnnotationConfig implements WebFluxConfigurer {
@Override
public void configureArgumentResolvers(ArgumentResolverConfigurer configurer) {
configurer.addCustomResolver(accessTokenResolver());
configurer.addCustomResolver(managerPayloadResolver());
}
@Bean
public AccessTokenResolver accessTokenResolver() {
return new AccessTokenResolver();
}
@Bean
public ManagerPayloadResolver managerPayloadResolver() {
return new ManagerPayloadResolver();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment