// Path: applications/billing/src/main/java/com/example/billing/reocurringPayments/Service.java
// public class Service {
//     private static final Logger logger = LoggerFactory.getLogger(Service.class);
// 
//     private static final Random rand = new Random();
// 
//     @HystrixCommand(fallbackMethod = "thisMayFailFallback")
//     public String thisMayFail() {
//         if (rand.nextInt(100) % 10 == 0)
//             throw new RuntimeException("BOOM!");
//         return "SUCCESS!";
//     }
// 
//     public String thisMayFailFallback() {
//         logger.info("*********************** Calling Fallback... *************************");
//         return "FALLBACK!";
//     }
// }


import com.example.billing.reocurringPayments.Service;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
package com.example.billing;


@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class Application {

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

    // Wire up the specific implementation of the payment gateway. Because this is an
    // interface, the rest of the code doesn't know anything about the concrete implementation.
    // This implementation can be switched out easily by the Spring IoC framework for testing so
    // that tests do not hit the actual gateway API.
    @Bean
    public com.example.payments.Gateway paymentGateway(){
        return new com.example.payments.RecurlyGateway();
    }

    // You need a bean for this service so that Spring Boot will automatically connect
    // the bean to Hystrix.
    // See http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_circuit_breaker_hystrix_clients.
    @Bean
// Path: applications/billing/src/main/java/com/example/billing/reocurringPayments/Service.java
// public class Service {
//     private static final Logger logger = LoggerFactory.getLogger(Service.class);
// 
//     private static final Random rand = new Random();
// 
//     @HystrixCommand(fallbackMethod = "thisMayFailFallback")
//     public String thisMayFail() {
//         if (rand.nextInt(100) % 10 == 0)
//             throw new RuntimeException("BOOM!");
//         return "SUCCESS!";
//     }
// 
//     public String thisMayFailFallback() {
//         logger.info("*********************** Calling Fallback... *************************");
//         return "FALLBACK!";
//     }
// }


// Path: applications/billing/src/main/java/com/example/billing/Application.java
import com.example.billing.reocurringPayments.Service;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;

package com.example.billing;


@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class Application {

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

    // Wire up the specific implementation of the payment gateway. Because this is an
    // interface, the rest of the code doesn't know anything about the concrete implementation.
    // This implementation can be switched out easily by the Spring IoC framework for testing so
    // that tests do not hit the actual gateway API.
    @Bean
    public com.example.payments.Gateway paymentGateway(){
        return new com.example.payments.RecurlyGateway();
    }

    // You need a bean for this service so that Spring Boot will automatically connect
    // the bean to Hystrix.
    // See http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_circuit_breaker_hystrix_clients.
    @Bean
    public Service serviceThatMayFail() {