Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
9f9b5b04
Commit
9f9b5b04
authored
Dec 14, 2021
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
替换文件
parent
ba76251f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
37 deletions
+38
-37
MultipartSupportConfig.java
...com/yeejoin/amos/patrol/feign/MultipartSupportConfig.java
+37
-37
PushFeign.java
...rc/main/java/com/yeejoin/amos/patrol/feign/PushFeign.java
+1
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/feign/MultipartSupportConfig.java
View file @
9f9b5b04
package
com
.
yeejoin
.
amos
.
patrol
.
feign
;
import
feign.codec.Encoder
;
import
feign.form.spring.SpringFormEncoder
;
import
org.springframework.beans.factory.ObjectFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.http.HttpMessageConverters
;
import
org.springframework.cloud.openfeign.support.SpringEncoder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.request.RequestContextListener
;
/**
* @Author: xinglei
* @Description:
* @Date: 2020/3/30 16:26
*/
@Configuration
public
class
MultipartSupportConfig
{
@Autowired
private
ObjectFactory
<
HttpMessageConverters
>
messageConverters
;
@Bean
public
Encoder
feignFormEncoder
()
{
return
new
SpringFormEncoder
(
new
SpringEncoder
(
messageConverters
));
}
/**
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
* @return
*/
@Bean
public
RequestContextListener
requestInterceptor
()
{
return
new
RequestContextListener
();
}
}
//
package com.yeejoin.amos.patrol.feign;
//
//
import feign.codec.Encoder;
//
import feign.form.spring.SpringFormEncoder;
//
import org.springframework.beans.factory.ObjectFactory;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
//
import org.springframework.cloud.openfeign.support.SpringEncoder;
//
import org.springframework.context.annotation.Bean;
//
import org.springframework.context.annotation.Configuration;
//
import org.springframework.web.context.request.RequestContextListener;
//
/
//
**
//
* @Author: xinglei
//
* @Description:
//
* @Date: 2020/3/30 16:26
//
*/
//
@Configuration
//
public class MultipartSupportConfig {
//
//
@Autowired
//
private ObjectFactory<HttpMessageConverters> messageConverters;
//
//
@Bean
//
public Encoder feignFormEncoder() {
//
return new SpringFormEncoder(new SpringEncoder(messageConverters));
//
}
//
//
/**
//
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
//
* @return
//
*/
//
@Bean
//
public RequestContextListener requestInterceptor() {
//
return new RequestContextListener();
//
}
//
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/feign/PushFeign.java
View file @
9f9b5b04
package
com
.
yeejoin
.
amos
.
patrol
.
feign
;
import
com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment