ä»æ¥ãç§ãã¡ã®ä»®æ³ã¹ã¿ãžãªã§ãäžçã§æãæåãªSpringã¹ããŒã«ãŒã¯Josh Longã§ãã
圌ã®å ±åã¯äžçäžã§JavaäŒè°ãéããŠããŸãã ã³ãã¥ããã£ã®è³ªåã«çããã®ã¯åœŒã§ãYouTubeã§Spring Tipsããã£ãŠããŸããæ¯é±èªãã§ããã®ã¯åœŒã®ãä»é±ã®æ¥ãã§ãã
ãšããã§ããžã§ã·ã¥ã¯ç§ãã¡èªèº«ã®ãä»é±ã®Javaãã§ãã¹ãŠã®çŽ æã䜿çšããããšãèš±å¯ããŸãããã圌ã¯ãã®ããŒã¿ãã15åãã€ãžã§ã¹ãã圢åŒã«å§çž®ããããšãã§ããªãã£ãã»ã©ã®ããªã¥ãŒã ãšæ·±ãã§ãããè¡ããŸãã
æã ã圌ã¯ãã¹ãŠã®éœåžã«åæã«ããŠãã¬ããŒããèªãã ããèšäºãæžãããããŠããããã§ãã ä»æ¥ã¯ã圌ããããã©ã®ããã«è¡ãããç解ããŸãã ãã³ãŒãã®é åããSpringã®é©ãã¹ãçåæ§ã®çç±ããããŠåœŒããŒãããã®ã°ããŒãã«ãªæžãæãããã®ä»ã®èå³æ·±ãããªãã¯ãªãã§äœå¹ŽãçããŠããæ¹æ³ã«ã€ããŠåŠã³ãŸãã
äŒå¡
Josh LongãPivoââtalã®Spring Developer Advocate
Evgeny TrifonovãOleg Chirukhin-JUG.ruã°ã«ãŒãã®ç·šéè
å€ãã®äººãæ
è¡ããããšã誰ããç¥ã£ãŠããŸãããæšå¹ŽèšªåããäŒè°ã®æ°ããã©ã€ãã®æ°ãªã©ãçµ±èšæ
å ±ãæäŸã§ããã°èå³æ·±ãã§ãããã
ãã質åã§ãã ç§ã¯ãã®å¹Žã«åºåžãããã¹ãŠã®äŒè°ãèšé²ããããŒãã«ãæã£ãŠããŸãã ã¢ã·ã¹ã¿ã³ãã®Tashaããã¹ã±ãžã¥ãŒã«ãšãã®ããŒãã«ã®æŽçãæäŒã£ãŠãããŸãã ããã§ã¯ãé»è©±ã§ãã®ãã¬ãŒããéããŠã¿ãŸããã...äºçŸååã 2018幎ãçŸæç¹ã§ã¯ã240ã®ç°ãªãã€ãã³ãã«åå ããŸããã ãããã®äŒè°ã®ããã€ãã¯ãªã³ã©ã€ã³ã§è¡ãããŸããïŒç§ãã¡ã®äŒè°ã®ããã«ïŒãç§ã¯ã»ãšãã©ã«é£ã°ãªããã°ãªããŸããã ä»å¹Žãç§ã¯50äžãã€ã«ä»¥äžé£è¡ããŸããã å°çããæãŸã§ã®è·é¢ã確èªããŠã¿ãŸããã...ããã¯23äž9åãã€ã«ãªã®ã§ãæã«è¡ã£ããæ»ã£ããããããšãã§ããŸãã
ãæãžãšæ¥ããåž°ããŸããã ããŒã«ãã³ã®æ¬ã®è¯ãã¿ã€ãã«ã
ããªãã¯ãããªã«é£ã¶ã®ã§ãèªç©ºäŒç€Ÿã¯ããªãã«ç¹å¥ãªãªãã¡ãŒãæäŸããŸããïŒ
ãŸããç§ã¯ãµãŒãã¹ã«ã€ããŠæå¥ãèšããŸããã ç§ã¯ãããŠãã€ãããèªç©ºã§é£ãã§ããŸããã圌ãã«ã¯ã°ããŒãã«ãµãŒãã¹ããã°ã©ã ããããŸãã ããªãã¯æåŸ
ç¶ãåãåãããšã«ãã£ãŠã®ã¿ããã«çãããšãã§ããŸã-ããªãèªèº«ããããèªåã§æ±ããããšã¯ã§ããŸããããããŠãããã©ããªåºæºãæã£ãŠãããã¯äžæã§ãã æ¯å¹Žãæãé »ç¹ã«é£ã¶äººãæåŸ
ããŸãã æšå¹Žã誰ããäžçäžã®æãé »ç¹ãªé¡§å®¢ã®1ïŒ
ãéžæãããšèšããŸããã ãŸãã¯ãã³ã¹ãã®éã§ãã£ã«ã¿ãªã³ã°ããããšãã§ããŸãã ãããã«ããã圌ãã¯ç§ããšãŠãããæ±ã£ãŠãããŸãã ããã ãããããã®å Žåã§ããã»ãšãã©ã®äººã«ãšã£ãŠããã©ã€ãã¯è² æ
ã«ãªããšæããŸãã ããã¯ééããªãç§ã«é¢ä¿ããŠããŸãã ç§ã¯ãã©ã€ãèªäœã®ããã«é£ã¶ã®ã§ã¯ãªããSpringã䜿ã人ã
ã«äŒãããã«ã ãã®ãããªæ©äŒãããã°ãã¬ããŒãããŸãã 人çã¯ãã£ãšã·ã³ãã«ã§é¢çœããã®ã«ãªãã§ãããã
HyperloopãåŸ
ã€æ£åœãªçç±ã
ã¯ãããããããã¯é·ãæéåŸ
ããªããã°ãªããŸããã
Springã«è¿ããããã¯ã«ã€ããŠè©±ããŸãããã ããªãã¯ããã«ã€ããŠäžçäžã®äººã
ãšè©±ããŸã-ãã®æç
çã«å°åçãªéãã¯ãããŸããïŒ
ç§ã¯èšããŸããã Springã¯åžžã«100ïŒ
ãªãŒãã³ãœãŒã¹ã§ãããã€ã³ã¿ãŒãããã§åäœãããœãããŠã§ã¢ãäœæããŠããéããSpringã¯äžçäžã§æåãç¶ããŸãã 確ãã«ãå°åã®ç¹ç°æ§ãé¡èã§ããä»ã®ãªãŒãã³ãœãŒã¹ãããžã§ã¯ãããããŸãã çŸåšçµ±èšã確èªããããšã¯ã§ããŸãããããã·ã¢ã§ã¯GridGainãéåžžã«äžè¬çã§ããããã«æãããŸãã
ã¯ããããã§ãã
äžåœã§ã¯ãMyBatisã¯éåžžã«äººæ°ããããŸãã ã¢ã¡ãªã«ãšãšãŒãããã§ã¯10幎ãèŠãŠããŸããããäžåœã§ã¯æ¥ãšåããããäžè¬çã§ãã ãããŠå®éãMyBatisã«ã¯äœã®åé¡ããããŸãããããã¯é«éã§åŒ·åã§ãã
MyBatisãGridGainãšé£æºãããããžã§ã¯ããè¡ããŸããã
ïŒç¬ïŒã ãããããªãã¯ãããã®äž¡æ¹ã䜿çšããŸã-çŽ æŽãããïŒ ç§ã¯ãããã®ãã¯ãããžãŒã®äž¡æ¹ã奜ãã§ãã MyBatisã«å¯Ÿããéåžžã®ãµããŒãã¯ãããŸããã§ãããç§ã¯äžåœã®ããŸããŸãªå€§äŒæ¥ã«çŽ æŽãããããšãåžžã«äŸé ŒããŠããŸããããªã圌ãã¯Springã§MyBatisãå¿
èŠãšããã®ã§ããã ä»ã«ãå€ãã®ãªãã·ã§ã³ããããŸãããHibernateã¯éåžžã«ããŸãæ©èœããMyBatisã¯å®éã«ã¯è¥¿æŽã§ã¯äœ¿çšãããŠããŸããã çµå±ãããã°ã©ã ã䜿çšãããããã®æ£åžžãªåäœã確ä¿ããå¿
èŠããããšå€æããŸããã MyBatisã®Spring Boot Starterã®ãœãŒã¹ãèŠããšãããã«ç§ã®ååã衚瀺ãããŸãã æ±ã§ãã®ããã°ã©ã ãå¿
èŠãšãã人ã
ãããã§æ£åžžã«åäœã§ããããã«ãããã£ãã äžè¬çã«ãç§ã®ä»äºã®ããªãã®éšåã¯ãæ
è¡äžã«ããŸããŸãªåœã§çºèŠããçš®é¡ã«ç±æ¥ããŠããŸãã
ããªãã¯ãSpringãããžã§ã¯ãã®Pivotal Developer Advocateã§ãã ããã¯å®éã«ã¯ã©ãããæå³ã§ããïŒ æ£ç¢ºã«äœãããŠããŸããïŒ
é£ãã質åã§ãã Developer Advocateã®æŠå¿µã¯ãAppleãç¹ã«Microsoftã®ãããã§åºãŸããŸããã çŽ30幎åãMicrosoftãæ¬åœã®åŒ·ããæã£ãŠããã®ã¯éçºè
ã ãšæ°ã¥ãããšãã«å§ãŸããŸããã ãã©ãããã©ãŒã ãæåãããŠäŸ¿å©ã«ãããå Žåãéçºè
ã¯ãã®ãã©ãããã©ãŒã ã§æ°ãã䟡å€ãããã®ãäœæããå¿
èŠããããŸãã ãããã£ãŠããã©ãããã©ãŒã ã®å©ç¹ã圌ãã«çŽåŸãããå¿
èŠããããŸãã ãã€ã¯ããœããã¯ãããŸããŸãªæ¹æ³ã§éçºè
ãåæ©ä»ããããšãå§ããŸããã 圌ãã¯Visual Studioãéåžžã«å®ãããŸãããã€ãŸããæé ãªäŸ¡æ Œã®ããŒã«ãæäŸããŸããã 圌ãã¯ãWindowsã§äœæ¥ã§ããå€ãã®éåžžã«èå³æ·±ãAPIãäœæããŸããã äžè¬ã«ãMicrosoftã¯ã³ãã¥ããã£ãšã®å
±åäœæ¥ãå¿
èŠã§ããããšã«æ°ä»ããŸããã 人ã¯ãœãããŠã§ã¢ãä¿¡çšããŸããããä»ã®äººã¯ä¿¡çšããŸãã 人ã
ã¯ãœãããŠã§ã¢ã«å¯Ÿããææ
çãªæçãæã£ãŠããŸããã ããã«ã®éšå±ã§å€ç¬ã«ããã°ã©ã ãæžãã ãã§æåã«ãªãããããå¿
èŠãšãã人ãªã誰ã§ãããã¥ã¡ã³ããèŠã€ããããšãã§ããã®ã¯å¥œããªã ãæ³åã§ããŸãã ããããå®éã«ã¯ããã¯éåžžèµ·ãããŸããã ç§ã®è²¬ä»»ã®éèŠãªéšåã¯ãã³ãã¥ããã£ã®äººã
ãšã®ã³ãã¥ãã±ãŒã·ã§ã³ã§ãã ç§ã¯äººã
ã®èšãããšãèããŠéçºè
ã«äŒããéçºè
ã®èšãããšãã³ãã¥ããã£ã«äŒããŸãã èšãæããã°ãç§ã¯äžçš®ã®ä¹ãç©ã§ãã
SpringããŒã ã¯å¥åŠã§çŸããã§ãã 圌女ã¯ãã§ã«10幎å以äžã§ãã æåã¯ã圌女ã¯éåžžã«å°ãããéçºè
èªèº«ãã³ã³ãµã«ãã£ã³ã°ã«åŸäºããŠããŸããã 圌ãã¯åžžã«ä»ã®ããŒã ãšååããç¬èªã®ãœãããŠã§ã¢ã®äœæãæ¯æŽããŸãããã€ãŸããå®éã®åé¡ã解決ãã象çã®å¡ã«éãââ蟌ããããŸããã§ããã 圌ãã¯ãã©ã®ãœãããŠã§ã¢ãå¿
èŠã§ããããåãã£ãŠç¥ããµããããŸããã§ããããä»ã®äººãæ¬åœã«å¿
èŠãšãããã®ãæžãã圌ãã®å©çã¯åžžã«åœŒãã®äž»èŠãªåºæºã§ããã 圌ãã¯ã¯ã©ã€ã¢ã³ããšåé¡è§£æ±ºã®èŠãã¿ãå
±æããŸããã 圹ã«ç«ããªããã®ãäœæããŸããã ãããŠããã¯ããåç¥ã®ããã«ããœãããŠã§ã¢ãäœæããéã«ãã°ãã°åé¡ã«ãªããŸãã å®éãæåã®SpringããŒã ã¯æ¢ã«éçºè
æ¯æè
ã§æ§æãããŠããŸããã ãããã¯ããã°ã©ããéåžžè¡šããã®ãšã¯äŒŒãŠããŸããã§ããã ã¯ãã圌ãã¯æèœã®ããéçºè
ã§ããããåæã«åœŒãã¯èªåã®ã¢ã€ãã¢ãä»ã®äººã
ãšç±å¿ã«è©±ãåãããã¬ãŒã³ããŒã·ã§ã³ã«åºåžãã人ã
ã«äŒããç¥ãåããäœãã察話ãè¡ããŸããã ããã«ãããSpringã¯ããã«å€§ããªäººæ°ãåŸãŸããã
åé¡ã¯ããã®ã¢ãããŒããããŸãã¹ã±ãŒã«ããªãããšã§ãã ãã¹ãŠã®éçºè
ããæ
è¡ããã£ãããããã³äŒè°ã®æéã®ååãè²»ããããšã¯äžå¯èœã§ãã ç§ãããŒã ã«åå ããæç¹ã§ãSpringã¯ãªãŒãã³ãœãŒã¹ãããžã§ã¯ãã§ããããããã§ã«Springã®ã³ãŒããæžããŠããŸããã ããã«ãç§ã¯ãã§ã«æ¬ãåºçããèšäºãæžãããã¬ãŒã³ããŒã·ã§ã³ãè¡ããŸããã ã§ããããç§ã¯ãã§ã«Springãã§ããéãã³ãã¥ããã£ã«çŽ¹ä»ããã§ããã ãå€ãã®äººã
ã«Springãç¥ã£ãŠãããæ©äŒãäžããããšããŸããã ãã®ãããSpringããŒã ã¯ç§ã«ãã¹ãŠåãããšãããããã«æåŸ
ããŸããããç¶ç¶çãã€ééçã§ãã ç§ã¯80ïŒ
ãéçºè
æè·è
ã§ããã20ïŒ
ãããã°ã©ããŒã§ãããšæããŸãããæ®ãã®éçºè
æè·è
ããŒã ã¯20ïŒ
ããã³80ïŒ
ãããã°ã©ããŒã§ãã
å
šäœãšããŠãç§ã®ä»äºã¯ã³ãã¥ããã£ãšé£çµ¡ãåãåãããšã§ããããããè¡ãã«ã¯ããŸããŸãªæ¹æ³ããããŸãã ç§ã¯ç§ã®6çªç®ã®æ¬ãæžããŠããŸããããã¯ãªã¢ã¯ãã£ãã¹ããªã³ã°ããã¯ãšåŒã°ããŠããŸãã ç§ã®ä»¥åã®ãã®ã¯ãã¯ã©ãŠããã€ãã£ãJavaãšåŒã°ããO'Reillyã«ãã£ãŠå
¬éãããŸããã Safari Books Onlineã§èŠãããšãã§ãããããªãã¥ãŒããªã¢ã«ãå€æ°äœæããŸãããããããã4ã5æéããããŸãã ããã«ãæ¯é±æ°Žææ¥ã«ãYouTubeã«Spring Tipsãããªãæçš¿ããŸã ãåãããªã¯ããšã³ã·ã¹ãã ã®ç¹å®ã®çãåŽé¢ã«ç¹åããŠããŸãã ãããã¯éåžž45åãã1æéç¶ããæ¯å¹Žå°ãªããšã2ã·ãŒãºã³ãæã«ã¯3ã·ãŒãºã³ãè¡ããŸãã ãããã£ãŠãæ¯å¹Žã2é±éããšã«ãäŒè°ã§ã®å®å
šãªã¬ããŒãã«ååãªè³æãæºåããŠããŸãã 2011幎1æããæ¯é±ç«ææ¥ã«ãäŸå€ãªãã ãä»é±ã®æ¥ããšããæ°ããããã°ãšã³ããªãäœæããŸãããã®ããã°ãšã³ããªã§ã¯ããšã³ã·ã¹ãã ã§æãèå³æ·±ããã®ãã¹ãŠã確èªããŸãã ç§ã¯ä»ã®ããã°ãéå¶ããŠããŸããæåŸã®2æ©ã¯ã¡ããã©ããããã£ãŠããŸãã ããã«ãç§ã¯ã³ãŒããæžããäŒè°ã§è¬æŒããŸãã ãããã£ãŠãç§ã®ä»äºã«ã¯ããŸããŸãªæŽ»åãæ倧éã«å«ãŸããŠããŸãããèªåã®æŽ»åã1ã€ã«å¶éããããšãã§ããŸãã ããã°ãæžããããåç»ãäœã£ãããã人ãããŸããã圌ãã¯ãšãŠãããŸããã£ãŠããŸãã äžéšã®äººã¯æ
è¡ããããŸãããããªã³ã©ã€ã³ã§ã»ãããŒãå®æœããŠããŸãã ç§ã®ã¢ãããŒãã¯ä»ã®ã¢ãããŒããšã¯ç°ãªããŸãããæçµçã«ã¯ããã®æŽ»åã¯ãã¹ãŠåãç®æšãè¿œæ±ããŸãã
ãšããã§ãç§ã®è²¬ä»»ã«ã¯ããã¥ãŒããªã¢ã«ã®äœæãããã°äœæãªã©ãå«ãŸããŸãã ç§ã«ãšã£ãŠããã¯éåžžã«é£ãããä»»æã®æéããããå¯èœæ§ããããŸãã ããªãã«ãšã£ãŠã©ãã»ã©é£ããã§ããïŒ 1ã€ã®Spring Tipsãããªãæºåããã®ã«ã©ããããæéãããããŸããïŒ
èšãã®ãå¿ããŠããŸãã-æ°ããããããã£ã¹ããå
¥æããŸãããããŸã äœãåºãŠããŸãããã7ã€ã®ã€ã³ã¿ãã¥ãŒããã§ã«æºåãããŠããŸã:-)æºåã®æéã«é¢ããŠã¯ãããŸããŸãªæ¹æ³ã§èµ·ãããŸãã åãäžããããšæ±ºãããããã¯ã«ãã§ã«ç²ŸéããŠããå Žåã¯ã座ã£ãŠãã¹ãŠã2ã3åèšé²ããå¿
èŠããããŸããåžžã«å€ãã®ééããç¯ããŸãã 1é±éã«1åãã€ãŸãããã4æéããããŸãã ããããä»ã®ã±ãŒã¹ã§ã¯ããã§ã¯ååã§ã¯ãããŸããã æã
ç§ã¯åé¡ãç 究ãããããäœã¶æãã¡ã¢ãããããããã®ä»äºã¯ãã§ã«çµãã£ãŠããã®ã§ããªããããã®ã¡ã¢ã®ãããªãäœããªããã決ããŸãã ããªããããã§ããããã«ãç§ã¯åžžã«åŠãã§ããŸãã ãããããããªã®ããã«ç¹å¥ã«äœããåŠã¶å¿
èŠãããç¶æ³ã¯ãŸãã§ãã ããã§æãé£ããã®ã¯ãåŠç¿ããã»ã¹èªäœã§ã¯ãªãã座ã蟌ãã§ãããã¯ãæãäžããããã«å¿
èŠãªãã®ã決å®ããããšã§ãã
ç§ãã¡ã®ããŒã ã®ããã°ã©ããŒã¯ããããŸã§èª°ãäœæããããšããªããã®ããªãªãŒã¹ããããšããããŸãã ãã®ç¶æ³ã§ã¯ãåœç¶ã人ã
ã¯è³ªåãæã¡ããããã®è³ªåã¯ããã©ã«ãã§ããã°ã©ããŒã«æããããããŸãã ãããŠããã¹ãŠã説æãããããªãäœæããããããããã¯ãŒã¯ã«äºåã¢ããããŒãããŠã人ã
ããäºããç¥ãæéãããããã«ããŸãã æããã«ããã®ç¶æ³ã§ã¯ãç§ãåŠã¶å¿
èŠããããŸã-ç§ãã¡ã¯ãŸã£ããæ°ããäœãã«ã€ããŠè©±ããŠããããã§ãã
çŸåšãSpringã«ã¯ããã€ã®ãããžã§ã¯ãããããŸããïŒ
ãã質åã§ãã æ°ååã ãšæããŸãã éåžžã«å°éçãªã¢ãžã¥ãŒã«ãããããã®äžéšã¯ã³ãã¥ããã£ã«ãã£ãŠéçºãããäžéšã¯Pivotalã®SpringããŒã ããŸãã¯ä»ã®å€§äŒæ¥ã«ãã£ãŠéçºãããŠããŸãã Google GCPã®ãã¹ãŠã®ãµããŒãã¯Googleã§è¡ãããMicrosoft Azureã®ãµããŒãã¯Microsoftã§è¡ãããŸããã ããããããšãã°MyBatisã®ããã«ãã³ãã¥ããã£ã«ãã£ãŠå€ããéçºãããŠããŸãã ããã«ãNeo4jã°ã©ãããŒã¿ããŒã¹çšã®ã¢ãžã¥ãŒã«ã§ããSpring Data Neo4jãªã©ãåå¥ã®ã¢ãžã¥ãŒã«ããããŸãã ããã¯Spring Dataãããžã§ã¯ãã®äžéšã§ãããNeo4jãšã®ã³ã©ãã¬ãŒã·ã§ã³ã§è¡ããã圌ãã¯ãã®ãããžã§ã¯ãã®äž»ãªä»äºãããŸããã圌ã¯ã¡ããã©gitãªããžããªã«äœãã§ããŸããã ãã®ãããªäŸã¯ãããããããŸãã
Spring Bootã«é¢ããŠã¯ãèªåæ§æãšåŒã°ããçŽ æŽãããã¡ã«ããºã ããããŸãã ããã¯äººã
ã圌ããåãçµããã®ãã°ã«ãŒãåãã䟿å©ãªæ¹æ³ãæäŸããŸãã ãŠãŒã¶ãŒã¯JARãã¡ã€ã«ãã¯ã©ã¹ãã¹ã«ããŠã³ããŒãããã ãã§ãå®è¡äžã®Spring Boot Appã«èªåçã«è¿œå ãããŸãã ãšã³ã·ã¹ãã ã«ã¯ãã®ãããªèªåæ§æããããããããŸãããéèŠãªéšåã«ã€ããŠã¯ç¥ããŸããã ãã©ã°ã€ã³ã®ããã«æ©èœããŸãã
ãããŠããã®ãããªããŸããŸãªãããžã§ã¯ããã¹ãŠã§ãŠãŒã¶ãŒãç解ããæ¹æ³ã¯ïŒ äžè¬çãªæ§é ãã¢ã€ãã¢ã¯ãããŸããïŒ
ã»ãšãã©ã®å Žåããã¹ãŠã®ãããžã§ã¯ããå¿
èŠã«ãªãããã§ã¯ãããŸããã ç®æšãæå®ããããã«åºã¥ããŠç®çã®ãããžã§ã¯ããéžæããŸãã 人ã
ããæ¥ãåŠã¶ãããšãè©Šã¿ããšããç§ã¯ããã奜ãã§ã¯ãããŸãã-ããã¯ç¡æå³ãªéåã§ãã 質åã¯æ¬¡ã®ããã«ãªããŸããããšãã°ãREST APIãæžãå¿
èŠããããŸãã ç§ã®æåã®ã¹ãããã¯spring.io/guidesã«è¡ãããšã§ããããã§ã¯ 10ã15åãããã·ã³ãã«ã§æé ãªäŸ¡æ Œã®ã¬ã€ããèŠã€ããããšãã§ããŸãã ç¥ã£ãŠããå¿
èŠã®ãããã¹ãŠã®ãã®ããããŸããã©ã®ã³ãŒããæžãããã©ã®ãã©ã«ããŒã«å
¥ããããIntelliJãEclipseãªã©ã§ãããè¡ãæ¹æ³ã§ãã ãããã®ã¬ã€ãããã¹ãŠã®äººãã¢ã¯ã»ã¹ã§ããããã«ããããããã¹ãŠã詳现ã«èª¬æããäœãçç¥ããªãããã«ããŸãã JMSãNeo4jãã»ãã¥ãªãã£ããµãŒããããã¬ãŒã«ãŒãKafkaãªã©ãããªããäœãããã«ããŠãããããã¯ããšã«åå¥ã®ã¬ã€ãããããŸãã ã¿ã¹ã¯ã決å®ããé©åãªã¬ã€ããéžæããŸãã Springã«ã€ããŠã§ã¯ãªããã·ã¹ãã ãšçµ±åãããã®ã«ã€ããŠèããå¿
èŠããããŸããSpringã¯ããã®çµ±åãå¯èœã«ããåãªãããŒã«ã§ãã ãããã£ãŠããSpringãåŠç¿ããããšããæå³ã¯ãããŸãããç¹å®ã®ã¿ã¹ã¯ãç°¡çŽ åã§ããå Žåã¯ãããã䜿çšããå¿
èŠããããŸãã
ããªãã®æèŠã§ã¯ãæ¥ã®ã©ã®ãããžã§ã¯ããæãææã§ããïŒ ãŸãã¯æãéå°è©äŸ¡ãããŠããŸããïŒ
Spring Retryã©ã€ãã©ãªã¯éåžžã«äººæ°ããããŸãã ããšããšã¯Spring Batchã§éçºãããŸããã Spring Batchã䜿çšããããšããããã©ããã¯ããããŸãããããšãã°ããã¡ã€ã«ã·ã¹ãã ãXMLãCSPãã¡ã€ã«ãªã©ã®ããã¥ã¡ã³ããªã©ã倧éã«é 次éä¿¡ãããããŒã¿ãåŠçã§ããŸãã ãã®ããŒã«ã䜿çšããããã®ãªãã·ã§ã³ã®1ã€ã§ã¯ãã¬ã³ãŒããèªã¿åã£ãŠããæžã蟌ã¿ãŸãïŒããšãã°ãWebãµãŒãã¹ããã¡ãã»ãŒãžãã¥ãŒãžïŒã ãã®ããŒã¿ã®åŠçã«ã¯æ°æéãããå ŽåããããæåŸã®1ã€ã®ãšã©ãŒã®ããã«ã·ã¹ãã ãå€éã«è¡ããããã¹ãŠã®äœæ¥ãããŒã«ããã¯ããå Žåãéåžžã«æãŸãããããŸããã ã§ããŸãã Spring Batchã¯ããŒã¿ãã±ãããåŠçãã1ã€ã§ã¯ãªã10ãŸãã¯1000ã®ã¬ã³ãŒããåŠçããŸãã æ°åã®ã¬ã³ãŒãã®åŠçã倱ãããå Žåã§ããæ®ãã¯ãã¹ãŠä¿åãããŸãã ããã«ãããã±ãŒãžã·ã¹ãã ãäœæãããšãã¯ã倱æããå¯èœæ§ã®ããä»ã®ãµãŒãã¹ã«ã¢ã¯ã»ã¹ããå¿
èŠãããããšã«çæããå¿
èŠããããŸãã ããã«ã¯Spring RetryããããŸãã ãã®ã©ã€ãã©ãªã䜿çšãããšããµãŒãã¹ãç¹°ãè¿ãåŒã³åºãããšãã§ããŸãã ããã«ãææ°é¢æ°çãªã·ã£ãã¿ãŒã¹ããŒãã䜿çšã§ããŸãã Spring Batchã«å ããŠãSpring Retryã¯Spring IntegrationãSpring Cloud StreamãSpring Cloud Data Flowã§ã䜿çšãããŸãã æåŸã®2ã€ã§ã¯ãSpring Retryãä»ã®äœããšé¢é£ããŠããããããµããŒãããŠããŸãã ãããã£ãŠããã®ã©ã€ãã©ãªã¯å€ãã®Springãããžã§ã¯ãã§äœ¿çšãããŠããã誰ãããããç¥ã£ãŠãããã©ããã¯ããããŸããã Spring Retryã¯éåžžã«é »ç¹ã«äœ¿çšãããã©ã€ãã©ãªã§ãããèŠèœãšãããããšããããŸãã äžè¬ã«ãå€ãã®ç°ãªãäºåŸå¯Ÿå¿ââããããŸãã 圌ãã¯éåžžãæãèå³æ·±ãã§ãã
ãªãæ£ç¢ºã«åå¿äž»çŸ©ãªã®ãïŒ
ã©ãã«ã§ãåå¿æ§ããããŸãã Springã®å©ç¹ã¯ãSpringã䜿çšããŠãããžã§ã¯ããéå§ããã³çµäºã§ããããšã§ãã ä»é±ãFacebook RSocketãããžã§ã¯ãããµããŒãããããšãçºè¡šããŸããã ããã¯gRPCã®å®å
šã«åå¿ããé¡äŒŒç©ã§ãããéåžžã«æè»ã§ãã ãã/ãµããã¹ããªãŒãã³ã°ããŒã¿ãã¯ã©ã€ã¢ã³ãèŠæ±/å¿çã«äœ¿çšã§ããŸããäžè¬çã«ãããŸããŸãªã¡ãã»ãŒãžã³ã°ãã¿ãŒã³ãå®è£
ã§ããŸãã ãããŠãããã¯Facebookã§äœ¿çšãããŠããŸãã 2ã€ã®ãã³ãã«ãããã1ã€ã¯C ++ã«ããã1ã€ã¯Javaã«ãããŸãã Javaã®ãã®ã¯ããªã¢ã¯ãã£ãã©ã€ãã©ãªã§ããReactorã䜿çšããŠèšè¿°ãããŠããŸãã 圌女ã¯Salesforceã䜿çšããŠããŸãã ãã¡ãããä»ã®ãªãã·ã§ã³ããããŸãã GoogleããgRPCã«ã€ããŠèããããšããããŸããïŒ ããã¯éåžžã«é«å質ã§èå³æ·±ããã®ã§ããããªã¢ã¯ãã£ãã§ã¯ãããŸãããããã©ã«ãã§ã¯ããªã¢ã¯ãã£ãåã§ã¯ããŸãæ©èœããŸããã Salesforce gRPCã«ã¯ãã®æ¬ ç¹ã¯ãããŸããã 圌ã¯Spring Reactorã«åºã¥ããŠãµãŒãã¹ãäœæããã³ã³ãã€ã©ãæã£ãŠããŸãã ãã®ãããFacebookãšSalesforceã®äž¡æ¹ã¯ãReactorãããŒãºã«åãããŠæ¡åŒµã§ããŸããã
Reactorèªäœã¯ãç§ãã¡ã®æãèå³æ·±ããããžã§ã¯ãã®1ã€ã§ãã RxJavaã¯ä»¥åã«ç»å ŽããŸããããReactorã¯ãªã¢ã¯ãã£ãã¹ã¬ãããµããŒããæäŸããæåã®è£œåã§ãã ããã¯äž»ã«ãçŽ æŽãããããã°ã©ããŒã§ããRxJavaãããžã§ã¯ããããŒãžã£ãŒã®David KarnockãReactorã§ç§ãã¡ãšååããŠããããã«èµ·ãããŸããã ãã®ãããç§ãã¡ã®ãšã³ã·ã¹ãã ã§èµ·ãã£ããã¹ãŠã®æ°ãããŠèå³æ·±ãããšã®ããªãã®éšåãäœããã®åœ¢ã§Reactorã«è§ŠããŸããã ãã®ãããã§ããã®ãããžã§ã¯ãã¯å€§èŠæš¡ãªã·ã¹ãã ãäœæããäŒæ¥ã«ãšã£ãŠéåžžã«é
åçãªãã®ã«ãªããŸããã Reactorã¯ãSpring WebFluxãã¬ãŒã ã¯ãŒã¯ã®åºç€ã«ããªã£ãŠããŸãã ãŸããReactorã«åºã¥ããŠããªã¢ã¯ãã£ãã¡ãã»ãŒãžã³ã°ããªã¢ã¯ãã£ãWebãœã±ãããSpring Cloud Streamããªã¢ã¯ãã£ããµãŒããããã¬ãŒã«ãŒãªã©ããµããŒãããŸããããããã®ã³ã³ããŒãã³ãã¯ãã¹ãŠãªã¢ã¯ãã£ãã¢ããªã±ãŒã·ã§ã³ã«çµ±åã§ããŸãã ãã¡ãããSpringã䜿çšããããšãã§ããŸããããããã®ãªã¢ã¯ãã£ãã¿ã€ãã§ãšã³ã·ã¹ãã å
šäœã䜿çšããããšã奜ã¿ãŸãã
ããã«ãæè¿ãåå¿åãã©ã€ããŒã®SQLããŒã¹ã®ããŒã¿ã«ã¢ã¯ã»ã¹ããããã®APIã§ããR2DBCã«ã€ããŠçºè¡šããŸããã ãªã¢ã¯ãã£ãJDBCã¯ãŸã ååšããŸããã åé¡ã¯ããªã¢ã¯ãã£ãã³ãŒãã䜿çšããå Žåãããã¯ã䜿çšã§ããªãããšã§ãã ããã¯ã䜿çšããå Žåããã®çžäºäœçšãæ¡å€§ããŠãã¹ã¬ããæ°ãå¢ããå¿
èŠããããŸãã ã¹ã¬ããã®æ°ãå¢ããããšã§ã¹ã±ãŒãªã³ã°ãåé¿ãããã ããªã®ã§ãããã¯å
ã®ç®æšãšççŸããŸã-ããã¯é«ãããŸãã ãããã£ãŠãR2DBCã¯ããªã¢ã¯ãã£ããªããŒã¿ã¢ã¯ã»ã¹ãæäŸããæœè±¡åãæäŸããŸãã æåã«åå¿ããããŒã¿ããŒã¹ãã©ã€ããŒããããŸã-ããšãã°ãPostgresã ãããã£ãŠãã¹ã¬ããããªããããç¹ã«Postgresã§R2DBCã䜿çšããããã¯ã䜿çšããã«ãªã¢ã¯ãã£ãSQLã§äœæ¥ã§ããŸãã ãã®ãããã¯å
šäœã¯ç§ã«ãšã£ãŠéåžžã«èå³æ·±ãããã§ãã
ãããããããããæè¡çãªè³ªåã«çããããã§ããããïŒ åé¡ã®1ã€ã¯ãè€æ°ã®Springãããžã§ã¯ãã䜿çšãããšãå€ãã®æ³šéãåæã«çºçããããšã§ãã ããããã®æ©èœãç解ããã®ã¯é£ãããªããŸããCtrlããŒãæŒããªããã¯ãªãã¯ããŠå®çŸ©ã«ç§»åããããšã¯ã§ããŸããã ãã®ãããªç¶æ³ã§ã©ã®ããã«è¡åããã®ã§ããïŒ
`--debug`ãªãã·ã§ã³ã§å®è¡ããå¿
èŠããããŸãã çŸåšãSpringãšã³ã·ã¹ãã ã®å€§éšåã¯èªåæ§æãšããŠååšããŠããŸãã äžéšã¯ã€ã³ããŒããããèšå®ã®ãããªãã®ã§ãããã®å Žåã泚éãã¯ãªãã¯ãããšãã@ Importããšããç¢æã衚瀺ããããã®ã¯ã©ã¹ã«ãã®ã¯ã©ã¹ã瀺ãããŸãã ãããã¯ãªãã¯ãããšãäœæããããªããžã§ã¯ãã衚瀺ãããŸãã ãã ããSpringã¯èªåæ§æã¡ã«ããºã ãä»ããŠåäœããå ŽåããããŸãããã®å Žåã泚éã¯äœæãããŸããã ã©ã€ãã©ãªãšã¯ã©ã¹ãã¹ã®ã¿ããããŸãã ãããããäœãèµ·ãã£ãŠããã®ãããªãèµ·ãã£ãŠããã®ããææ¡ããã®ã¯æ¬åœã«é£ããã§ãã ãããã人ã
ããããç解ã§ããããã«ãã§ããéãç°¡åã«ããããšèããŠããŸãã ãã®ããã«ãã¢ããªã±ãŒã·ã§ã³ã®èµ·åæã«å
¥åããå¿
èŠãããã--debugããã©ã¡ãŒã¿ãŒããããŸãã 次ã«ãèµ·åæã«ã¢ããªã±ãŒã·ã§ã³ã«ãã£ãŠå®è¡ããããã¹ãŠã®ã¹ããããèšè¿°ãããã¬ããŒãã衚瀺ãããŸãã ã¢ããªã±ãŒã·ã§ã³ã¯ãç¹å®ã®ãã£ãŒã«ããŸãã¯ã¯ã©ã¹ãååšãããã©ããã確èªããããã«å¿ããŠããªããžã§ã¯ããäœæãããã©ããã決å®ããŸãã ã¬ããŒãã«ã¯ãã©ã®æ¡ä»¶ãæºããããããæºããããŠããªãããã©ã®æ§æããã§ãã¯ã«äŸåããªãã£ããã瀺ãããŸãã ããšãã°ãKafkaãžã®æ¥ç¶ãæ©èœããªãçç±ãç解ã§ããªãå Žåã察å¿ããæ¡ä»¶ã確èªã§ããŸããã¯ã©ã¹ãã¹ã«å¿
èŠãªã¯ã©ã¹ããªãå¯èœæ§ããããŸãã
ããŠããããŒãªã³ã°ã®è³ªåãå°ããããŸãã Springã®å察è
ã¯ã @Autowired
ã©ãã§ãã©ãã§ãç°¡åã«äœ¿çšã§ãããããäœå質ã®ã¢ãŒããã¯ãã£ã®åå ã§ãããšãã°ãã°äž»åŒµããŸãã ãã®æèŠã«åæããŸããïŒ 10幎åãã¢ãŒããã¯ãã£ã¯3ã€ã®å±€ã§äœæãããå€ãã³ã³ã¹ãã©ã¯ã¿ãŒããã³ã³ã¹ãã©ã¯ã¿ãŒã«è»¢éãããDTOãäœæãããŸããã Springã䜿çšãããšãããããã¹ãŠåãé€ãããšãã§ããŸãã ããã¯è¯ãã§ããæªãã§ããïŒ
Springã¯ããŒã«ã§ãã ããã«ãããããå€ãã®äººãæ¬çªç°å¢ã«æ¥ãŠæ£åžžã«åäœãããœãããŠã§ã¢ãäœæã§ããããã«ãªããããæ害ã§ã¯ãªããšæããŸãã è¿å¹ŽãäœçŸäžäººãã®äººã
ãããã䜿çšããŠã¢ããªã±ãŒã·ã§ã³ãäœæãããã¹ãŠãããŸãæ©èœããŠããŸãã æ¥å
šäœãæ害ã§ãããšèããã®ã¯ã°ãããŠãããšèãããšããã®ãããªæèŠã¯ç¡ç¥ãšã¯èšããŸããã
Springã§ã¯ããŸã£ããæ瀺çãªã¯ã€ã€ãªã³ã°ãäœæã§ããŸãã ç¹å®ã®ãªããžã§ã¯ããã©ãããæ¥ãã®ãããããªãããšãå¿é
ãªå Žåã¯ãèªåã§ãã€ã³ãã§ããŸãã ããã¡ãœãããå¥ã®ã¡ãœãããåŒã³åºããåŒã³åºãããã¡ãœããã®åºåå€ããã³ã«ãªãJavaæ§æãäœæã§ããŸããSpringãåŠçããŸãã åããã³ãç¹°ãè¿ããŸãã¯åååŒã³åºããŠãããã®ãªããžã§ã¯ããã·ã³ã°ã«ãã³ã§ããå Žåãè€æ°ã®ãªã³ã¯ã¯ãããŸããã ããªãã¯ãã¹ãŠãæ瀺çã«ããã-ãããè¡ãããšãã§ããŸãã å¿
èŠã«å¿ããŠãããã«éå±ãªãªãã·ã§ã³ã§ããXMLã䜿çšã§ããŸãã èŠããã«ãã@ Autowiredãã䜿çšããããªãå Žåã¯ããããå®å
šã«åé¿ã§ãããšããããšã§ãã
æãäžè¬çãªæ¹æ³ã§Spring Bootã䜿çšããå ŽåãBeanã¯1ã€ã®ã¿ã«ãªããŸãã `ConnectionFactory`åã®Beanãå¿
èŠã§ããããšã¯ãåç¥ã§ã-ãã®å Žåãåããšã«ã€ã³ãžã§ã¯ã·ã§ã³ãè¡ãã®ã«åé¡ã¯ãããŸããã ãŸã ãªããžã§ã¯ãã¯1ã€ãããããŸããã1ã€ã®Connectionã«å¯ŸããŠ2ã€ã® `ConnectionFactory`ã¯ãããŸããã 2ã€ã®Hibernateã»ãã·ã§ã³ã¯ãããŸããã®ã§ã `HibernateSession`ã®æ¿å
¥ã劚ãããã®ã¯ãããŸãã-åäžã®ã€ã³ã¹ã¿ã³ã¹ã«ååšããŸãã ãã¹ãŠãæ瀺çã«ãããå Žåã¯ã `@ Qualifier`ã¢ãããŒã·ã§ã³ã䜿çšã§ããŸãã ããã䜿çšããŠãã¿ã€ãå¥ã«æ³šå
¥ãããã®ãããŒã¯ããŸãã ããã«ãããç°ãªããã³ã®å®è£
ãäºãã«åºå¥ããããšãå¯èœã«ãªããŸãã ããå Žæã®ã¢ããªã±ãŒã·ã§ã³ãiTunesãšãå¥ã®å ŽæïŒAmazonãš3çªç®ïŒã§Android Playã¹ãã¢ãšéä¿¡ã§ãããµãŒãã¹ããããšããŸãã ç°ãªãã¿ã€ãã®3ã€ã®ç°ãªãBeanã«ãªããŸãããããããã« `@ Qualifier`ã¢ãããŒã·ã§ã³ããããŸãã ããã«ããã®æ³šéã¯å¥ã®æ³šéã«éãåãããããšãã§ãããããåã®å®å
šæ§ã確ä¿ãããŸãã ãã®åããã€ã³ããããã®äžã«æ³šéãä»ããŸããBeanãäœæããããšãæ¶è²»è
ã®ãµã€ããå«ãã `@ Qualifier`泚éãä»ããããŸãã ãããã£ãŠããããã®æ³šéã¯ãªã³ã¯ãæäŸããããã°ã©ã ã®å®è¡äžã«3ã€ã®å®è£
ãååšããå Žåã§ããå¿
èŠãªãã®ãèŠã€ããããšãã§ããŸãã
ã€ãŸããäžè¬ã«ãããªãã®æèŠã§ã¯ãæè»æ§ã¯ãã©ã¹ã®æ©èœã§ãã ããªããšSpringããŒã ã¯ãZen Zenã®ãããªåºæ¬ååãé å®ããŠããŸããïŒ
ã¯ããåºå·ããŸãã ã¡ãªã¿ã«ãç§ã¯90幎代åŸåããPythonã§ããã°ã©ãã³ã°ãããŠãããPython Zenã®å€§ããªæ¯æè
ã§ãããéåžžã«æ£ããäžè¬çãªèãæ¹ãæã£ãŠããŸãã 質åã«é¢ããŠã¯ãSpringã®å
±åèšç«è
ã§ããããããžã§ã¯ãã«æºãã£ã2人ç®ã®éçºè
ã§ããJÃŒrgenHöllerã«ã€ããŠã話ãããå¿
èŠããããŸãã ããã¯ãšãŠãåªãã人ã§ããšãŠãéãã§ãç§ãã³ãã¥ãã±ãŒã·ã§ã³ãåããªããã°ãªããªãæé«ã®äººã®äžäººã§ãã ããšãã°ãäŒè°ã§åœŒã«äŒã£ãå Žåã圌ãšè©±ãã®ã¯éåžžã«ç°¡åã§ãã åæã«ã圌ã«ã¯åŒ·åãªç¥æ§ããããæ¥ãžã®åœŒã®è²¢ç®ãé倧è©äŸ¡ããããšã¯å°é£ã§ãã JAXã«ã³ãã¡ã¬ã³ã¹ã¯ãéåžžã«éèŠã§ããããã¡ãããžã§ãŒã«ãŒã«ã¯å±ããŸããã§ãã:)-圌ã«ããããŸã§èª°ãåãåã£ãããšã®ãªãä»äºã«å¯ŸããŠç¹å¥ãªè³ãæäžããŸããã éåžžãè³ã¯ç¹å¥ãªã«ããŽãªãŒã§äžããããŸãããããã¯ã«ããŽãªãŒããªãããŠã«ã²ã³ã«ã®ã¿å±ããŸãã Springã¯Javaãšã³ã·ã¹ãã ã§å¯äžã15幎ãæžãçŽãããŠããªããããžã§ã¯ãã§ããå¿
èŠããªãããã§ãã ãŠã«ã²ã³ã«ã¯ãã¢ãžã¥ãŒã«ã®èšè¿°æ¹æ³ãåã®è¡šçŸæ¹æ³ãäžè¬çã«ã¯äœå幎ãã®éå¿
èŠã«å¿ããŠç°¡åã«å€æŽã§ããé«å質ã®ã³ãŒãã®ããŒã¹ãäœæããæ¹æ³ã«ã€ããŠéåžžã«æ確ãªèãããããŸãã Javaãšã³ã·ã¹ãã ã«ã¯ããã®ãããªãããžã§ã¯ãã¯ä»ã«ãããŸããã ãããžã§ã¯ãã®å€§éšåã¯ãã¯ãååšããããŒãããæžãçŽããããããžã§ã¯ãã®äžã§ãã15幎çããŠãã人ã¯ã»ãšãã©ããŸããã
æåããéåžžã«ãããã«æžãããŠãããããæžãçŽãããã«15幎ã ãç¶ããã®ã¯Springã ãã§ãã ãŠã«ã²ã³ã¯ãç§ãã¡ãåŸãããã€ãã®åºæ¬ååãæããŸããïŒã¢ãžã¥ãŒã«ã®äœææ¹æ³ãå®è£
ããã±ãŒãžã®äœææ¹æ³ïŒå
¬ééšåãšã¯å¯Ÿç
§çã«ïŒãAPIã®è¡šé¢ã¬ãã«ã®èšè¿°æ¹æ³ãAPIã®èšèšã¿ã€ãã䜿çšãããã¿ãŒã³ã Springã䜿çšãããšãå¿
ç¶çã«ãã¶ã€ã³ãã¿ãŒã³ã«ç²Ÿéããããšã«ãªããåžžã«ããã§ããã ãã¿ãŒã³ãã¿ãŒã³ã®äŸãããã«æãæµ®ãã³ãŸãã Spring Integrationã¯ãšã³ã¿ãŒãã©ã€ãºçµ±åãã¿ãŒã³ã玹ä»ããSpring MVCã¯MVCã玹ä»ããŸãã ãããã®ãã¿ãŒã³ã¯ãã¹ãŠãã¬ãŒã ã¯ãŒã¯ã®äžéšã§ãããå®èšŒæžã¿ã®ãã©ã¯ãã£ã¹ã«åºã¥ããŠäœ¿çšããŸãã ç§ãã¡ã®çŠ
ã¯ããŠã«ã²ã³ãæããŠãããååã§ãã ãã®ç¹ã§ãç§ãã¡ã¯ãã¹ãŠåœŒã®åŠçã§ãã ãŠã«ã²ã³ã¯ãã³ãŒãã®èšè¿°æ¹æ³ã«å¯Ÿããå°ãå¥åŠãªã¢ãããŒãã§ç¥ãããŠããŸã-圌ã®ãããŒã®ããã«ãç¹å¥ãªçšèªãjurgenizeããçããŸããã ç§ãã¡ã®ããŒã ã«ã¯ãåªç§ãªçµéšãæã€éåžžã«åªç§ãªäººãå€ãããã§ã«åŠäœãšã¯ããããããæã£ãŠãã人ãããŸãã ããã«ããããããããŠã«ã²ã³ã¯ã³ãŒãã«ç¬èªã®å€æŽãå ããŸãã ã¹ããŒã¹ã®è¿œå ãã¯ãªãŒãã³ã°ãªã©ã®å°ããªããšããããŸãããã³ãŒããæåãã1,000å以äžæžãçŽããããã³ãŒãã®äœæè
ãå€æŽãããããããšã¯ãããŸãããã€ãŸããå
ã®äœæè
ã®ååã§ã³ãããããŸãã ãããã®å Žåãã³ãŒãã¯ãåæ³åãããããã€ãŸãä¿®æ£ããããšèšãããŠããŸãã JÃŒrgenã®ãããã§ãç§ãã¡ã®ã³ãŒãã¯ãšãŠããããã§ãã ã³ãŒãåââæããŒã«ã®å Žåãéåžžã«ã¯ãªãŒã³ãªã³ãŒãããããããSpringã§å°ãªããšãäœããã®èª€åäœãèŠã€ããããšã¯é«å質ããŒã¯ãšèŠãªãããŸãã äžè¬ã«ãååã詳现ã«èª¬æããããšã¯ã§ããŸãããããããã¯ããã«ããããŠã«ã²ã³ã«ãã£ãŠå®ããããŠããããã¹ãŠã®Springãããžã§ã¯ãããããã«åŸã£ãŠããŸãã Spring Bootã«é¢ããŠã¯ãã¢ãžã¥ãŒã«ãäœæããããã®éåžžã«æ£ç¢ºãªã«ãŒã«ãããããããã¹ã¿ãŒã¿ãŒãšåŒã³ãŸãã
OKãçããŠãããŠããããšãã æåŸã®è³ªåã¯ããã©ãŒãã³ã¹ãšJava 11ã«ã€ããŠã§ããç§ã®ç¥ãéããSpringã¯åžžã«å®è¡æã«ã³ã³ããã¹ããçæããŸãã å€ãéè¡ããã°ã©ã ã§ã¯ãããã«æ°åããæ°æéãããå ŽåããããŸãã
ããïŒ ä¿¡ããããŸãã
æ£çŽãèªåã®ç®ã§èŠãã
ããããæ¥ã«ãªãããšã¯ã§ããŸããã æãããHibernateã§æãããããšãè¡ãããŸãã Beanã¯æ°çŸäžåäœã§çæã§ãã空ã®Beanã¯éåžžã«è¿
éã«ã³ã³ãã€ã«ããã³å®è¡ã§ããŸãã ããŒã¿ããŒã¹ãæ€èšŒãªã©ããæ
å ±ãããŒãããã«ã¯æéãããããŸããããã«ãããSpringãé
延ããå¯èœæ§ããããŸãã ããããSpringèªäœã¯éåžžã«é«éã§ãã
ã¯ããHibernateã«ã¯äœããã®ææããã£ããšæããŸãã ããã«ãããããããSpringã¯30ç§ãæã«ã¯1ã2åã§éå§ããŸããããã§ããŸã ããªãé·ãæéã§ãããã ããšãã°ãDockerã§å®è¡ããå Žåãã³ã³ãããããã«èµ·åããå¿
èŠããããŸãã Springã®èµ·åæéãççž®ããããšã¯å¯èœã§ããïŒ
Springãéå§ããã®ã«2ç§ãããããŸããã ãŸããSpring Cloud Functionã䜿çšãããšããã®æéã0.5ç§ä»¥äžã«ççž®ã§ããŸãã ããšãã°ãSpring Cloud Functionã®Spring Bootãªã©ã0.5ç§ã§åé¡ãªãå®è¡ããããããžã§ã¯ãããããŸãã ã ãããåã³ãåé¡ã¯æ¥ã§ã¯ãããŸããããããªãã圌ãã«äœãããããããã¯ã°ã©ãŠã³ãã§äœãèµ·ãã£ãŠããã®ã§ãã-ã€ã³ã¿ãŒãããäžã®å¥ã®ããŒã¿ãœãŒã¹ã«ã¢ã¯ã»ã¹ã§ããŸãããã€ã³ã¿ãŒããããããã¡ã€ã«ãããŠã³ããŒãããŸãããã°ãªããã«ããŒã¿ãã¢ããããŒãããŸããã å°èŠæš¡ãªãã€ã¯ããµãŒãã¹ã®ã¿ãè¡ãå Žåãã·ã¹ãã ã¯éåžžã«é«éã«åäœããã¯ãã§ãã ã¢ããªã±ãŒã·ã§ã³ã®å®è¡æéãéåžžã«é·ãå Žåãäœãåé¡ããããŸãã
ãªãã»ã©ã ãšããã§ãGraalVMãšAOTã«ã€ããŠèããããšããããŸããïŒ
ã¯ã ããå°ãã話ãããŸããSpringFuãããžã§ã¯ãããããŸãã 圌ã¯å®éšçã§ãæ¥ã®ãã³ãã·ãªãŒãºãã圌ã«é¢ãããããªãæ®åœ±ããŸããã Kotlinã§äœæããŸããããçŸåšã¯Java APIãåããŠããŸãã ãã®ãããžã§ã¯ãã¯ãGraalVMãªã©ã®ç°å¢çšã«äœæãããŸããã Spring Fuã¯ãåçã«çæããããããã·ãŸãã¯ã@ Configurationãã䜿çšããŸããã GraalVMã®ãã€ãã£ãã€ã¡ãŒãžãžã§ãã¬ãŒã¿ãŒã¯ãããŒããããã¯ã©ã¹ãç¥ãå¿
èŠããããŸãã ãã ããcglibãŸãã¯Byte Buddyã䜿çšããŠåçã«ããŒãããå Žåãããã«ããGraalVMã®äœ¿çšãå°é£ã«ãªããŸãã HibernateãSpringãããã³åçã«çæããããããã·ã䜿çšããä»ã®ãã¹ãŠã®ã©ã€ãã©ãªã¯ããã€ãã£ãã€ã¡ãŒãžã®äœæã«ã¯ããŸãé©ããŠããŸããã ãããã£ãŠãæ¥é¢šã«ã¯ãã®ãããªãã®ã¯ãããŸãããããã¯çŽæ¥è¿°ã¹ãããŠããŸãã ãŸã Springã䜿çšããŠããŸãããã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããæ¹æ³ã¯ç°ãªããŸãã ãŸããSpring Fuã®å©ç¹ã®1ã€ã¯ãGraalVMãšããŸãæ©èœããããšã§ãã ãããŠãä»ããã¢ããªã±ãŒã·ã§ã³ãèµ·åããŸãã ã€ãŸããéåžžã¯å³åº§ã«ïŒå®å
šã«ã¡ã¢ãªã«æ ŒçŽããããšïŒ GraalVMã®ãã€ãã£ãã€ã¡ãŒãžãžã§ãã¬ãŒã¿ãŒã¯ãéçºã®éåžžã«åæã®æ®µéã«ããããšã«æ³šæããŠãã ããã ãã®ãããGraalVMã«ãã£ãŠèµ·åãããã¢ããªã±ãŒã·ã§ã³ã¯ããã«ããŒããããã«éå§ããå®è¡æã«ã¯ä»¥åãšåãé床ã«ãªããšæããããããå°é£ãçããããšããããŸãã ããããGraalVMã©ã³ã¿ã€ã ã§ã¯JVMã䜿çšããªããªã£ããããã·ã¹ãã ã®åäœãç°ãªãããããã®ããã«ã¯ãªããŸããã ãããã£ãŠããã®ãããžã§ã¯ãã®æ£åžžæ§ããã¹ãããŠãã ããããã ããããã¯ç¡æã®èµ·åå éã§ã¯ãªãããšã«æ³šæããŠãã ããã ããã§ããç§ã¯GraalVMãåãã§ããŸãã圌ãã®ããŒã ã¯ããã¬ãŒã ã¯ãŒã¯ãšã®é£æºãæ¹åããããã«å€å€§ãªåªåã泚ãã§ããŸãã
ãã¡ãããæåŸã®è³ªåã¯Java 11ã«ã€ããŠã§ãã
ã¯ãã圌女ã¯çŸããã§ãã
ãã®äžã§Springã«ãšã£ãŠäœã䟿å©ã§ããïŒ
Springéçºè
ã«ãšã£ãŠããã®ãã¯ãããžãŒãŸãã¯ãã®ãã¯ãããžãŒãéžæããäž»ãªåºæºã¯2ã€ãããŸãã1ãããžãã¹ããŒãºã«é©ããŠãããã©ããã2ãããã°ã©ããŒãšããŠé©ããŠãããã©ããã æåã®åºæºãšããŠããã®æè¡ãããé«éã§å®å®æ§ãæäŸãããã©ãããé·æçãªãµããŒãããããã©ããã ãããã¯ãã¹ãŠJava 11ã«ãããŸãã Java 8ã®ãµããŒãã¯ãŸããªãçµäºãããããé·æãµããŒãã®ãã次ã®ãªãªãŒã¹ã«ã¢ããã°ã¬ãŒãããããšã¯çã«ããªã£ãŠããŸãã ãšããã§ãç§ã®å人ã次ã®ããŒãžã§ã³ã«ã¢ããã°ã¬ãŒãããå Žåã¯ãOpenJDKã¢ã»ã³ããªã䜿çšããŠãã ãããããããç¹ã§åªããŠããŸãã æ£ããããŒãžã§ã³ãå
¥æããã®ã¯éåžžã«ç°¡åã§ãããã§ã«Twitterã§ããã«ã€ããŠæžããŠããŸãã ãã®ãªãªãŒã¹ã¯Springã§éåžžã«ããŸãæ©èœããŸã-å®å®ããŠããŸãã å°ãªããšãhttps://start.spring.ioã«ã¢ã¯ã»ã¹ã㊠ãæ°ãããããžã§ã¯ããçæããJava 11ãéžæãããšåäœããŸãã Java 11ã®ãµããŒãã¯ãIntelliJãšEclipseã®äž¡æ¹ã§å©çšã§ããŸãã
2çªç®ã®åºæºã«é¢ããŠã¯ãJava 11ã®Springéçºè
ã«ãšã£ãŠå€§ããªå€æŽã¯ãããŸããã `var`ãšHTTPã¯ã©ã€ã¢ã³ããç»å Žããã®ã¯ããããšã§ãããSpringã¯æ¢ã«ãªã¢ã¯ãã£ããªWebã¯ã©ã€ã¢ã³ããæã£ãŠããã®ã§ãHTTPã¯ã©ã€ã¢ã³ãã®æ©æµãåãããã©ããã¯ããããŸããã Java 10ãšJava 9ã«ã¯äŸ¿å©ãªãã®ãããã€ãè¿œå ãããŸãããããã«ãJavaããã°ã©ã ãã¹ã¯ãªãããšããŠå®è¡ã§ããããã«ãªããŸãã-ããã¯æªããããŸããã ãããSpringã§çã«ããªã£ãŠãããã©ããã¯ããããŸãã-äžæ¹ã§ãããã§ã¯ãããŸããã ãããã©ã®ããã«èŠããããç§ã«ã¯ããããŸããã
SpringãJava 11ã«åãæ¿ããã®ã¯å°é£ã§ãããïŒ
ãã Springã®äžå¿ã«ã¯ãéåžžã«é«å質ã®ã©ã€ãã©ãªãšãšã³ã·ã¹ãã ããããŸãã Springãã¬ãŒã ã¯ãŒã¯èªäœã¯ã¯ã©ã¹ãã¹ãšã¢ãžã¥ãŒã«ãã¹ã®äž¡æ¹ããµããŒãããŸãããå人çã«ã¯ã¢ãžã¥ãŒã«ãã¹ã®äœ¿çšã¯ãå§ãããŸããã æ£ãã䜿çšããã«ã¯ãä»ã®ãã¹ãŠã®ãã®ãã¢ãžã¥ãŒã«ãã¹ããµããŒãããå¿
èŠããããŸãã ãããŠãããã¯ãŸã äžå¯èœã§ããçŸåšãã©ã€ãã©ãªã§ã¢ãžã¥ãŒã«ãã¹ã®ãµããŒããæäŸããŠãã人ã¯å°ãªãããŸãã ã¯ã©ã¹ãã¹ã¢ãŒãã¯éåžžã«ããŸãæ©èœããŸãã CGLibãAspectJãããã³JAXB XMLã©ã€ãã©ãªã«ã¯ãJava 9ã«åãæ¿ãããšãã«èª°ããæ±ããŠããéåžžã«æšæºçãªåé¡ããããŸããããããã®åé¡ã¯ãã¹ãŠãæšå¹Žã«è§£æ±ºããããããJava 11ãžã®ç§»è¡ã容æã«ãªããŸããã
ãšããã§ãç§ãã¡ã¯Javaã®å°æ¥ã®ããŒãžã§ã³ã«ã€ããŠå€ãã®èå³æ·±ãããšãèšç»ããŠããŸããããšãã°ãLoomãããžã§ã¯ãã¯Javaã®ãã¡ã€ããŒã§ãã
Java 12ã«ãªããŸããïŒ
ããããããã§ã¯ãªãã§ããããã圌ãã¯ãããããªãé·ãéè¡ãã§ãããã
Kotlinãã³ã«ãŒãã³ã䜿çšããŠããããããã®ãããžã§ã¯ãã¯éåžžã«èå³æ·±ããã®ã§ãã 圌ãåºãŠãããšãã¯ãã€ã§ãã圌ã¯å€§ããªæ©æµãåããã§ãããã ãªã¢ã¯ãã£ãã³ãŒããäœæããã«ãªã¢ã¯ãã£ããã€ãã©ã€ã³ãè¡šçŸã§ããããšã¯éåžžã«éèŠã§ãã å人çã«ã¯ãè€æ°è¡ã®æååã®åºçŸã楜ãã¿ã«ããŠããŸãã ãã¶ãããã¯ç§ã«èšŒèšããããã®æè¯ã®æ¹æ³ã§ã¯ãããŸãã-äŸãã°ãSQLã¯ãšãªãªã©ãå€æ°ã®è¡ãå¿
èŠãšããã³ãŒãããããããããŸãã
ããã¯ãã¹ã©ã€ãã·ã§ãŒçšã«æé©åãããã³ãŒãã®éèŠãªéšåãããããã§ãã ã¬ããŒãäžã®ã¹ã©ã€ãã§ã¯ãç»é¢äžã«æååå
šäœã衚瀺ãããšäŸ¿å©ã§ãã
ã¯ããããã§ãªããšèªã¿ã«ãããªããŸãã IDEã§ã¯ããããã¯ã¯ããã«è¯ããªããŸãã ç¹°ãè¿ãã«ãªããŸãããPythonãKotlinãScalaãGroovy-éå»20幎ã®ã©ã®èšèªã§ãè€æ°è¡ã®æååãµããŒããæäŸããŠããŸãã ç§ã®æèŠã§ã¯ãããã¯éåžžã«èªç¶ãªããšã§ãã
èªè
ã«ã¢ããã€ã¹ããé¡ãããŸããïŒ SpringãPivotalã«é¢ä¿ããŠããå¯èœæ§ããããJavaå
šäœã«é¢ä¿ããŠããå¯èœæ§ããããŸãã
ä»ã®ãã¯ãããžãŒãšåæ§ã«ãSpringã®æ倧ã®éšåã¯ã³ãã¥ããã£ã§ãã æè¡çã«ã¯ãSpringã¯éåžžã«èå³æ·±ããããžã§ã¯ãã®ã»ããã§ããããã®é·å¯¿ã®ç§theã¯çŽ æŽãããã³ãã¥ããã£ã§ãã ããªããèããããªã人ã
ãšãã®ããã«éä¿¡ããå¿
èŠãããå Žåã誰ãããªãã®çŽ æŽããããœãããŠã§ã¢ãå¿
èŠãšããŸããã ãããã£ãŠãå¯èœãªéãå奜çã«ãªãããåªããŠããŸãã ãããžã§ã¯ããããŒãžã£ãŒãå«ãéçºè
ã¯ãStack Overflowã§è³ªåã«çããããã§ããŸããŸãªã¿ã°ã远跡ããŸãã Gitterã«ã¯ãã£ããã«ãŒã ãããããã®äžã®åãã£ããã«ãŒã ã¯GitHubã®ãªããžããªã«å¯Ÿå¿ããŠããŸãã ããšãã°ã https://gitter.im/spring-projects/spring-boot ã ããã§ãSpringéçºè
ãèŠã€ããŠãèå³ã®ãã質åãããããšãã§ããŸãã
å€ãã®å Žåããããžã§ã¯ããæ¯æŽããæ¹æ³ãSpringã®ã³ãŒããæžãå§ããæ¹æ³ãå°ããããŸãã GitHubã®ãæçš¿ã«æé©ããªã©ã®ã¿ã°ã«ã¯å€ãã®åé¡ããããŸãã ç§ãã¡ã¯çã«åãã§ããŸããããã¹ãŠã®ãããžã§ã¯ãããã¹ãŠã®äººã«é©ããŠããããã§ã¯ãããŸãããäžéšã®ãã°ã¯ä»ã®ãã°ãããè€éã§ãã ãããã£ãŠãåœç€Ÿãšååãããå Žåã¯ããããã®ã¿ã°ãæ¢ããŠåé¡ã解決ããŠãã ããã ããã¯ç§ãã¡ã®ã³ãã¥ããã£ã®è£å ãçºçããæ¹æ³ã§ãã ç§ãã¡ã¯ããšã³ã·ã¹ãã ã®æ¹åãæ¯æŽãããã¹ãŠã®äººã®ä»äºã倧åã«ããŠããŸãã
åºåã®åã ãžã§ã·ã¥ãã³ã°ã¯ã ãªã¢ã¯ãã£ãã¹ããªã³ã°ããŒã¯ã§ãžã§ãŒã«ãŒ2018ã«ã³ãã¡ã¬ã³ã¹ã«åå ããŸãã ãã±ããã¯äŒè°ã®å ¬åŒãŠã§ããµã€ãã§è³Œå ¥ã§ããŸãã