package org.springframework.order;
import com.alibaba.cloud.nacos.ribbon.NacosRule;
import com.netflix.loadbalancer.IRule;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import java.util.stream.Collectors;
@SpringBootApplication
@EnableDiscoveryClient//开启服务注册发现功能
@EnableFeignClients({ "org.springframework.order.service" })
public class OrderApplication
{
/**
* 使用 openFeign的时候必须加入这个,
* 否则会报错: No qualifying bean of type 'org.springframework.boot.autoconfigure.http.HttpMessageConverters' available:
* @param converters
* @return
*/
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters(ObjectProvider<HttpMessageConverter<?>> converters) {
return new HttpMessageConverters(converters.orderedStream().collect(Collectors.toList()));
}
public static void main( String[] args )
{
SpringApplication.run(OrderApplication.class);
System.err.println("=========OrderApplication start successfully=========");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
微服务 : SpringCloud + Nacos + Feign
共20个文件
xml:9个
java:6个
properties:2个
5星 · 超过95%的资源 需积分: 22 8 下载量 15 浏览量
2022-08-10
17:59:01
上传
评论 1
收藏 19KB ZIP 举报
温馨提示
微服务示例,下载下来可用; 服务注册,资源互相调用等,都有实现; parent pom中不要制定version,让工程自己匹配最佳版本号
资源详情
资源评论
资源推荐
收起资源包目录
SpringCloudNacos.zip (20个子文件)
SpringCloudNacos
pom.xml 4KB
cloud-order
pom.xml 1KB
src
test
java
main
resources
application.properties 297B
bootstrap.yml 516B
java
org
springframework
order
OrderApplication.java 2KB
Controller
TestReadNacosConfigController.java 2KB
FeignTestController.java 727B
service
OrderService.java 446B
.idea
uiDesigner.xml 9KB
ZeppelinRemoteNotebooks
misc.xml 541B
jarRepositories.xml 2KB
encodings.xml 537B
compiler.xml 923B
workspace.xml 6KB
.gitignore 237B
cloud-server
pom.xml 3KB
src
test
java
main
resources
application.properties 302B
bootstrap.yml 518B
java
org
server
ServerApplication.java 2KB
Controller
TestController.java 429B
共 20 条
- 1
xhaoDream
- 粉丝: 19
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论10