{"id":70,"date":"2012-03-27T20:39:13","date_gmt":"2012-03-27T11:39:13","guid":{"rendered":"http:\/\/lab.synergy-marketing.co.jp\/blog\/?p=70"},"modified":"2018-11-14T16:34:00","modified_gmt":"2018-11-14T07:34:00","slug":"scala%e3%81%a7di-%ef%bc%88cake-pattern%e5%b0%8e%e5%85%a5%e7%b7%a8%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2012\/03\/27\/scala%e3%81%a7di-%ef%bc%88cake-pattern%e5%b0%8e%e5%85%a5%e7%b7%a8%ef%bc%89\/","title":{"rendered":"Scala\u3067DI \uff08Cake Pattern \u5c0e\u5165\u7de8\uff09"},"content":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3001\u99ac\u5834\u3067\u3059\u3002<\/p>\n
\u5510\u7a81\u3067\u3059\u304c\u3001\u73fe\u5728Play!<\/a> + Scala\u3067\u958b\u767a\u3057\u3066\u3044\u307e\u3059\u3002 \u300cDI\u3057\u305f\u3044\u2026\u300d<\/strong><\/p>\n \u306a\u305c\u306a\u3089\u300c\u30c6\u30b9\u30c8\u304c\u9762\u5012\u3060\u304b\u3089\u300d\u3002 \u3068\u3044\u3046\u308f\u3051\u3067\u3001Scala \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3078\u306eDI\u306e\u5c0e\u5165\u4f53\u9a13\u3092\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u307e\u305a\u306fJava\u306eDI\u30b3\u30f3\u30c6\u30caSpring<\/a>\u306e\u5b9f\u88c5\u4f8b\u3092\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002 [java]public class ProfileService{<\/p>\n private TwitterApi twitterApi;<\/p>\n public ProfileService(TwitterApi twitterApi){ public int getProfileCharCount(String twitterId){ }[\/java]<\/p>\n TwitterApi \u306f\u300c\u53d6\u308a\u66ff\u3048\u53ef\u80fd\u300d\u306b\u306a\u308b\u3088\u3046\u306b\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u306b\u3057\u307e\u3059\u3002<\/p>\n [java]public interface TwitterApi{<\/p>\n public String getProfile(String twitterId);<\/p>\n }[\/java]<\/p>\n \u672c\u756a\u3067\u5229\u7528\u3059\u308b\u3001\u5b9f\u969b\u306bWeb API\u306e\u547c\u3073\u51fa\u3057\u3092\u884c\u3046\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30af\u30e9\u30b9\u306f\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n [java]public class TwitterApiImpl implements TwitterApi{<\/p>\n public String getProfile(String twitterId){ }[\/java]<\/p>\n TwitterApiImpl\u3092\u751f\u6210\u3057\u305f\u308a\u3001ProfileService\u306b\u305d\u308c\u3092set\u3059\u308b\u306e\u306fDI\u30b3\u30f3\u30c6\u30ca\u306eSpring\u306e\u5f79\u5272\u3067\u3059\u3002 [xml]<beans> \u30b3\u30fc\u30c9\u4e2d\u3067\u306f\u3001<\/p>\n [java]ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); \u306e\u3088\u3046\u306bProfileService\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u3053\u3046\u3057\u3066\u304a\u3051\u3070Web API\u306e\u8a8d\u8a3c\u306a\u3069\u306e\u60c5\u5831\u304c\u5909\u308f\u3063\u305f\u5834\u5408\u3067\u3082\u3001ProfileService\u306e\u30b3\u30fc\u30c9\u3092\u5909\u66f4\u305b\u305a\u306b\u3001 \u3055\u3089\u306bUnitTest \u3067\u306f\u3001\u7c21\u5358\u306btwitterApi\u3092\u30e2\u30c3\u30af\u306b\u5dee\u3057\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n [java]public class ProfileServiceTest{<\/p>\n @Test int result = new ProfileService(twitterApi).getProfile("AyakoBaba"); }[\/java]<\/p>\n \u203bMockito<\/a>\u306f\u30e2\u30c3\u30af\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306eJava \u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n Web API\u3092\u547c\u3073\u51fa\u3059\u51e6\u7406\u306f\u8a2d\u5b9a\u306a\u3069\u304c\u8907\u96d1\u306b\u306a\u308a\u307e\u3059\u3057\u3001\u516c\u958b\u30b5\u30fc\u30d3\u30b9\u306a\u3089\u7279\u306b\u5b9f\u884c\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3054\u3068\u306b\u7d50\u679c\u304c\u7570\u306a\u3063\u305f\u308a\u3057\u304c\u3061\u3067\u3059\u3002 Java\u306e\u958b\u767a\u3067\u4f55\u5ea6\u3082\u52a9\u3051\u3089\u308c\u305fDI\u3002\u3069\u3046\u306b\u304b\u3053\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3082DI\u3092\u5c0e\u5165\u3057\u305f\u3044\u3068\u8003\u3048\u307e\u3057\u305f\u304c\u3001DI\u5acc\u3044\u306ePlay! framework\u306b\u306f\u305d\u306e\u3088\u3046\u306a\u4ed5\u7d44\u307f\u306f\u3042\u308a\u307e\u305b\u3093\u3002Scala \u3068\u3044\u3048\u3069\u3082JVM\u8a00\u8a9e\u306a\u306e\u3067\u3001Spring \/ Guice \u306a\u3069\u306eJava \u306eDI\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3082\u5229\u7528\u3067\u304d\u307e\u3059\u3002\u3067\u3059\u304c\u3001\u3053\u3053\u306f\u305b\u3063\u304b\u304f(?)\u306a\u306e\u3067Scala\u3089\u3057\u3044\u65b9\u6cd5\u3067\u5b9f\u88c5\u3057\u305f\u3044\u3002\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30d0\u30af\u306e\u672c<\/a>\u306b\u3082\u3061\u3089\u3063\u3068\u66f8\u3044\u3066\u3042\u308b\u300cCake Pattern<\/a>\u300d\u3092\u3084\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002 \u307e\u305a\u3001\u5834\u9762\u3054\u3068\uff08\u672c\u756a\u3068\u30c6\u30b9\u30c8\uff09\u3067\u5207\u308a\u66ff\u3048\u305f\u3044Web API\u306e\u547c\u3073\u51fa\u3057\u51e6\u7406\u306f\u3001trait\u3067\u5ba3\u8a00\u3057\u307e\u3059\u3002<\/p>\n [scala]trait TwitterApi {<\/p>\n def getProfile(twitterApi:String):String<\/p>\n }[\/scala]<\/p>\n \u305d\u306e\u5f8c\u3059\u307d\u3063\u3068Component trait\u3067\u53d6\u308a\u56f2\u307f\u307e\u3059\u3002TwitterApi\u306fTwitterApiComponent\u304c\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n [scala]trait TwitterApiComponent{ trait TwitterApi { }[\/scala]<\/p>\n \u6b21\u306bProfileService\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002ProfileService\u306fTwitterApi\u3092\u5229\u7528\u3057\u305f\u3044\u306e\u3067\u3001\u3053\u306e\u30af\u30e9\u30b9\u3092\u3059\u307d\u3063\u3068Component trait\u3067\u53d6\u308a\u56f2\u307f\u3001\u3055\u3089\u306bTwitterApiComponent \u3092\u81ea\u5df1\u53c2\u7167\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u5185\u90e8\u306eProfileService\u30af\u30e9\u30b9\u3067\u306f\u3001TwitterApi\u304c\u63d0\u4f9b\u3059\u308btwitterApi\u304c\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n [scala]trait ProfileServiceComponent{ class ProfileService { }[\/scala]<\/p>\n \u672c\u756a\u3067\u5229\u7528\u3059\u308b\u3001\u5b9f\u969b\u306bWeb API\u306e\u547c\u3073\u51fa\u3057\u3092\u884c\u3046\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002TwitterApi\u3092\u7d99\u627f\u3059\u308bTwitterApiImpl\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u3001\u3053\u308c\u3082TwitterApiComponent\u3092\u7d99\u627f\u3057\u305fComponent trait\u3067\u3059\u307d\u3063\u3068\u56f2\u307f\u307e\u3059\u3002<\/p>\n [scala]trait TwitterApiComponentImpl extends TwitterApiComponent {<\/p>\n class TwitterApiImpl extends TwitterApi{ }[\/scala]<\/p>\n \u3055\u3066\u3001\u6700\u5f8c\u306b\u30b3\u30f3\u30c6\u30ca\u306b\u3042\u305f\u308bobject\u3092\u4f5c\u6210\u3057\u307e\u3059\uff08object\u306b\u3059\u308b\u306e\u306fsingleton\u306b\u3057\u305f\u3044\u304b\u3089\uff09\u3002\u3053\u306eComponentRegistry\u306f\u3001ProfileServiceComponent \u304a\u3088\u3073 TwitterApiComponentImpl \u3092\u7d99\u627f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n [scala]object ComponentRegistry extends ProfileServiceComponent with TwitterApiComponentImpl{<\/p>\n val twitterApi = new TwitterApiImpl()<\/p>\n val profileService = new ProfileService()<\/p>\n }[\/scala]<\/p>\n \u30b3\u30fc\u30c9\u4e2d\u3067\u306f\u3001<\/p>\n [scala]val profileService = ComponentRegistry.profileService[\/scala]<\/p>\n \u306e\u3088\u3046\u306b\u3001ComponentRegistry\u304b\u3089profileService\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002profileService\u5185\u90e8\u3067\u5229\u7528\u3059\u308btwitterApi\u306fComponentRegistry \u3067\u751f\u6210\u3057\u3066\u3044\u308bTwitterApiImpl\u306b\u306a\u308a\u307e\u3059\u3002 [scala]class ProfileServiceTest extends UniFunSuite with ShouldMatchers\u3000with ProfileServiceComponent with TwitterServiceComponent{<\/p>\n val twitterApi = Mockito.mock(classOf[TwitterApi])<\/p>\n test("\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306e\u6587\u5b57\u6570\u3092\u6570\u3048\u308b"){ val result = new ProfileService(twitterApi).getProfile("AyakoBaba") }<\/p>\n }[\/scala]<\/p>\n \u306a\u3093\u3068\u304bCake Pattern\u3067DI\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002DI\u304c\u306a\u304b\u3063\u305f\u3053\u308d\u3088\u308a\u30c6\u30b9\u30c8\u304c\u65e9\u3044\u306e\u3067\u3001\u79c1\u6bd4\uff13\u500d\u5feb\u9069\u306a\u958b\u767a\u30e9\u30a4\u30d5\u3002Play! Framework\u306e\u4eba\u3068\u306f\u610f\u898b\u304c\u9055\u3044\u307e\u3059\u304c\u3001\u3042\u308b\u7a0b\u5ea6\u306e\u898f\u6a21\u3068\u8907\u96d1\u3055\u304c\u3042\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u306b\u306fDI\u306f\u306a\u304f\u3066\u306f\u306a\u3089\u306a\u3044\u3082\u306e\u3001\u3068\u3044\u3046\u611f\u3058\u307e\u3057\u305f\u3002<\/p>\n \u305d\u308c\u3067\u306f\u3001Cake Pattern\u306f\u3069\u3046\u3060\u3063\u305f\u3093\u3060\u308d\u3046\u3001\u3068\u632f\u308a\u8fd4\u308b\u3068\u2026 \u4eca\u56de\u306fCake Pattern\u306b\u3064\u3044\u3066\u307f\u3066\u304d\u307e\u3057\u305f\u304c\u3001Scala\u306eDI\u306e\u30d1\u30bf\u30fc\u30f3\u306f\u4ed6\u306b\u3082\u307e\u3060\uff08\u5c11\u3057\u3060\u3051\uff09\u3042\u308a\u307e\u3059\u3002 \u3053\u3093\u306b\u3061\u306f\u3001\u99ac\u5834\u3067\u3059\u3002<\/p>\n \u5510\u7a81\u3067\u3059\u304c\u3001\u73fe\u5728Play! + Scala\u3067\u958b\u767a\u3057\u3066\u3044\u307e\u3059\u3002
\n\u305d\u308c\u307e\u3067\u306f\u307b\u3068\u3093\u3069Java (\u305f\u307e\u306bRuby\/Rails)\u3067\u4f5c\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u672c\u683c\u7684\u306b\u30b5\u30fc\u30d3\u30b9\u3092Scala\u3067\u4f5c\u308b\u306e\u306f\u521d\u3081\u3066\u3002
\n\u6163\u308c\u306a\u3044\u306a\u304c\u3089\u3082\u3059\u3054\u304f\u697d\u3057\u304f\u3084\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u958b\u59cb\u65e9\u3005\u3067\u3066\u304d\u305f\u4e0d\u6e80\u3002\u305d\u308c\u306f<\/p>\n
\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30a2\u30af\u30bb\u30b9\u3001webapi\u306e\u547c\u3073\u51fa\u3057\u3001\u30e1\u30fc\u30eb\u9001\u4fe1\u3068\u5916\u90e8\u30ea\u30bd\u30fc\u30b9\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u51e6\u7406\u306e\u30aa\u30f3\u30d1\u30ec\u30fc\u30c9\u3002\u30c6\u30b9\u30c8\u306e\u305f\u3073\u306b\u5b9f\u884c\u3057\u3066\u3044\u305f\u3089\u30b9\u30ed\u30fc\u30c6\u30b9\u30c8\u306b\u9665\u308b\u3053\u3068\u306f\u76ee\u306b\u898b\u3048\u3066\u3044\u307e\u3059\u3002\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\uff0f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\uff0f\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u8010\u3048\u308b\u305f\u3081\u306b\u3082\u3001\u3053\u3053\u306f\u305c\u3072\u3068\u3082DI\u3092\u5c0e\u5165\u3057\u3066\u304a\u304d\u305f\u3044\u3002<\/p>\nJava \u3067 DI<\/h2>\n
\n\u4f8b\u3048\u3070\u3001Web API\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u3001\u5b9f\u969b\u306bWeb API\u3092\u547c\u3073\u51fa\u3059\u51e6\u7406\u3092\u5207\u308a\u51fa\u3057\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u6642\u306b\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n
\n this.twitterApi = twitterApi;
\n }<\/p>\n
\n String profile = twitterApi.getProfile(twitterId);
\n return profile.length;
\n }<\/p>\n
\n \/\/\/ API\u3092\u547c\u3073\u51fa\u3059\u8907\u96d1\u306a\u51e6\u7406\u306e\u3042\u308c\u3084\u3053\u308c\u3084
\n }<\/p>\n
\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u3069\u306e\u3088\u3046\u306a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092ProfileService\u306b\u8a2d\u5b9a\u3059\u308b\u306e\u304b\u3001XML\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n
\n<bean id="twitterApi" class="TwitterApiImpl"\/>
\n<bean id ="profileService" >
\n<constructor-arg ref="twitterApi" \/>
\n<\/bean>
\n<\/beans>[\/xml]<\/p>\n
\nProfileService profileService = (ProfileService)ctx.getBean("profileService");[\/java]<\/p>\n
\n\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3060\u3051\u3092\u7de8\u96c6\u3059\u308c\u3070\u3001\u5909\u66f4\u3055\u308c\u305fWeb API\u547c\u3073\u51fa\u3057\u30af\u30e9\u30b9\u3092ProfileService\u3067\u5229\u7528\u3059\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n
\n public void test_\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3059\u308b(){
\n TwitterApi twitterApi = Mockito.mock(TwitterApi.class);
\n Mockito.when(twitterApi.getProfile("AyakoBaba")).thenReturn("\u99ac\u5834\u5f69\u5b50\u306e\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb");<\/p>\n
\n assertEquals(11,result);
\n }<\/p>\n
\n\u3053\u3053\u3067\u78ba\u8a8d\u3057\u305f\u3044\u306e\u306f\u300cAPI\u304b\u3089\u53d6\u5f97\u3057\u305f\u6587\u5b57\u306e\u6570\u3092\u8fd4\u3057\u3066\u3044\u308b\u304b\u300d\u3068\u3044\u3046\u3068\u3053\u308d\u3067\u3001API\u547c\u3073\u51fa\u3057\u306e\u90e8\u5206\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
\n\u30c6\u30b9\u30c8\u3057\u305f\u3044\u51e6\u7406\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3059\u308c\u3070\u3001API\u547c\u3073\u51fa\u3057\u306f\u30e2\u30c3\u30af\u3067\u5341\u5206\u3002\u307e\u305f\u5b9f\u969b\u306b\u5916\u90e8\u306eWeb API\u3092\u547c\u3073\u51fa\u3059\u306e\u3068\u306f\u9055\u3044\u3001\u30c6\u30b9\u30c8\u3082\u77ac\u6bba\u3067\u7d42\u308f\u308a\u307e\u3059\u3002<\/p>\nScala \u3067 DI - CakePattern<\/h2>\n
\nCake Pattern \u306f\u3001Scala \u306e\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3\u3067\u3001\u69cb\u9020\u304c\u30b1\u30fc\u30ad\u306e\u3088\u3046\u306b\u6c34\u5e73\u306b\u4f55\u6bb5\u306b\u3082\u91cd\u306d\u305f\u3088\u3046\u306b\u3082\u3001\u5782\u76f4\u306b\u304d\u308a\u3060\u3057\u305f\u3088\u3046\u306b\u3082\u307f\u3048\u308b\u306e\u3067\u305d\u306e\u3088\u3046\u306b\u540d\u4ed8\u3051\u3089\u308c\u305f\u306e\u3067\u3059\u304c\u3001\u81ea\u5206\u3067\u3044\u3063\u3066\u3044\u3066\u3082\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3001\u3068\u306b\u304b\u304f\u30b3\u30fc\u30c9\u3092\u307f\u3066\u307f\u307e\u3057\u3087\u3046!<\/p>\n
\n val twitterApi:TwitterApi<\/p>\n
\n def getProfile(twitterApi:String):String
\n }<\/p>\n
\n this:TwitterApiComponent =><\/p>\n
\n def count(twitterId:String) = twitterApi.getProfile(twitterId).length
\n }<\/p>\n
\n def getProfile(twitterApi:String) = {
\n \/\/\u8907\u96d1\u306a\u3042\u308c\u3084\u3053\u308c\u3084
\n }
\n }<\/p>\n
\n\u30c6\u30b9\u30c8\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u3067ProfileServiceComponent\u3068TwitterServiceComponent\u3092with\u3057\u307e\u3059\u3002twitterApi\u3092\u30e2\u30c3\u30af\u306b\u7f6e\u304d\u63db\u3048\u3066\u30c6\u30b9\u30c8\u3092\u5b9f\u65bd\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n
\n Mockito.when(twitterApi.getProfile("AyakoBaba")).thenReturn("\u99ac\u5834\u5f69\u5b50\u306e\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb")<\/p>\n
\n result should be (11)<\/p>\nCake Pattern \u3063\u3066\u3069\u3046\u306a\u3093\u3060\u308d\u3046\u3002<\/h2>\n
\nDI\u30b3\u30f3\u30c6\u30ca\u306e\u8a2d\u5b9a\u304c\u3001Spring\u306e\u3088\u3046\u306bXML\u3067\u306f\u306a\u304f\u901a\u5e38\u306eScala\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3042\u308b\u3001\u3068\u3044\u3046\u70b9\u306f\u3088\u304b\u3063\u305f\u3067\u3059\u3002\u8a2d\u5b9a\u306b\u30df\u30b9\u304c\u3042\u308c\u3070\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u767a\u898b\u3067\u304d\u307e\u3059\u3057\u3001\u305f\u3060\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306a\u306e\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u751f\u6210\u65b9\u6cd5\u3092\u67d4\u8edf\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Spring\u306f\u9ad8\u6a5f\u80fd\u3067\u81ea\u52d5\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u306a\u3069\u3082\u3042\u308a\u697d\u306a\u306e\u3067\u3059\u304c\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u5c11\u3057\u3061\u304c\u3063\u305f\u3053\u3068\u3092\u3084\u308d\u3046\u3068\u3059\u308b\u3068\u3069\u3046\u3057\u305f\u3089\u3088\u3044\u304b\u308f\u304b\u3089\u306a\u3044\u8907\u96d1\u3055\u304c\u3042\u308a\u307e\u3059\u3057\u3001XML\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3059\u308b\u306e\u3082\u6c17\u304c\u91cd\u3044\u3067\u3059\u3002maven \u3068 sbt \u306e\u5370\u8c61\u306e\u9055\u3044\u306b\u4f3c\u3066\u3044\u308b\u3001\u3068\u3044\u3046\u304b\u3002
\n\u305f\u3060\u5f53\u7136\u3001\u3044\u304f\u3064\u304b\u904b\u7528\u4e0a\u6c17\u306b\u306a\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u3059\u3002\u307e\u305a\u3001\u958b\u767a\u304c\u9032\u3080\u306b\u3064\u308c\u95a2\u4fc2\u3057\u3042\u3046\u30af\u30e9\u30b9\u304c\u3069\u3093\u3069\u3093\u5897\u3048\u3066\u3044\u304d\u3001\u6c17\u3065\u3051\u3070ComponentRegistry \u3067 Component trait \u306e with \u304c\u796d\u308a\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3053\u3068\u3002\u4f55\u6bb5\u30b1\u30fc\u30ad\u306a\u3093\u3060\u3088\u3001\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002\u9014\u4e2d\u3067\u3001ComponentRegistry\u81ea\u4f53\u3092\u3044\u304f\u3064\u304b\u306etrait\u306b\u5206\u5272\u3057\u307e\u3057\u305f\u304c\u3001\u898f\u6a21\u304c\u3082\u3046\u5c11\u3057\u5927\u304d\u304f\u306a\u308b\u3068\u6539\u3081\u3066\u8ab2\u984c\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3082\u3046\u3072\u3068\u3064\u306f\u3001\u3061\u3087\u3063\u3068\u308f\u304b\u308a\u306b\u304f\u3044\u3068\u3044\u3046\u3068\u3053\u308d\u3067\u3059\u3002\u3053\u306e\u958b\u767a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3001\u9014\u4e2d\u304b\u3089\u4eba\u304c\u3061\u3087\u3063\u3068\u305a\u3064\u5897\u3048\u3066\u3044\u3063\u305f\u306e\u3067\u3059\u304c\u3001Cake Pattern\u306f\u958b\u767a\u3067\u3064\u307e\u3065\u304f\u7b87\u6240\u5802\u3005\u7b2c\uff12\u4f4d\u3060\u3063\u305f\u3068\u601d\u3044\u307e\u3059\uff08\uff11\u4f4d\u306f\u307e\u305f\u6a5f\u4f1a\u304c\u3042\u308c\u3070\u304a\u8a71\u3057\u307e\u3059) \u3002\u4e00\u898b\u3057\u3066\u3001Component trait\u3067\u3059\u307c\u3063\u3068\u53d6\u308a\u56f2\u3080\u69cb\u9020\u306b\u3057\u3066\u3044\u308b\u610f\u56f3\u304c\u308f\u304b\u3089\u306a\u3044\u3093\u3067\u3059\u3088\u306d\u3002\u3053\u308c\u306f\u4eba\u304c\u5897\u3048\u308b\u3054\u3068\u306bCake Pattern\u306b\u3064\u3044\u3066\u6539\u3081\u3066\u8aac\u660e\u3057\u306a\u304b\u3063\u305f\u304b\u3089\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3002\u6b21\u6765\u305f\u4eba\u306b\u306f\u3053\u306eBlog\u3092\u8aad\u3093\u3067\u3082\u3089\u3046\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\u6b21\u56de\u4e88\u544a<\/h2>\n
\n\u6b21\u56de\u306f\u3001Twitter\u304cEffective Scala\u3067\u7d39\u4ecb\u3057\u3066\u3044\u308b\u30d1\u30bf\u30fc\u30f3\u3001\u304a\u3088\u3073\u3000Lift \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u306eDI\u306e\u5b9f\u88c5\u306b\u3064\u3044\u3066\u307f\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\n\u305d\u308c\u307e\u3067\u306f\u307b\u3068\u3093\u3069Java (\u305f\u307e\u306bRuby\/Rails)\u3067\u4f5c\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u672c\u683c\u7684\u306b\u30b5\u30fc\u30d3\u30b9\u3092Scala\u3067\u4f5c\u308b\u306e\u306f\u521d\u3081\u3066\u3002
\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[254,18],"tags":[],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/70"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":2,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":13908,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/70\/revisions\/13908"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}