mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-07 14:17:47 +08:00
🔨 规范代码
This commit is contained in:
parent
44b3680a3f
commit
3a1fae639a
@ -5,6 +5,11 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* .
|
||||||
|
*
|
||||||
|
* @author someone
|
||||||
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(WxMpProperties.class)
|
@EnableConfigurationProperties(WxMpProperties.class)
|
||||||
@Import({WxMpStorageAutoConfiguration.class, WxMpServiceAutoConfiguration.class})
|
@Import({WxMpStorageAutoConfiguration.class, WxMpServiceAutoConfiguration.class})
|
||||||
|
@ -12,7 +12,9 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信公众号相关服务自动注册
|
* 微信公众号相关服务自动注册.
|
||||||
|
*
|
||||||
|
* @author someone
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WxMpServiceAutoConfiguration {
|
public class WxMpServiceAutoConfiguration {
|
||||||
|
@ -2,6 +2,7 @@ package com.binarywang.spring.starter.wxjava.mp.config;
|
|||||||
|
|
||||||
import com.binarywang.spring.starter.wxjava.mp.properties.RedisProperties;
|
import com.binarywang.spring.starter.wxjava.mp.properties.RedisProperties;
|
||||||
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
|
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
|
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
|
||||||
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
||||||
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
|
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
|
||||||
@ -13,13 +14,14 @@ import redis.clients.jedis.JedisPool;
|
|||||||
import redis.clients.jedis.JedisPoolConfig;
|
import redis.clients.jedis.JedisPoolConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信公众号存储策略自动配置
|
* 微信公众号存储策略自动配置.
|
||||||
|
*
|
||||||
|
* @author someone
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class WxMpStorageAutoConfiguration {
|
public class WxMpStorageAutoConfiguration {
|
||||||
|
private final WxMpProperties properties;
|
||||||
@Autowired
|
|
||||||
private WxMpProperties properties;
|
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private JedisPool jedisPool;
|
private JedisPool jedisPool;
|
||||||
|
@ -5,33 +5,36 @@ import lombok.Data;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redis配置
|
* Redis配置.
|
||||||
|
*
|
||||||
|
* @author someone
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RedisProperties implements Serializable {
|
public class RedisProperties implements Serializable {
|
||||||
|
private static final long serialVersionUID = -5924815351660074401L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机地址
|
* 主机地址.
|
||||||
*/
|
*/
|
||||||
private String host = "127.0.0.1";
|
private String host = "127.0.0.1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 端口号
|
* 端口号.
|
||||||
*/
|
*/
|
||||||
private int port = 6379;
|
private int port = 6379;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码.
|
||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 超时
|
* 超时.
|
||||||
*/
|
*/
|
||||||
private int timeout = 2000;
|
private int timeout = 2000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库
|
* 数据库.
|
||||||
*/
|
*/
|
||||||
private int database = 0;
|
private int database = 0;
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@ import static com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties.
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信接入相关配置属性
|
* 微信接入相关配置属性.
|
||||||
|
*
|
||||||
|
* @author someone
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ConfigurationProperties(PREFIX)
|
@ConfigurationProperties(PREFIX)
|
||||||
@ -18,33 +20,34 @@ public class WxMpProperties {
|
|||||||
public static final String PREFIX = "wx.mp";
|
public static final String PREFIX = "wx.mp";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置微信公众号的appid
|
* 设置微信公众号的appid.
|
||||||
*/
|
*/
|
||||||
private String appId;
|
private String appId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置微信公众号的app secret
|
* 设置微信公众号的app secret.
|
||||||
*/
|
*/
|
||||||
private String secret;
|
private String secret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置微信公众号的token
|
* 设置微信公众号的token.
|
||||||
*/
|
*/
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置微信公众号的EncodingAESKey
|
* 设置微信公众号的EncodingAESKey.
|
||||||
*/
|
*/
|
||||||
private String aesKey;
|
private String aesKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储策略, memory, redis
|
* 存储策略, memory, redis.
|
||||||
*/
|
*/
|
||||||
private ConfigStorage configStorage = new ConfigStorage();
|
private ConfigStorage configStorage = new ConfigStorage();
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class ConfigStorage implements Serializable {
|
public static class ConfigStorage implements Serializable {
|
||||||
|
private static final long serialVersionUID = 4815731027000065434L;
|
||||||
|
|
||||||
private StorageType type = memory;
|
private StorageType type = memory;
|
||||||
|
|
||||||
@ -53,6 +56,13 @@ public class WxMpProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum StorageType {
|
public enum StorageType {
|
||||||
memory, redis
|
/**
|
||||||
|
* 内存.
|
||||||
|
*/
|
||||||
|
memory,
|
||||||
|
/**
|
||||||
|
* redis.
|
||||||
|
*/
|
||||||
|
redis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user