org.zodiac.autoconfigure.web.crypto.ServletWebApiCryptoAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.web.crypto;
import java.util.List;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.context.annotation.Bean;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.zodiac.autoconfigure.web.PlatformApiCryptoProperties;
@SpringBootConfiguration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {org.zodiac.core.web.remote.crypto.config.PlatformApiCryptoInfo.class})
@ConditionalOnProperty(value = org.zodiac.core.web.remote.crypto.constants.ApiCryptoSystemPropertiesConstants.PLATFORM_API_CRYPTO_ENABLED, havingValue = "true")
public class ServletWebApiCryptoAutoConfiguration implements WebMvcConfigurer {
private final PlatformApiCryptoProperties platformApiCryptoProperties;
public ServletWebApiCryptoAutoConfiguration(PlatformApiCryptoProperties platformApiCryptoProperties) {
this.platformApiCryptoProperties = platformApiCryptoProperties;
}
@Override
public void addArgumentResolvers(List argumentResolvers) {
argumentResolvers.add(new org.zodiac.core.web.remote.crypto.core.servlet.ApiDecryptParamResolver(platformApiCryptoProperties));
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.core.web.remote.crypto.core.servlet.ApiDecryptRequestBodyAdvice apiDecryptRequestBodyAdvice() {
return new org.zodiac.core.web.remote.crypto.core.servlet.ApiDecryptRequestBodyAdvice(platformApiCryptoProperties);
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.core.web.remote.crypto.core.servlet.ApiEncryptResponseBodyAdvice apiEncryptResponseBodyAdvice() {
return new org.zodiac.core.web.remote.crypto.core.servlet.ApiEncryptResponseBodyAdvice(platformApiCryptoProperties);
}
}