Skip to content

Commit

Permalink
nexus-staging-maven-plugin serverId
Browse files Browse the repository at this point in the history
  • Loading branch information
chentianming11 committed Apr 4, 2020
1 parent 8593897 commit 4602e6a
Show file tree
Hide file tree
Showing 26 changed files with 2,032 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<serverId>oss</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.github.lianjiatech.retrofit.plus.boot;


import com.alibaba.fastjson.support.retrofit.Retrofit2ConverterFactory;
import com.github.lianjiatech.retrofit.plus.core.BodyCallAdapterFactory;
import com.github.lianjiatech.retrofit.plus.core.ResponseCallAdapterFactory;
import com.github.lianjiatech.retrofit.plus.config.Config;
import com.github.lianjiatech.retrofit.plus.config.PoolConfig;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Map;

/**
* 这个类存在的主要目的是方便 IDE 自动提示开头的配置
*
* @author 陈添明
*/
@Data
@ConfigurationProperties(prefix = Config.PREFIX)
public class RetrofitProperties {

/**
* 连接池配置
*/
private Map<String, PoolConfig> pool;

/**
* 启用 #{@link BodyCallAdapterFactory} 调用适配器
*/
private boolean enableBodyCallAdapter = true;

/**
* 启用 #{@link ResponseCallAdapterFactory} 调用适配器
*/
private boolean enableResponseCallAdapter = true;

/**
* 启用 #{@link Retrofit2ConverterFactory} 数据转换器
*/
private boolean enableFastJsonConverter = true;

/**
* 启用日志打印
*/
private boolean enableLog = true;

/**
* 禁用Void返回类型
*/
private boolean disableVoidReturnType = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.github.lianjiatech.retrofit.plus.annotation;

import com.github.lianjiatech.retrofit.plus.interceptor.BasePathMatchInterceptor;

import java.lang.annotation.*;

/**
* 自动将注解上的参数值赋值到handleInterceptor实例上
*
* @author 陈添明
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@InterceptMark
public @interface Intercept {
/**
* 拦截器匹配路径pattern
*
* @return 拦截器匹配路径pattern
*/
String[] include() default {"/**"};

/**
* 拦截器排除匹配,排除指定路径拦截 <br>
*
* @return 排除指定路径拦截pattern
*/
String[] exclude() default {};

/**
* 拦截器处理器 <br>
* 优先从spring容器获取对应的Bean,如果获取不到,则使用反射创建一个!<br>
* 如果以Bean的形式配置,scope必须是prototype <br>
*
* @return 拦截器处理器
*/
Class<? extends BasePathMatchInterceptor> handler();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.lianjiatech.retrofit.plus.annotation;

import java.lang.annotation.*;

/**
* <p>拦截标记注解<br>
* 标记一个注解是拦截器
*
* @author 陈添明
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
@Documented
public @interface InterceptMark {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.github.lianjiatech.retrofit.plus.annotation;

import com.github.lianjiatech.retrofit.plus.interceptor.LogStrategy;
import org.slf4j.event.Level;

import java.lang.annotation.*;

/**
* @author 陈添明
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface RetrofitClient {

/**
* 基础url, 支持占位符形式配置。<br>
* 例如:http://${baseUrl.test}
*
* @return RetrofitClient的baseUrl
*/
String baseUrl();

/**
* 使用的连接池名称<br>
* default连接池自动加载,也可以手动配置覆盖默认default连接池属性
*
* @return 使用的连接池名称
*/
String poolName() default "default";

/**
* 连接超时,单位为毫秒
*
* @return 连接超时时间
*/
int connectTimeoutMs() default 10_000;

/**
* 读取超时,单位为毫秒
*
* @return 读取超时时间
*/
int readTimeoutMs() default 10_000;

/**
* 写入超时,单位为毫秒
*
* @return 写入超时时间
*/
int writeTimeoutMs() default 10_000;

/**
* 日志打印级别,支持的日志级别参见{@link Level}
*
* @return 日志打印级别
*/
Level logLevel() default Level.INFO;

/**
* 日志打印策略,支持的日志打印策略参见{@link LogStrategy}
*
* @return 日志打印策略
*/
LogStrategy logStrategy() default LogStrategy.BASIC;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.github.lianjiatech.retrofit.plus.annotation;

import com.github.lianjiatech.retrofit.plus.core.RetrofitClientRegistrar;
import org.springframework.context.annotation.Import;

import java.lang.annotation.*;

/**
* @author 陈添明
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import(RetrofitClientRegistrar.class)
public @interface RetrofitScan {

/**
* <p>扫描包路径</p>
* 与basePackages含义相同
*
* @return 扫描包路径
*/
String[] value() default {};


/**
* <p>扫描包路径</p>
* 与value含义相同
*
* @return 扫描包路径
*/
String[] basePackages() default {};

/**
* 扫描的classes
*
* @return 扫描的classes
*/
Class<?>[] basePackageClasses() default {};

/**
* <p>
* 配置一个retrofitHelper的Bean实例名称
* </p>
* 如果该配置存在,会使用spring容器中对应的retrofitHelper的Bean实例属性来初始化retrofit <br>
* 如果该配置项为空,则使用上下文属性初始化retrofit
*
* @return retrofitHelper的Bean实例名称
*/
String retrofitHelperRef() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.github.lianjiatech.retrofit.plus.config;

import com.alibaba.fastjson.support.retrofit.Retrofit2ConverterFactory;
import com.github.lianjiatech.retrofit.plus.core.BodyCallAdapterFactory;
import com.github.lianjiatech.retrofit.plus.core.ResponseCallAdapterFactory;
import lombok.Data;

import java.util.Map;

/**
* @author 陈添明
*/
@Data
public class Config {

public static final String PREFIX = "retrofit-plus";

private Map<String, PoolConfig> pool;

/**
* 启用 #{@link BodyCallAdapterFactory} 调用适配器
*/
private boolean enableBodyCallAdapter = true;

/**
* 启用 #{@link ResponseCallAdapterFactory} 调用适配器
*/
private boolean enableResponseCallAdapter = true;

/**
* 启用 #{@link Retrofit2ConverterFactory} 数据转换器
*/
private boolean enableFastJsonConverter = true;
/**
* 启用日志打印
*/
private boolean enableLog = true;
/**
* 禁用java.lang.Void返回类型
*/
private boolean disableVoidReturnType = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.github.lianjiatech.retrofit.plus.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 连接池参数配置
*
* @author 陈添明
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PoolConfig {
/**
* 最大空闲连接
*/
private int maxIdleConnections = 5;

/**
* 保活时间,单位为秒
*/
private long keepAliveSecond = 300;
}
Loading

0 comments on commit 4602e6a

Please sign in to comment.