io.github.nichetoolkit.rest.configure.RestUtilsAutoConfigure Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-toolkit-utils Show documentation
Show all versions of rest-toolkit-utils Show documentation
Rest toolkit utils project for Spring Boot
The newest version!
package io.github.nichetoolkit.rest.configure;
import io.github.nichetoolkit.rest.worker.RadixWorker;
import io.github.nichetoolkit.rest.worker.jwt.JwtWorker;
import io.github.nichetoolkit.rest.worker.rsa.RsaWorker;
import io.github.nichetoolkit.rest.worker.sha.ShaWorker;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
/**
* RestUtilsAutoConfigure
* The rest utils auto configure class.
* @author Cyan ([email protected])
* @see lombok.extern.slf4j.Slf4j
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.context.annotation.ComponentScan
* @since Jdk1.8
*/
@Slf4j
@Configuration
@ComponentScan(basePackages = {"io.github.nichetoolkit.rest"})
public class RestUtilsAutoConfigure {
/**
* RestUtilsAutoConfigure
* Instantiates a new rest utils auto configure.
*/
public RestUtilsAutoConfigure() {
log.debug("The auto configuration for [rest-utils] initiated");
}
/**
* radixWorker
* The radix worker method.
* @param radixProperties {@link io.github.nichetoolkit.rest.configure.RestRadixProperties} The radix properties parameter is RestRadixProperties
type.
* @return {@link io.github.nichetoolkit.rest.worker.RadixWorker} The radix worker return object is RadixWorker
type.
* @see io.github.nichetoolkit.rest.configure.RestRadixProperties
* @see io.github.nichetoolkit.rest.worker.RadixWorker
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Primary
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
*/
@Bean
@Primary
@ConditionalOnMissingBean(RadixWorker.class)
@ConditionalOnProperty(value = "nichetoolkit.rest.radix.enabled", havingValue = "true", matchIfMissing = true)
public static RadixWorker radixWorker(RestRadixProperties radixProperties) {
return new RadixWorker(radixProperties);
}
/**
* jwtWorker
* The jwt worker method.
* @param jwtProperties {@link io.github.nichetoolkit.rest.configure.RestJwtProperties} The jwt properties parameter is RestJwtProperties
type.
* @return {@link io.github.nichetoolkit.rest.worker.jwt.JwtWorker} The jwt worker return object is JwtWorker
type.
* @see io.github.nichetoolkit.rest.configure.RestJwtProperties
* @see io.github.nichetoolkit.rest.worker.jwt.JwtWorker
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Primary
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
*/
@Bean
@Primary
@ConditionalOnMissingBean(JwtWorker.class)
@ConditionalOnProperty(value = "nichetoolkit.rest.jwt.enabled", havingValue = "true", matchIfMissing = true)
public static JwtWorker jwtWorker(RestJwtProperties jwtProperties) {
return new JwtWorker(jwtProperties);
}
/**
* shaWorker
* The sha worker method.
* @param shaProperties {@link io.github.nichetoolkit.rest.configure.RestShaProperties} The sha properties parameter is RestShaProperties
type.
* @return {@link io.github.nichetoolkit.rest.worker.sha.ShaWorker} The sha worker return object is ShaWorker
type.
* @see io.github.nichetoolkit.rest.configure.RestShaProperties
* @see io.github.nichetoolkit.rest.worker.sha.ShaWorker
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Primary
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
*/
@Bean
@Primary
@ConditionalOnMissingBean(ShaWorker.class)
@ConditionalOnProperty(value = "nichetoolkit.rest.sha.enabled", havingValue = "true", matchIfMissing = true)
public static ShaWorker shaWorker(RestShaProperties shaProperties) {
return new ShaWorker(shaProperties);
}
/**
* rsaWorker
* The rsa worker method.
* @param rsaProperties {@link io.github.nichetoolkit.rest.configure.RestRsaProperties} The rsa properties parameter is RestRsaProperties
type.
* @return {@link io.github.nichetoolkit.rest.worker.rsa.RsaWorker} The rsa worker return object is RsaWorker
type.
* @see io.github.nichetoolkit.rest.configure.RestRsaProperties
* @see io.github.nichetoolkit.rest.worker.rsa.RsaWorker
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Primary
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
* @see org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
*/
@Bean
@Primary
@ConditionalOnMissingBean(RsaWorker.class)
@ConditionalOnProperty(value = "nichetoolkit.rest.rsa.enabled", havingValue = "true", matchIfMissing = true)
public static RsaWorker rsaWorker(RestRsaProperties rsaProperties) {
return new RsaWorker(rsaProperties);
}
}