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

com.binarywang.solon.wxjava.open.config.WxOpenServiceAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 4.7.1.B
Show newest version
package com.binarywang.solon.wxjava.open.config;

import me.chanjar.weixin.open.api.WxOpenComponentService;
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
import me.chanjar.weixin.open.api.WxOpenService;
import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter;
import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;

/**
 * 微信开放平台相关服务自动注册.
 *
 * @author someone
 */
@Configuration
public class WxOpenServiceAutoConfiguration {

  @Bean
  @Condition(onMissingBean = WxOpenService.class, onBean = WxOpenConfigStorage.class)
  public WxOpenService wxOpenService(WxOpenConfigStorage wxOpenConfigStorage) {
    WxOpenService wxOpenService = new WxOpenServiceImpl();
    wxOpenService.setWxOpenConfigStorage(wxOpenConfigStorage);
    return wxOpenService;
  }

  @Bean
  public WxOpenMessageRouter wxOpenMessageRouter(WxOpenService wxOpenService) {
    return new WxOpenMessageRouter(wxOpenService);
  }

  @Bean
  public WxOpenComponentService wxOpenComponentService(WxOpenService wxOpenService) {
    return wxOpenService.getWxOpenComponentService();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy