Skip to content

Commit

Permalink
Merge branch 'upgrade'
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Sep 24, 2016
2 parents f9f8d64 + 0d126ec commit 076719a
Show file tree
Hide file tree
Showing 51 changed files with 449 additions and 357 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext { springBootVersion = '1.2.1.RELEASE' }
ext { springBootVersion = '1.4.1.RELEASE' }
repositories { mavenCentral() }
dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -13,8 +12,11 @@
@RequestMapping("/{userId}/bookmarks")
public class BookmarkRestController {

@Autowired
private BookmarkRepository bookmarkRepository;
private final BookmarkRepository bookmarkRepository;

public BookmarkRestController(BookmarkRepository bookmarkRepository) {
this.bookmarkRepository = bookmarkRepository;
}

@RequestMapping(method = RequestMethod.GET)
public Collection<Bookmark> getBookmarks(@PathVariable String userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -13,8 +12,11 @@
@RequestMapping("/{userId}/contacts")
public class ContactRestController {

@Autowired
private ContactRepository contactRepository;
private final ContactRepository contactRepository;

public ContactRestController(ContactRepository contactRepository) {
this.contactRepository = contactRepository;
}

@RequestMapping(method = RequestMethod.GET)
public Collection<Contact> getContacts(@PathVariable String userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand All @@ -31,7 +42,10 @@
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>2.0.0.RC1</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-stream</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import reactor.rx.Stream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -11,8 +10,11 @@
@RestController
public class PassportRestController {

@Autowired
private PassportService passportService;
private final PassportService passportService;

public PassportRestController(PassportService passportService) {
this.passportService = passportService;
}

@RequestMapping("/{userId}/passport")
public DeferredResult<Passport> passport(@PathVariable String userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
import reactor.rx.Stream;
import reactor.rx.Streams;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PassportService {

@Autowired
private Environment environment;
private final Environment environment;

@Autowired
private ContactClient contactClient;
private final ContactClient contactClient;

@Autowired
private BookmarkClient bookmarkClient;
private final BookmarkClient bookmarkClient;

public PassportService(Environment environment, ContactClient contactClient,
BookmarkClient bookmarkClient) {
this.environment = environment;
this.contactClient = contactClient;
this.bookmarkClient = bookmarkClient;
}

public Stream<Bookmark> getBookmarks(String userId) {
return Streams.<Bookmark>create(subscriber -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
11 changes: 11 additions & 0 deletions livelessons-choreography/livelessons-choreography-hystrix/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
class IntegrationClient {

@Autowired
private ContactClient contactClient;
private final ContactClient contactClient;

@Autowired
private BookmarkClient bookmarkClient;
private final BookmarkClient bookmarkClient;

public IntegrationClient(ContactClient contactClient, BookmarkClient bookmarkClient) {
this.contactClient = contactClient;
this.bookmarkClient = bookmarkClient;
}

public Collection<Bookmark> getBookmarksFallback(String userId) {
System.out.println("getBookmarksFallback");
Expand All @@ -37,4 +39,4 @@ public Collection<Contact> getContacts(String userId) {
return this.contactClient.getContacts(userId);
}

}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
class PassportRestController {

@Autowired
private IntegrationClient integrationClient;
private final IntegrationClient integrationClient;

public PassportRestController(IntegrationClient integrationClient) {
this.integrationClient = integrationClient;
}

@RequestMapping("/{userId}/passport")
Passport passport(@PathVariable String userId) {
return new Passport(userId, this.integrationClient.getContacts(userId),
this.integrationClient.getBookmarks(userId));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
<properties>
<main.basedir>../..</main.basedir>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.commons.lang.builder.ToStringBuilder;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
Expand All @@ -13,8 +12,11 @@
@Component
public class DiscoveryClientExample implements CommandLineRunner {

@Autowired
private DiscoveryClient discoveryClient;
private final DiscoveryClient discoveryClient;

public DiscoveryClientExample(DiscoveryClient discoveryClient) {
this.discoveryClient = discoveryClient;
}

@Override
public void run(String... strings) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
Expand All @@ -9,11 +8,14 @@
@Component
public class FeignExample implements CommandLineRunner {

@Autowired
private ContactClient contactClient;
private final ContactClient contactClient;

@Autowired
private BookmarkClient bookmarkClient;
private final BookmarkClient bookmarkClient;

public FeignExample(ContactClient contactClient, BookmarkClient bookmarkClient) {
this.contactClient = contactClient;
this.bookmarkClient = bookmarkClient;
}

@Override
public void run(String... strings) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.annotation.Order;
Expand All @@ -15,8 +14,11 @@
@Component
public class RestTemplateExample implements CommandLineRunner {

@Autowired
private RestTemplate restTemplate;
private final RestTemplate restTemplate;

public RestTemplateExample(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}

@Override
public void run(String... strings) throws Exception {
Expand Down
Loading

0 comments on commit 076719a

Please sign in to comment.