提交 f662397f 编写于 作者: 武汉红喜's avatar 武汉红喜

update package name

上级 ba98f856
......@@ -17,6 +17,7 @@
</parent>
<properties>
<start-class>com.whatsmars.springcloud.consumer.ConsumerApplication</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
......
package com.itlong.whatsmars.springcloud.consumer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/**
* Created by shenhongxi on 2017/9/14.
*/
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class ConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
@Bean
@LoadBalanced
RestTemplate restTemplate() {
return new RestTemplate();
}
}
package com.itlong.whatsmars.springcloud.consumer.controller;
package com.whatsmars.springcloud.consumer.controller;
import com.itlong.whatsmars.springcloud.consumer.feign.DemoFeign;
import com.whatsmars.springcloud.consumer.feign.DemoFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......
package com.whatsmars.springcloud.consumer.feign;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by shenhongxi on 2017/9/14.
*/
@FeignClient("demo-provider")
public interface DemoFeign {
@RequestMapping("/hello")
String hello(@RequestParam(name = "name") String name); // 此处必须有RequestParam
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册