BAEL-169 - grouping spring-cloud modules in a multi-maven project
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
package com.baeldung.spring.cloud.feign.client;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableEurekaClient
|
||||
@EnableFeignClients
|
||||
@Controller
|
||||
public class FeignClientApplication {
|
||||
@Autowired
|
||||
private GreetingClient greetingClient;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FeignClientApplication.class, args);
|
||||
}
|
||||
|
||||
@RequestMapping("/get-greeting")
|
||||
public String greeting(Model model) {
|
||||
model.addAttribute("greeting", greetingClient.greeting());
|
||||
return "greeting-view";
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.baeldung.spring.cloud.feign.client;
|
||||
|
||||
import com.baeldung.spring.cloud.eureka.client.GreetingController;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
|
||||
@FeignClient("spring-cloud-eureka-client")
|
||||
public interface GreetingClient extends GreetingController {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
spring:
|
||||
application:
|
||||
name: spring-cloud-eureka-feign-client
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Greeting Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2 th:text="${greeting}"/>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user