All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.bitcoco.jsk.wechat.WeChatAutoConfiguration Maven / Gradle / Ivy

package ca.bitcoco.jsk.wechat;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "bitcoco.jsk.wechat")
@ConditionalOnProperty(name = "bitcoco.jsk.wechat.enabled", havingValue = "true")
public class WeChatAutoConfiguration {


    @Value("${bitcoco.jsk.wechat.open-app-id:-}")
    private String WX_OPEN_APP_ID;

    @Value("${bitcoco.jsk.wechat.open-app-secret:-}")
    private String WX_OPEN_APP_SECRET;


    @Value("${bitcoco.jsk.wechat.public-app-id:-}")
    private String WX_PUBLIC_APP_ID;

    @Value("${bitcoco.jsk.wechat.public-app-secret:-}")
    private String WX_PUBLIC_APP_SECRET;

    @Bean
    @ConditionalOnMissingBean
    public WeChatClient getWeChatClient() {
        return new WeChatClient(
                WX_OPEN_APP_ID,
                WX_OPEN_APP_SECRET,
                WX_PUBLIC_APP_ID,
                WX_PUBLIC_APP_SECRET
        );
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy