DDD and Spring Boot

09387cf644abcfd34e981378f9e70541?s=47 zhanpon
December 15, 2018

DDD and Spring Boot

JJUG CCC 2018 Fallでの発表資料です。

09387cf644abcfd34e981378f9e70541?s=128

zhanpon

December 15, 2018
Tweet

Transcript

  1. 3.

    ࣗݾ঺հ: @zhanpon • 2017೥10݄ɿϠϑʔʹ৽ଔೖࣾ • 2018೥4݄ɿJava, Spring BootΛ࢖͍͸͡ΊΔ • 2018೥5݄ɿJJUG

    CCC 2018 SpringʹॳࢀՃ ձࣾͰͷओͳ׆ಈ • ਪનγεςϜͷ։ൃɾӡ༻ Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  2. 4.

    DDDͱ͸Կ͔ • υϝΠϯۦಈઃܭ (Domain-Driven Design) ͷུশ • Eric Evans ͷ

    "Domain-Driven Design: Tackling Complexity in the Heart of Software" ͱ͍͏ຊ͕ݩʹͳ͍ͬͯΔ • ෯޿͍࿩୊͕͋ͬͯҰݴͰ͸આ໌Ͱ͖ͳ͍ Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  3. 10.

    ΤϯςΟςΟΛ࣮૷͢Δ @Entity public class User { @Id private String id;

    private String fullName; // getterͱsetter } Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  4. 12.

    ίϯτϩʔϥʔΛ࣮૷͢Δ @RestController public class UserController { @Autowired UserRepository userRepository; @GetMapping("/users")

    public List<User> allUsers() { return userRepository.findAll(); } } Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  5. 18.

    φΠʔϒʹ࣮૷ͨ͠Β • ϦϙδτϦʹΞΫηε͢ΔΫϥε (DockerRegistryAccessor) ͱ࣮ߦ؀ڥʹσϓϩΠ͢ΔΫϥε (KubernetesDeployer) Λ༻ ҙ͢Δ • DockerRegistryAccessor

    ͕࠷৽൛Λऔͬͯ͘Δ • KubernetesDeployer ͕ͦΕΛσϓϩΠ͢Δ Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  6. 23.

    Version • ఆظతʹੜ੒͞ΕΔػցֶशͷ੒Ռ෺ɻྫɿݘೣ෼ྨثͷ2018 ೥12݄15೔9࣌όʔδϣϯ @Value public class Version { private

    final String modelName; private final Instant instant; } Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  7. 25.

    Policy public enum Policy { NONE((versions, t) -> Optional.empty()), LATEST((versions,

    t) -> { return versions.latest(); }) private BiFunction<VersionSet, Instant, Optional<Version>> policy; Policy(BiFunction<VersionSet, Instant, Optional<Version>> policy) { this.policy = policy; } } Copyright © 2018 Yahoo Japan Corporation. All rights reserved.
  8. 27.

    Deployer public interface Deployer { void deploy(Version version); } Copyright

    © 2018 Yahoo Japan Corporation. All rights reserved.