Skip to content

Commit

Permalink
-> http-client 2.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
shanhm1991 committed Feb 7, 2025
1 parent 82f1d39 commit 1847a16
Show file tree
Hide file tree
Showing 154 changed files with 7,483 additions and 2,432 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

name: build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Install cloc
run: sudo apt-get install -y cloc
- name: Count lines of code
run: cloc .
- name: Build with Maven
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: 25db9047-7c6d-461a-b63d-181a4749d6f2
slug: cowave5/http-client
file: ${{ github.workspace }}/target/site/jacoco/jacoco.xml

35 changes: 0 additions & 35 deletions .github/workflows/maven.yml

This file was deleted.

19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[![Build Status](https://github.com/cowave5/spring-feign/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/cowave5/spring-feign/actions)
![Static Badge](https://img.shields.io/badge/Java-17-brightgreen)
![Maven central](https://img.shields.io/badge/maven--central-2.7.4-brightgreen)
[![Build Status](https://github.com/cowave5/http-client/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/cowave5/http-client/actions)
![Static Badge](https://img.shields.io/badge/Java-1.8-brightgreen)
![Maven central](https://img.shields.io/badge/maven--central-2.7.5-brightgreen)
[![codecov.io](https://codecov.io/github/cowave5/http-client/coverage.svg?branch=master)](https://codecov.io/github/cowave5/http-client?branch=master)
[![License](https://img.shields.io/badge/license-Apache--2.0-brightgreen)](http://www.apache.org/licenses/LICENSE-2.0.txt)

## spring-feign
## http-client

一个Http调用客户端,依赖netflix feign实现,方便在spring中声明
HTTP客户端,参考Netflix Feign实现,使用的Apache Httpclient进行调用

- 依赖

```xml
<dependency>
<groupId>com.cowave.commons</groupId>
<artifactId>spring-feign</artifactId>
<version>2.7.4</version>
<artifactId>http-client</artifactId>
<version>2.7.5</version>
</dependency>
```

- 使用说明:[wiki](https://github.com/cowave5/spring-feign/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)
- 问题建议:[issues](https://github.com/cowave5/spring-feign/issues)
- 使用说明:[wiki](https://github.com/cowave5/http-client/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)
- 问题建议:[issues](https://github.com/cowave5/http-client/issues)
132 changes: 96 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.cowave.commons</groupId>
<artifactId>spring-feign</artifactId>
<version>2.7.4</version>
<artifactId>http-client</artifactId>
<version>2.7.5</version>
<packaging>jar</packaging>

<name>spring-feign</name>
<description>A simple http client, based on netflix feign</description>
<url>https://github.com/cowave5/spring-feign</url>
<name>http-client</name>
<description>A simple http client</description>
<url>https://github.com/cowave5/http-client</url>

<licenses>
<license>
Expand All @@ -21,13 +21,13 @@

<issueManagement>
<system>github</system>
<url>https://github.com/cowave5/spring-feign/issues</url>
<url>https://github.com/cowave5/http-client/issues</url>
</issueManagement>

<scm>
<url>[email protected]:cowave5/spring-feign.git</url>
<connection>scm:[email protected]:cowave5/spring-feign.git</connection>
<developerConnection>scm:[email protected]:cowave5/spring-feign.git</developerConnection>
<url>[email protected]:cowave5/http-client.git</url>
<connection>scm:[email protected]:cowave5/http-client.git</connection>
<developerConnection>scm:[email protected]:cowave5/http-client.git</developerConnection>
</scm>

<developers>
Expand Down Expand Up @@ -59,8 +59,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Expand All @@ -81,6 +81,32 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<phase>test-compile</phase>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -145,48 +171,82 @@

<dependencies>
<dependency>
<groupId>com.cowave.commons</groupId>
<artifactId>commons-response</artifactId>
<version>2.7.5</version>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<!-- commons-lang3 -->
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-core</artifactId>
<version>8.18.0</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<!-- commons-io -->
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-jackson</artifactId>
<version>8.18.0</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
</dependency>
<!-- commons-collections4 -->
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<!-- httpclient -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.7.0</version>
<scope>provided</scope>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<!-- httpmime -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.5</version>
<scope>provided</scope>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
</dependency>
<!-- commons-text -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<scope>provided</scope>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
</dependency>
<!-- transmittable-thread-local -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>2.14.2</version>
</dependency>
<!-- pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>6.1.0</version>
</dependency>
<!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.5.4.1</version>
</dependency>
<!-- provided -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.7.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.cowave.commons.client.http;

import com.cowave.commons.client.http.annotation.EnableHttpClient;
import com.cowave.commons.client.http.asserts.I18Messages;
import org.springframework.context.MessageSource;

import javax.annotation.Resource;

/**
*
* @author shanhuiming
*
*/
@EnableHttpClient
public class HttpConfiguration {

@Resource
public void setMessageSource(MessageSource messageSource) {
I18Messages.setMessageSource(messageSource);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.cowave.commons.client.http;

import com.cowave.commons.client.http.asserts.HttpException;

/**
*
* @author shanhuiming
*
*/
public interface HttpExceptionHandler {

void handle(HttpException e);
}
13 changes: 13 additions & 0 deletions src/main/java/com/cowave/commons/client/http/HttpInterceptor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.cowave.commons.client.http;

import com.cowave.commons.client.http.request.HttpRequest;

/**
*
* @author shanhuiming
*
*/
public interface HttpInterceptor {

void apply(HttpRequest httpRequest);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.cowave.commons.client.http;

/**
*
* @author shanhuiming
*
*/
public interface HttpServiceChooser {

String choose(String name);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.springframework.feign.annotation;
package com.cowave.commons.client.http.annotation;

import org.springframework.context.annotation.Import;
import org.springframework.feign.FeignBeanDefinitionRegistrar;
import com.cowave.commons.client.http.register.HttpClientBeanDefinitionRegistrar;

import java.lang.annotation.*;

Expand All @@ -16,7 +16,7 @@
@Target({TYPE})
@Retention(RUNTIME)
@Documented
@Import(FeignBeanDefinitionRegistrar.class)
public @interface EnableFeign {
@Import(HttpClientBeanDefinitionRegistrar.class)
public @interface EnableHttpClient {

}
Loading

0 comments on commit 1847a16

Please sign in to comment.