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

Multi-Project Build の魅力 / JJUG CCC 2024 Fall - LT

Fumitaka Yokoyama
November 12, 2024
100

Multi-Project Build の魅力 / JJUG CCC 2024 Fall - LT

JJUG CCC 2024 Fall の夜の部で LT した内容です。
Multi-Project Build の魅力について発表しました。

Fumitaka Yokoyama

November 12, 2024
Tweet

Transcript

  1. © 2024- atWare Inc. package org.example.presentation.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController;

    ... import org.example.repository.user.UserDataModel; @RestController public class UserController { ... @GetMapping("/users") public List<UserView> getUsers(UsersSearchParams params) { ... List<UserDataModel> userDataModels = searchUsersService.invoke(params); List<UserView> userViews = converter.convert(userDataModels); return userViews; } } \ できました! /
  2. © 2024- atWare Inc. package org.example.presentation.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController;

    ... import org.example.repository.user.UserDataModel; @RestController public class UserController { ... @GetMapping("/users") public List<UserView> getUsers(UsersSearchParams params) { ... List<UserDataModel> userDataModels = searchUsersService.invoke(params); List<UserView> userViews = converter.convert(userDataModels); return userViews; } }
  3. © 2024- atWare Inc. Multi-Project Build の魅力 - 依存関係の制御 -

    sub-project の独立性 - domain, application の再利用性 - パフォーマンス向上
  4. © 2024- atWare Inc. Project structure (all) - buildSrc build

    conventions - app bootable (AppMain.class) - lib: - presentation - application-service-interface - application-service - application-data-interface - data-adaptor - domain - composite project: - util
  5. © 2024- atWare Inc. Project structure (simplified) - presentation *Controller,

    view - application-service-interface interface *Service application I/O - application-service *ServiceImpl - application-data-interface interface *Repository - data-adaptor *RepositoryImpl
  6. © 2024- atWare Inc. dependencies { implementation(project( ":lib:application-service-interface" )) implementation(project(

    ":lib:domain" )) implementation( "org.springframework.boot:spring-boot-starter-web" ) implementation( "org.springframework.boot:spring-boot-starter-thymeleaf" ) } ./lib/presentation/build.gradle
  7. © 2024- atWare Inc. dependencies { implementation(project( ":lib:application-service-interface" )) implementation(project(

    ":lib:application-data-interface" )) implementation(project( ":lib:domain" )) implementation( "org.springframework.boot:spring-boot-starter" ) } ./lib/application-service/build.gradle
  8. © 2024- atWare Inc. dependencies { implementation(project( ":lib:application-data-interface" )) implementation(project(

    ":lib:domain" )) implementation( "org.springframework.boot:spring-boot-starter-data-jpa" ) } ./lib/data-adaptor/build.gradle
  9. © 2024- atWare Inc. package org.example.presentation.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController;

    ... import org.example.repository.user.UserDataModel; @RestController public class UserController { ... @GetMapping("/users") public List<UserView> getUsers(UsersSearchParams params) { ... List<UserDataModel> userDataModels = searchUsersService.invoke(params); List<UserView> userViews = converter.convert(userDataModels); return userViews; } } import できねえ、、