Spring Security + Sleuth
This commit is contained in:
parent
63897863b3
commit
c2eced0d66
16 changed files with 140 additions and 2 deletions
|
|
@ -59,6 +59,15 @@
|
|||
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-sleuth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.mproduits;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import com.mproduits.configurations.ApplicationPropertiesConfiguration;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties
|
||||
|
|
@ -14,4 +16,9 @@ public class MproduitsApplication {
|
|||
public static void main(String[] args) {
|
||||
SpringApplication.run(MproduitsApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Sampler defaultSampler(){
|
||||
return Sampler.ALWAYS_SAMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.mproduits.configurations;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SleuthConfig {
|
||||
|
||||
|
||||
public Sampler defaultSampler(){
|
||||
return Sampler.ALWAYS_SAMPLE;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.mproduits.configurations.ApplicationPropertiesConfiguration;
|
|||
import com.mproduits.dao.ProductDao;
|
||||
import com.mproduits.model.Product;
|
||||
import com.mproduits.web.exceptions.ProductNotFoundException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
@ -19,6 +21,9 @@ public class ProductController {
|
|||
@Autowired
|
||||
ProductDao productDao;
|
||||
|
||||
|
||||
Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
ApplicationPropertiesConfiguration appProperties;
|
||||
|
||||
|
|
@ -32,6 +37,9 @@ public class ProductController {
|
|||
|
||||
List<Product> listeLimitee = products.subList(0, appProperties.getLimitDeProduits());
|
||||
|
||||
|
||||
log.info("Récupération de la liste des produits");
|
||||
|
||||
return listeLimitee;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue