-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6db0d48
commit 20c32e6
Showing
27 changed files
with
173 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...nce-tests/src/test/groovy/io/spring/cloud/samples/brewery/acceptance/common/SpanUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
brewing/src/main/java/io/spring/cloud/samples/brewery/BrewingApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,18 @@ | ||
package io.spring.cloud.samples.brewery; | ||
|
||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.Executors; | ||
|
||
import io.micrometer.context.ContextSnapshot; | ||
import io.spring.cloud.samples.brewery.common.TestConfiguration; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.openfeign.EnableFeignClients; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
|
||
@SpringBootApplication | ||
@EnableAsync | ||
@EnableFeignClients | ||
@Import(TestConfiguration.class) | ||
public class BrewingApplication { | ||
|
||
public static void main(String[] args) { | ||
new SpringApplication(BrewingApplication.class).run(args); | ||
} | ||
|
||
|
||
/** | ||
* NAME OF THE BEAN IS IMPORTANT! | ||
* | ||
* We need to wrap this for Async related things to propagate the context. | ||
* | ||
* @see EnableAsync | ||
*/ | ||
@Bean | ||
Executor taskExecutor() { | ||
return ContextSnapshot.captureAll().wrapExecutorService(Executors.newCachedThreadPool()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
brewing/src/main/java/io/spring/cloud/samples/brewery/common/CommonConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.spring.cloud.samples.brewery.common; | ||
|
||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.Executors; | ||
|
||
import io.micrometer.context.ContextSnapshot; | ||
|
||
import org.springframework.boot.web.client.RestTemplateBuilder; | ||
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.AsyncConfigurer; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@Configuration(proxyBeanMethods = false) | ||
class CommonConfiguration { | ||
|
||
@Bean | ||
@LoadBalanced | ||
RestTemplate loadBalancedRestTemplate(RestTemplateBuilder restTemplateBuilder) { | ||
return restTemplateBuilder.build(); | ||
} | ||
|
||
@Configuration | ||
@EnableAsync | ||
static class AsyncConfig implements AsyncConfigurer { | ||
@Override | ||
public Executor getAsyncExecutor() { | ||
return ContextSnapshot.captureAll().wrapExecutorService(Executors.newCachedThreadPool()); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* NAME OF THE BEAN IS IMPORTANT! | ||
* | ||
* We need to wrap this for Async related things to propagate the context. | ||
* | ||
* @see EnableAsync | ||
*/ | ||
@Bean(name = "taskExecutor") | ||
Executor taskExecutor() { | ||
return ContextSnapshot.captureAll().wrapExecutorService(Executors.newCachedThreadPool()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.