These are chat archives for spring-cloud/spring-cloud

3rd
Aug 2018
Thales Sousa
@tminussi
Aug 03 2018 05:51
image.png
@marcosbarbero they are both running in localhost. sometimes i run them using gradle bootRun and sometimes i just use intelliJ to boot them up separately, using 2 spring boot configurations, like the image above
CH4:D
@chad_d_stud_twitter
Aug 03 2018 06:26
Question, we already have like 13 microservices running on an AWS server. my problem is running those 13 services locally on my eclipse and sometimes it runs out of ram. we have a eureka server running on the aws server, i can configure my single local service to connect to it and i can see through the dashboard that my local service is there. However, when i try running some method that communicates with another service via feign client, it’s either slow or not connecting at all. Can anyone tell me if this scenario is possible at all?
Aneesh12369
@Aneesh12369
Aug 03 2018 07:11
@all Hi, I am using ResourceOwnerCredentials Grant type. I am using OAuth2RestTemplate to send request.I have hardcoded resource details and passed it to OAuth2RestTemplate at the time of bean creation. How can I do this dynamically as resource details changes (username and password) for every user.Please find below sample code
@SpringBootApplication
public class SpringcloudSecurecliApplication implements CommandLineRunner {

    @Autowired
    private OAuth2RestTemplate template;

    public static void main(String[] args) {
        SpringApplication.run(SpringcloudSecurecliApplication.class, args);
    }

    @Override
    public void run(String... arg0) throws Exception {

        System.out.println("cron job started");


        // could also get scopes: template.getAccessToken().getScope()
        String token = template.getAccessToken().toString();// .getValue();

        System.out.println("Token: " + token);

        String s = template.getForObject("http://localhost:9001/services/tolldata", String.class);

        System.out.println("Result: " + s);
    }

    @Bean
    public OAuth2RestTemplate template() {
        return new OAuth2RestTemplate(resourceDeatils());
    }

    private ResourceOwnerPasswordResourceDetails resourceDeatils() {
        ResourceOwnerPasswordResourceDetails resourceDetails = new ResourceOwnerPasswordResourceDetails();
        resourceDetails.setClientAuthenticationScheme(AuthenticationScheme.header);
        resourceDetails.setAccessTokenUri("http://localhost:9000/services/oauth/token");
        resourceDetails.setScope(Arrays.asList("toll_read"));
        resourceDetails.setClientId("clientapp1");
        resourceDetails.setClientSecret("clientapp1");
        resourceDetails.setUsername("robin");
        resourceDetails.setPassword("pass");
        return resourceDetails;
    }

}
Bilal Ahmed Yaseen
@bilalahmed54
Aug 03 2018 07:13
@Hello Team,
I'm struggling while setting up ZipKin Server can you please share working example/documentation? I added the following maven dependencies:
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-server</artifactId>
            <version>2.8.3</version>
        </dependency>

        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-ui</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
        </dependency>
And added the following annotation: @EnableZipkinServer which seems deprecated.
Raja Sundaram
@zeagord
Aug 03 2018 07:16
@bilalahmed54 There is a seperate Zipkin channel avaialble. And by the yes you’re right @EnableZipkinServer is deprecated.
Let me take you over there
Bilal Ahmed Yaseen
@bilalahmed54
Aug 03 2018 07:16
Thank you @zeagord