Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Small is beautiful - Microservices mit Spring C...

Small is beautiful - Microservices mit Spring Cloud & Netflix OSS

dm Special Developer Day 2015

Nicolas Byl

May 08, 2015
Tweet

More Decks by Nicolas Byl

Other Decks in Technology

Transcript

  1. AKTIVIERUNG (SERVER) @ComponentScan @EnableAutoConfiguration @EnableEurekaServer public class Application { public

    static void main(String[] args) { new SpringApplication(Application.class).run(args); } }
  2. AKTIVIERUNG (CLIENT) @ComponentScan @EnableAutoConfiguration @EnableEurekaClient public class Application { public

    static void main(String[] args) { new SpringApplication(Application.class).run(args); } }
  3. AKTIVIERUNG (SERVER) @ComponentScan @EnableAutoConfiguration @EnableConfigServer public class Application { public

    static void main(String[] args) { new SpringApplication(Application.class).run(args); } }
  4. BOOTSTRAP VIA CONFIG SERVER Bootstrap Konfiguration des Config Server Abfrage

    der weiteren Konfiguration Anmeldung am Eureka Server
  5. BOOTSTRAP VIA EUREKA Bootstrap Konfiguration des Eureka Server Lookup des

    Config Server Abfrage der weiteren Konfiguration
  6. AKTIVIERUNG (SERVER) @ComponentScan @EnableAutoConfiguration @EnableZuulProxy public class Application { public

    static void main(String[] args) { new SpringApplication(Application.class).run(args); } }
  7. FEIGN - REST CLIENT @FeignClient("email") public interface EmailServiceClient { @RequestMapping(value="/shoppinglist",

    method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) void sendShoppingListEmail(ShoppingListMail mail); }
  8. AKTIVIERUNG @ComponentScan @EnableAutoConfiguration @EnableHystrix @EnableHystrixDashboard public class Application { public

    static void main(String[] args) { new SpringApplication(Application.class).run(args); } }
  9. public class CommandHelloWorld extends HystrixCommand<string> { private final String name;

    public CommandHelloWorld(String name) { super(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")); this.name = name; } @Override protected String run() { // a real example would do work like a network call here return "Hello " + name + "!"; } } </string>
  10. public class UserService { @HystrixCommand(fallbackMethod = "defaultUser") public User getUserById(String

    id) { return userResource.getUserById(id); } private User defaultUser(String id) { return new User("def", "def"); } }