cn.herodotus.engine.access.wxapp.configuration.AccessWxappConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of access-sdk-wxapp Show documentation
Show all versions of access-sdk-wxapp Show documentation
基于 Spring Authorization Server 的 微信小程序外部接入基础核心组件模块
The newest version!
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2020-2030 郑庚伟 ZHENGGENGWEI (码匠君), Licensed under the AGPL License
*
* This file is part of Herodotus Engine.
*
* Herodotus Engine is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Herodotus Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package cn.herodotus.engine.access.wxapp.configuration;
import cn.herodotus.engine.access.wxapp.annotation.ConditionalOnWxappEnabled;
import cn.herodotus.engine.access.wxapp.processor.WxappAccessHandler;
import cn.herodotus.engine.access.wxapp.processor.WxappLogHandler;
import cn.herodotus.engine.access.wxapp.processor.WxappProcessor;
import cn.herodotus.engine.access.wxapp.properties.WxappProperties;
import cn.herodotus.engine.assistant.core.enums.AccountType;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Description: 微信小程序后配置
*
* @author : gengwei.zheng
* @date : 2021/3/29 9:27
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnWxappEnabled
@EnableConfigurationProperties(WxappProperties.class)
public class AccessWxappConfiguration {
private static final Logger log = LoggerFactory.getLogger(AccessWxappConfiguration.class);
@PostConstruct
public void init() {
log.debug("[Herodotus] |- SDK [Access Wxapp] Auto Configure.");
}
@Bean
@ConditionalOnMissingBean
public WxappProcessor wxappProcessor(WxappProperties wxappProperties) {
WxappProcessor wxappProcessor = new WxappProcessor(wxappProperties);
log.trace("[Herodotus] |- Bean [Wxapp Processor] Configure.");
return wxappProcessor;
}
@Bean(AccountType.WECHAT_MINI_APP_HANDLER)
@ConditionalOnBean(WxappProcessor.class)
@ConditionalOnMissingBean
public WxappAccessHandler wxappAccessHandler(WxappProcessor wxappProcessor) {
WxappAccessHandler wxappAccessHandler = new WxappAccessHandler(wxappProcessor);
log.debug("[Herodotus] |- Bean [Wxapp Access Handler] Auto Configure.");
return wxappAccessHandler;
}
}