実録Spring MVC

83579d17f780c8712ac17fa800efbbbb?s=47 haljik
March 26, 2017

実録Spring MVC

83579d17f780c8712ac17fa800efbbbb?s=128

haljik

March 26, 2017
Tweet

Transcript

  1. ࣮࿥4QSJOH.7$ ࣮ΞϓϦέʔγϣϯͰͷ՝୊ͱͦͷղফํ๏

  2. ࣗݾ঺հ w Տ্ɹ੖࢘ʢ͔Θ͔Έ͍ͤ͡ʣ w 5XJUUFS!IBMKJL w ؔ੢%%%KBWBओ࠵%%%"MMJBODFൃىਓϝϯόʔ w +BWB%%%4DBMBFUDʜ w

    ϑϦʔϥϯεϓϩάϥϚʔ
  3. લఏ w 4QSJOH.7$3&-&"4&
 4QSJOH#PPU3&-&"4&  w 5IZNFMFBG3&-&"4& w 41"Ͱ͸ͳ͍ݹདྷ͔Βͷ8FCΞϓϦέʔγϣϯ 41"Ͱ࢖͑Δ෦෼΋ͳ͘͸ͳ͍ʣ

    w εϥΠυʹग़ͯ͘Δίʔυ͸JNQPSU΍%*෦෼ͳ Ͳղઆʹඞཁͷͳ͍෦෼Λলུ
  4. ࠓ೔࿩͢͜ͱ ࢲͷʮ4QSJOH.7$ͷ࢖͍ํʯͱʮͦΕͧΕར఺ͱܽ఺ʯ w ը໘͔ΒͷೖྗΛड͚औΔओཁͳํ๏ w ೖྗͷόΠϯυΛΧελϚΠζ͢Δํ๏ w ίϯτϩʔϥͷ࣮૷୯Ґ w ঢ়ଶͷ࣋ͪճΓํ๏͋Ε͜Ε

    w ͦͷଞɺ஌͍ͬͯΔͱ޾͔ͤ΋͠Εͳ͍͜ͱ
  5. ը໘͔ΒͷೖྗΛड͚औΔओཁͳํ๏ w !3FRVFTU1BSBN
 ओʹ(&5ͷ࣌ͷ͔̍ͭ͠ͳ͍Α͏ͳΫΤϦʔύϥϝʔ λΛड͚औΔ࣌ w !1BUI7BSJBCMF
 63-ʹؚ·ΕΔࣝผࢠΛड͚औΔ࣌ w !.PEFM"UUSJCVUF


    ൺֱతେ͖ͳϑΥʔϜ͔ΒͷෳࡶͳೖྗΛड͚औΔ࣌
  6. ը໘͔ΒͷೖྗΛड͚औΔओཁͳํ๏ !3FRVFTU1BSBN @Controller
 @RequestMapping("/employees")
 public class EmployeeListController {
 
 //

    ex. http://localhost:8080/employees?name=haljik
 @GetMapping
 public String showList(@RequestParam("name") Name name,
 Model model) {
 model.addAttribute("employees", service.listOf(name));
 return "employees";
 }
 
 }
  7. ը໘͔ΒͷೖྗΛड͚औΔओཁͳํ๏ !1BUI7BSJBCMF @Controller
 @RequestMapping("/employees/{number}")
 public class EmployeeController {
 
 //

    ex. http://localhost:8080/employees/0001
 @GetMapping
 public String showDetail( @PathVariable("number") EmployeeNumber number, Model model ) {
 model.addAttribute("employee", service.employeeOf(number));
 return "employee-detail";
 }
 }
  8. ը໘͔ΒͷೖྗΛड͚औΔओཁͳํ๏ !.PEFM"UUSJCVUF @Controller
 @RequestMapping("/employees/registration")
 public class EmployeeRegistrationController {
 
 @ModelAttribute("employee")


    Employee employee() {
 return service.prototype();
 }
 
 @GetMapping
 public String show() {
 return "employee-registration";
 }
 
 @PostMapping
 public String register( @Valid @ModelAttribute("employee") Employee employee,
 BindingResult bindingResult ) {
 if (bindingResult.hasErrors()) return show();
 
 Employee registered = service.register(employee);
 
 return String.format("redirect:/employees/%s", registered.number());
 }
 } ᶃ ᶄ ᶆ ᶅ (&5ᶃᶄ 1045ᶅᶆ
 ᶅͱᶆͷؒͰ1PTUσʔλ͕ &NQMPZFFʹόΠϯυ͞ΕΔ !.PEFM"UUSJCVUF෇͖ͷϝιου͕ฦ͢ ΦϒδΣΫτ͕.PEFMͷଐੑ஋ͱͯ͠ηο τ͞Εͯɺ)5.-ςϯϓϨʔτ͔Βࢀর ՄೳʹͳΔ 5*14ϦΫΤετ͸CJOEͨ͘͠ͳ͍͚Ͳड͚औΓ͍ͨ.PEFM"UUSJCVUF͸CJOEJOHGBMTFΛࢦఆ͢Δ
  9. ը໘͔ΒͷೖྗΛड͚औΔओཁͳํ๏ !.PEFM"UUSJCVUF w 1SPT w ෳࡶͳΦϒδΣΫτΛ૊Έ্ཱͯͨͰϦΫΤετΛόΠϯυ Մೳ FYόϦσʔγϣϯʹඞཁͳσʔλͳͲ΋औಘͯ͠อ࣋ ͓͚ͯ͠Δʣ w

    $POT w ίϯτϩʔϥͷ࣮૷୯Ґʹ੍໿͕ൃੜ͢Δ
 !.PEFM"UUSJCVUF͕෇͍ͨϝιου͸ͦͷίϯτϩʔϥ΁ͷ ϦΫΤετ͝ͱʹৗʹʹ࣮ߦ͞ΕΔ
 ˞ઃܭ͸ΫϦʔϯʹͳΔͷͰΉ͠ΖϝϦοτ
  10. ิ଍7BMVF0CKFDUͰͷडऔ public class Name {
 @NotEmpty(message = "ࢯ໊ೖྗ͍ͯͩ͘͠͞")
 @Length(max =

    30, message = "ࢯ໊͸30จࣈ·ͰͰೖྗ͍ͯͩ͘͠͞")
 String value = "";
 
 public Name(String value) {
 this.value = value;
 }
 
 @Override
 public String toString() {
 return value;
 }
 } 4QSJOH.7$͸3FRVFTU1BSBN1BUI7BSJBCMF.PEFM"UUSJCVUFશͯͷ৔߹Ͱɺ 4JOHMF4USJOH$POTUSVDUPS ͕͋Ε͹࢖ͬͯ͘ΕΔ $POT w UIZNFMFBGͷUIpFMEͱόΠϯυ͢Δʹ͸UP4USJOHͰWBMVFͦͷ΋ͷΛฦ࣮͢૷͕ ඞཁʹͳΔ
  11. ʮը໘͔ΒͷೖྗΛड͚औΔ ओཁͳํ๏ʯ ͸͜͜·Ͱ

  12. ೖྗͷόΠϯυΛΧελϚΠζ͢Δ %JSFDU'JFME"DDFTTͰHFUUFS TFUUFSͷແ͍ੈք΁

  13. ೖྗͷόΠϯυΛΧελϚΠζ͢Δ %JSFDU'JFME"DDFTT @ControllerAdvice(basePackages =“com.example.presentation”)
 public class DirectFieldAccessAdvice {
 @InitBinder
 public

    void initBinder(WebDataBinder binder) {
 binder.initDirectFieldAccess();
 binder.setAllowedFields("to be specified");
 }
 } ᶃ lDPNFYBNQMFQSFTFOUBUJPOzύοέʔδʹ͋Δશ$POUSPMMFSʹద༻͢Δ "EWJDFͷதͰɺೖྗΛΦϒδΣΫτʹόΠϯυ͢ΔࡍɺTFUUFSΛܦ༝ͤͣ ௚઀ϑΟʔϧυʹηοτ͢ΔΑ͏ʹઃఆ ᶄ ҙਤ͠ͳ͍ϑΟʔϧυ஋ͷվ᜵Λ๷͙ͨΊແޮͳ஋Λઃఆ͠ɺͦΕͧΕͷί ϯτϩʔϥͰݸผʹઃఆΛ্ॻ͖͢Δ ᶃ ᶄ
  14. ೖྗͷόΠϯυΛΧελϚΠζ͢Δ %JSFDU'JFME"DDFTT @InitBinder
 void initBinder(WebDataBinder binder) {
 binder.setAllowedFields("mailAddress", "name");
 }

    public class Employee {
 EmployeeNumber number;
 
 MailAddress mailAddress;
 
 Name name;
 
 public EmployeeNumber number() {
 return number;
 }
 } 1045NBJM"EESFTTlYYY!FYBNQMFDPNzOBNFlTFJKJLBXBLBNJz ίϯτϩʔϥͰڐՄ͢ΔϑΟʔϧυΛઃఆ CJOE
  15. ೖྗͷόΠϯυΛΧελϚΠζ͢Δ %JSFDU'JFME"DDFTT w 1SPT w HFUUFSTFUUFSΛແͤͯ͘ϞσϧͷϊΠζ͕ݮΔ w όΠϯυ͢ΔϑΟʔϧυ͕ίϯτϩʔϥຖʹ໌֬Ͱҙਤ͠ͳ͍վ᜵ʹ ରͯ҆͠શ w

    $POT w ίϯτϩʔϥຖʹڐՄ͢ΔϑΟʔϧυΛઃఆ͢Δඞཁ͕͋Δ w #FBO7BMJEBUJPOͱͷ૬ੑʹ೉ ޙड़ 
 ௥هਖ਼֬ʹ͸4QSJOH.7$্Ͱ#FBO7BMJEBUJPOͱ5IZNFMFBGΛ૊Έ߹ Θͤͨ࣌ʹ໰୊͕͋Δɻ#FBO7BMJEBUJPO୯ମͰ͸໰୊͕ͳ͍ɻ
  16. ೖྗͷόΠϯυΛΧελϚΠζ͢Δ %JSFDU'JFME"DDFTT #FBO7BMJEBUJPOͱͷ૬ੑ ௥هɿ4QSJOH.7$্Ͱ5IZNFMFBGͱ#FBO7BMJEBUJPO Λ૊Έ߹Θͤͨ࣌ʹग़Δ໰୊ʣ
 ૬ؔνΣοΫͳͲΛϝιουͰ࣮૷ͯ͠!"TTFSU5SVF͸Α͘΍Δ͕ɺԿނ͔ϝ ιουʹରԠ͢ΔϑΟʔϧυ͕ඞཁʹͳͬͯ͠·͏ boolean valid;
 @AssertTrue


    public boolean isValid() {
 return ͳΜΒ͔ͷνΣοΫ
 } ͜Ε͕ͳ͍ͱΤϥʔ
  17. ʮ%JSFDU'JFME"DDFTT ͰHFUUFSTFUUFSͷແ͍ ੈք΁ʯ ͸͜͜·Ͱ

  18. ίϯτϩʔϥͷ࣮૷୯Ґ w Ұ࿈ͷૢ࡞ϑϩʔ୯Ґ w Ϧιʔε୯Ґ
 FYࣾһͳͲ͋ΔΦϒδΣΫτʹର͢Δ$36%Ұࣜ w )5.-ςϯϓϨʔτ୯Ґ
 ը໘୯Ґͱ΋ݴ͏

  19. ίϯτϩʔϥͷ࣮૷୯Ґ Ұ࿈ͷૢ࡞ϑϩʔ୯Ґ ʮ΢ΟβʔυͷΑ͏ͳ༷ʑͳΓιʔεʹ·͕ͨΔૢ࡞͚ͩͲҰ ࿈ͷϑϩʔͰ͋Δૢ࡞ʯ͜ΕΛҰͭͷίϯτϩʔϥͰ΍Δͷ͸ Ξϯνύλʔϯ w ΠϯδΣΫγϣϯ͞ΕΔαʔϏεͷ਺͕૿͑ɺίϯτϩʔϥ ͕ଠΔ w %JSFDU'JFME"DDFTTʹؔ࿈ͯ͠!*OJU#JOEFSͰͷBMMPX'JFMET

    ࢦఆ͕๲ΒΈɺಉ໊͡લͰ΋ʮ͋ΔΦϒδΣΫτͰ͸ڐՄɺ ผͷΦϒδΣΫτͰ͸ڐՄͨ͘͠ͳ͍ʯͳͲໃ६͢ΔՄೳੑ ΋ग़ͯ͘Δ
  20. ίϯτϩʔϥͷ࣮૷୯Ґ Ϧιʔε୯Ґ ಠཱͨ͠Ϛελͷ$36%ͳͲཁ͕݅୯७ͳ৔߹ʹݶͬͯ༗Γ
 $36%͝ͱʹҧ͏ଞͷϦιʔεΛࢀߟ৘ใͱͯ͠දࣔͨ͠Γ͢Δɺ΋͠ ͘͸কདྷతʹͦ͏ͳΓͦ͏ͳΒޙड़ͷ)5.-ςϯϓϨʔτ୯Ґ͕ྑ͍ 1SPT w 1BUI7BSJBCMFͰͷϦιʔεࢦఆͳΒɺ63-ͷڞ༗Λߟ͑ͳͯ͘ྑ͍ w ѻ͏Ϧιʔε͸ಉ͡ͳͷͰ!.PEFM"UUSJCVUFͷએݴ΋ڞ༗͠΍͍͢

    $POT w $36%ͷ಺ͲΕ͔ҰͭͰ΋ෳࡶͳཁ͕݅͋Δ৔߹͸ίϯτϩʔϥ͕ଠ Δ
  21. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ ͍ΘΏΔը໘୯Ґͷίϯτϩʔϥ࣮૷
 جຊతʹ͜ΕΛબ୒͢Δ͜ͱ͕ଟ͍
 ৔߹ʹΑͬͯ͸͞Βʹࡉ͔͍ΦϖϨʔγϣϯ୯Ґʹͳ Δ͜ͱ΋͋Δ

  22. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ ྫࣾһͷ$36%ͷ৔߹

  23. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ ྫࣾһͷ$36%ͷ৔߹ొ࿥ @Controller
 @RequestMapping("/employees/registration")
 public class EmployeeRegistrationController {
 @ModelAttribute("employee")


    Employee employee() {
 return service.prototype();
 }
 
 @GetMapping
 public String show() {
 return "employee-registration";
 }
 
 @PostMapping
 public String register(@Valid @ModelAttribute("employee") Employee employee,
 BindingResult bindingResult) {
 if (bindingResult.hasErrors()) return show();
 Employee registered = service.register(employee);
 return String.format("redirect:/employees/%s", registered.number());
 }
 
 @InitBinder
 void initBinder(WebDataBinder binder) {
 binder.setAllowedFields("mailAddress", "name");
 }
 }
  24. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ ྫࣾһͷ$36%ͷ৔߹ @Controller
 @RequestMapping("/employees/{number}")
 public class EmployeeController {
 


    @ModelAttribute("employee")
 public Employee employeeOf(@PathVariable("number") EmployeeNumber number) {
 return service.employeeOf(number);
 }
 
 @GetMapping
 public String show() {
 return "employee-detail";
 } 
 }
  25. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ ྫࣾһͷ$36%ͷ৔߹ฤू @Controller
 @RequestMapping("/employees/{number}/edit")
 public class EmployeeEditController {
 @ModelAttribute("employee")


    public Employee employeeOf(@PathVariable("number") EmployeeNumber number) {
 return service.employeeOf(number);
 }
 
 @GetMapping
 public String show() {
 return "employee-edit";
 }
 
 @PostMapping
 public String modify(@Valid @ModelAttribute("employee") Employee employee,
 BindingResult bindingResult) {
 if (bindingResult.hasErrors()) return show();
 service.modify(employee);
 return String.format(“redirect:/employees/%s", employee.number());
 }
 
 @InitBinder
 void initBinder(WebDataBinder binder) {
 binder.setAllowedFields("mailAddress", "name");
 }
 }
  26. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ ྫࣾһͷ$36%ͷ৔߹ @Controller
 @RequestMapping("/employees/{number}/delete")
 public class EmployeeEditController {
 @ModelAttribute("employee")


    public Employee employeeOf(@PathVariable("number") EmployeeNumber number) {
 return service.employeeOf(number);
 }
 
 @GetMapping
 public String show() {
 return "employee-delete";
 }
 
 @PostMapping
 public String delete( @ModelAttribute(“employee”) Employee employee ) {
 if (bindingResult.hasErrors()) return show();
 service.delete(employee);
 return String.format(“redirect:/employees/%s", employee.number());
 }
 }
  27. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ 1SPT w ͋Δը໘ͷ࣋ͭػೳʹूதͰ͖Δ w !.PEFM"UUSJCVUFʹΑΔσʔλόΠϯσΟϯάͱ૬ੑ͕ྑ͍ w %JSFDU'JFME"DDFTTͱ΋૬ੑ͕ྑ͍ $POT

    w ୯ҰͷϦιʔεʹର͢ΔΦϖϨʔγϣϯ͕෼ׂ͞ΕΔͷͰɺ1BUI7BSJBCMFͰϦιʔ εΛදݱ͍ͯ͠Δ৔߹ಉ͡63-Λෳ਺ίϯτϩʔϥʹهड़͢Δ͜ͱʹͳΔ͕ɺΞϊ ςʔγϣϯʹࢦఆ͢Δจࣈྻ͸੩తͰ͋Δඞཁ͕͋ͬͯɺTUBUJDͷจࣈྻఆ਺ఆٛ ͱจࣈྻ࿈͔݁͠ํ๏͕ͳ͍ w ಉ͡!.PEFM"UUSJCVUFએݴ͕ෳ਺ͷίϯτϩʔϥʔʹࢄΒ͹Γ͕ͪ
  28. QSFTFOUBUJPO ᵓᴷᴷ%JSFDU'JFME"DDFTT"EWJDFKBWB ᵓᴷᴷ1SPQFSUZ&EJUPS"EWJDFKBWB ᵋᴷᴷFNQMPZFF ᵓᴷᴷ&NQMPZFF-JTU$POUSPMMFSKBWB ᵓᴷᴷ&NQMPZFF3FHJTUSBUJPO$POUSPMMFSKBWB ᵋᴷᴷEFUBJM ᵓᴷᴷ&NQMPZFF"EWJDFKBWB ᵓᴷᴷ&NQMPZFF$POUSPMMFSKBWB ᵓᴷᴷ&NQMPZFF%FMFUF$POUSPMMFSKBWB

    ᵋᴷᴷ&NQMPZFF&EJU$POUSPMMFSKBWB ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ $POTͷ!.PEFM"UUSJCVUFͷॏෳΛ!$POUSPMMFS"EWJDFͰҰݩԽ͢Δ !.PEFM"UUSJCVUF͕ ॏෳ͍ͯ͠Δ $POUSPMMFS͸ಉҰύο έʔδʹ·ͱ·͍ͬͯ Δ
  29. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ $POTͷ!.PEFM"UUSJCVUFͷॏෳΛ!$POUSPMMFS"EWJDFͰҰݩԽ͢Δ @ControllerAdvice(basePackageClasses = EmployeeAdvice.class)
 public class EmployeeAdvice {


    public static final String BASE_URL="/employees/{number}";
 public static final String EMPLOYEE="employee";
 
 @ModelAttribute(EMPLOYEE)
 Employee employeeOf(@PathVariable("number")EmployeeNumber employeeNumber) {
 return service.employeeOf(employeeNumber);
 }
 
 EmployeeService service;
 public EmployeeAdvice(EmployeeService service) {
 this.service = service;
 }
 } $POUSPMMFS"EWJDF 1BUI7BSJBCMF΁ͷΞΫηε΋ҰݩԽͰ͖ͨͷͰ #"4&@63-Λఆ਺ͱͯ͠1BUI7BSJBCMFΛ͜ͷ"EWJDFʹӅṭ͍ͯ͠Δ
  30. ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ $POTͷ!.PEFM"UUSJCVUFͷॏෳΛ!$POUSPMMFS"EWJDFͰҰݩԽ͢Δ @Controller
 @RequestMapping(EmployeeAdvice.BASE_URL + "/edit")
 public class EmployeeEditController

    {
 @GetMapping
 public String show() {
 return "employee-edit";
 }
 
 @PostMapping
 public String modify(
 @Valid @ModelAttribute(EmployeeAdvice.EMPLOYEE) Employee employee,
 BindingResult bindingResult
 ) {
 if (bindingResult.hasErrors()) return show();
 service.modify(employee);
 return String.format(“redirect:/employees/%s", employee.number());
 }
 
 @InitBinder
 void initBinder(WebDataBinder binder) {
 binder.setAllowedFields("mailAddress", "name");
 }
 } ฤू จࣈྻఆ਺ͱจࣈྻ࿈݁͸ෆ֨޷͕ͩ ΍ΓΑ͏͕ͳ͍ɻɻɻΞϊςʔγϣϯ ͷਏΈ
  31. @Controller
 @RequestMapping(EmployeeAdvice.BASE_URL + "/delete")
 public class EmployeeDeleteController {
 @GetMapping
 public

    String show() {
 return "employee-delete";
 }
 
 @PostMapping
 public String delete( @ModelAttribute(EmployeeAdvice.EMPLOYEE) Employee employee ) {
 service.delete(employee);
 return "redirect:/employees";
 }
 } ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ $POTͷ!.PEFM"UUSJCVUFͷॏෳΛ!$POUSPMMFS"EWJDFͰҰݩԽ͢Δ ࡟আ
  32. @Controller
 @RequestMapping(EmployeeAdvice.BASE_URL)
 public class EmployeeController {
 @GetMapping
 public String showDetail()

    {
 return "employee-detail";
 }
 } ίϯτϩʔϥͷ࣮૷୯Ґ )5.-ςϯϓϨʔτ୯Ґ $POTͷ!.PEFM"UUSJCVUFͷॏෳΛ!$POUSPMMFS"EWJDFͰҰݩԽ͢Δ ৄࡉ γϯϓϧʂ
  33. !$POUSPMMFS"EWJDFͷ࢖͍Ͳ ͜Ζ w !.PEFM"UUSJCVUFએݴͷҰݩԽ w 1BUI7BSJBCMFͷॲཧͷҰݩԽ ˞ࠓճղઆ͸͍ͯ͠·ͤΜ͕$POUSPMMFSͷྫ֎ॲཧΛҰݩԽͨ͠Γ΋Ͱ ͖·͢ɻ

  34. ίϯτϩʔϥͷ࣮૷୯Ґ
 ʹ͍ͭͯ͸͜͜·Ͱ

  35. ঢ়ଶͷ࣋ͪճΓํ๏ w Α͋͘Δཁ݅ w ݕࡧ݁ՌҰཡ͔Βৄࡉը໘Λ։͖ɺৄࡉը໘͔ΒҰཡʹ ໭ͬͨ࣌ʹಉ͡৚݅ͰҰཡΛද͍ࣔͨ͠
 ˣ
 Ұཡදࣔ࣌఺ͷݕࡧ৚݅Λ࣋ͪճΓ w ͲͷϥϯσΟϯάϖʔδ͔Βྲྀೖͨ͠஫จͳͷ͔Λ஌Γͨ

    ͍
 ˣ
 ϥϯσΟϯάϖʔδͷࣝผࢠΛ஫จը໘·Ͱ࣋ͪճΓ
  36. ঢ়ଶͷ࣋ͪճΓํ๏ બ୒ࢶ w !4FTTJPO"UUSJCVUF )UUQ4FTTJPO  w $PPLJF w %#ʹอଘ͠Ϧιʔεͱͯ͠*%Λൃߦ

  37. ঢ়ଶͷ࣋ͪճΓํ๏ !4FTTJPO"UUSJCVUF 1SPT w ༰қͰ͋Δ $POT w ηογϣϯͷڞ༗͕ඞਢͱͳΓεέʔϧΞ΢τ͠ʹ͍͘ w ֨ೲ͢ΔΦϒδΣΫτ͸4FSJBMJ[BCMFΛ࣮૷͢Δඞཁ͕͋

    ΔʢճආͰ͖ͳ͍Θ͚Ͱ͸ͳ͍͕໘౗ʜʣ 4FTTJPO࢖͏ͳΒ4QSJOH4FTTJPOͰ͓͙͙Γ͍ͩ͘͞
  38. ঢ়ଶͷ࣋ͪճΓํ๏ $PPLJF 1SPT w ୯७ʹεέʔϧ͢Δ w 0CKFDU4FSJBMJ[FSʹཔΒͣɺ4FSJBMJ[BCMFͷ࣮૷΋ෆཁ $POT w αΠζ੍ݶ

    ʙ,  w վ᜵ʹऑ͍ ॺ໊ΛؚΊΔࣄͰճආ͸Մೳ  w 4FTTJPOͷΑ͏ͳखܰ͞ΛٻΊΔͱ࡞ΓࠐΈ͕গ͠ඞཁʹͳΔ
 ࠷ۙ͸+BDLTPOͰ+40/ʹม׵ͯ͠63-Τϯίʔυͨ͠΋ͷΛ$PPLJFͱ͠ ͯൃߦ͢Δ΍ΓํΛ޷ΜͰ࢖͍ͬͯΔ
  39. ঢ়ଶͷ࣋ͪճΓํ๏ %#ʹอଘ͠Ϧιʔεͱͯ͠*%Λൃߦ ঢ়ଶΛ%#ʹอଘͯ͠*%Λൃߦɻͦͷ*%Λ63- 1BUI7BSJBCMF Ͱ࣋ͪճΔ
 ࢀߟ3&45'VM8FCαʔϏεIUUQTXXXPSFJMMZDPKQCPPLT ͷʮτϥϯβΫγϣϯΛϦιʔεͱͯ͠ൃߦ͢Δʯͱ͍͏هड़͔ΒΞΠσΞΛഈआ 
 
 1SPT

    w ར༻ऀ͕ɺ్தͰσόΠεΛ࣋ͪସ͑ͨ৔߹ʹ΋63-͑͞Θ͔Ε͹ঢ়ଶΛҾ͖ ܧ͛Δ $POT w 63-ʹอଘͨ͠ঢ়ଶͷ*%ΛຒΊࠐΉͷͰվ᜵ʹऑ͍ʢ+85ͱͯ͠ຒΊࠐΉͳ ͲͰճආ͸Մೳʣ w खܰ͞͸ͳ͘ɺ࡞ΓࠐΈͷੈք
  40. ঢ়ଶͷ࣋ͪճΓํ๏͸
 ͜͜·Ͱ

  41. ͦͷଞ஌͍ͬͯΔͱ޾͔ͤ΋ ͠Εͳ͍͜ͱ w )BOEMFS.FUIPE"SHVNFOU3FTPMWFS
 ίϯςΩετʹґଘ͢ΔಠࣗΦϒδΣΫτΛҾ਺Ͱड͚औΓͨ ͍  w 6SJ$PNQPOFOUT#VJMEFS͋Δ͍͸.WD6SJ$PNQPOFOUT#VJMEFS
 ϦμΠϨΫτ63-ΛίϯτϩʔϥͰ࡞Δͷָ͕

     w ίϯτϩʔϥ͔Β5IZNFMFBGͷGSBHNFOUΛฦͤΔ
 ෦෼తʹಈతͳը໘Λ࡞Δͷʹ࠷ద  w 3FTU"1*Ͱ΋%JSFDU'JFME"DDFTT
 ʢ0CKFDU.BQQFSͷઃఆʣ
  42. )BOEMFS.FUIPE"SHVNFOU3FTPMWFS ϦΫΤετ΍ηογϣϯͳͲͷίϯςΩετʹґଘ͠ ͨಛघͳҾ਺Λड͚औΓ͍ͨ৔߹ʹ࢖͏ ࣮ྫɿϩάΠϯ͍ͯ͠ΔϢʔβʔΦϒδΣΫτΛҾ਺ Ͱड͚औΓ͍ͨɺϩάΠϯ͍ͯ͠ͳ͍৔߹͸ྫ֎Ͱྑ ͍ͳͲ "1*ͱͯ͠͸ϑϨʔϜϫʔΫ࡞੒ऀ޲͖Ͱɺίϯτ ϩʔϥͷ࣮૷஌͚ࣝͩͰ͸࣮૷Ͱ͖ͳ͍ͷ͕೉఺

  43. 6SJ$PNQPOFOUT#VJMEFS͋Δ͍͸ .WD6SJ$PNQPOFOUT#VJMEFS 1BUI7BSJBCMFΛؚΉ63-ͷม਺෦෼Λల։ͯ͘͠ΕΔ ·ͨ҆શʹΫΤϦύϥϝʔλΛ෇༩Ͱ͖Δ ଞͷ"1*ݺͼग़͠Λߦ͏ࡍͷ63*ߏங΍ɺଞը໘΁ͷ ϦμΠϨΫτ63-ͷ૊ΈཱͯΛ҆શʹ͍ͨ࣌͠ʹ࢖͏ TUBUJDͳϢʔςΟϦςΟʔʹ͍ۙͷͰ8SBQͯ͠ΞϓϦ έʔγϣϯίʔυ͔Β௚઀ґଘ͸΍ΊΔͳͲ޻෉͸͠ ͨ΄͏͕ྑ͍͔΋͠Εͳ͍

  44. ίϯτϩʔϥ͔Β5IZNMFBG ͷGSBHNFOUΛฦͤΔ ը໘ͷҰ෦෼͚ͩಈతʹ͍ͨ͠ͱ͍͏৔߹ ᶃ )5.-ςϯϓϨʔτͷಈతʹ͍ͨ͠෦෼ʹUIGSBHNFOUͰ໊ લΛ෇͚Δ ᶄ ͦͷը໘Λද͍ࣔͯ͠Δίϯτϩʔϥʹͦͷ໊લΛΛฦ͢ϋ ϯυϥϝιουΛ௥Ճ ᶅ

    BKBY௨৴Ͱ֘౰෦෼͚ͩΛऔಘͯ͠%0.Λஔ͖׵͑Δ ॳظදࣔͷϨϯμϦϯάͱɺը໘ͷΞΫγϣϯʹΑΔಈతͳ෦෼ ϨϯμϦϯάΛ΄΅΄΅ҰݩԽͰ͖Δ
  45. 3&45"1*Ͱ΋ %JSFDU'JFME"DDFTT !3FTU$POUSPMMFSͰ+TPOϕʔεͷ3FTU"1*Λ࡞Δ࣌ Ͱ΋%JSFDU'JFME"DDFTTʹͯ͠HFUUFSTFUUFSΛແ͘ ͤ·͢ɻ@Configuration
 public class ObjectMapperConfig {
 


    @Bean
 public ObjectMapper directFieldAccessObjectMapper() {
 ObjectMapper mapper = new ObjectMapper();
 mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.NON_PRIVATE);
 mapper.setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE);
 mapper.setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE);
 return mapper;
 }
 } 4QSJOH#PPUͳΒ͜ΕͰ
  46. ·ͱΊ HFUUFSTFUUFS΍ΊΑ͏ ը໘୯Ґ͕ஸ౓ྑ͍

  47. ͓·͚ w ࢓૊Έ͕஌Γ͍ͨਓ޲͚ w 4QSJOH.7$ͷਆ͸%JTQBUDIFS4FSWMFUͳͷͰ͜ ͔͜ΒιʔεಡΊ͹ྑ͍ w ίϯτϩʔϥʹؔΘΔ෦෼͚ͩͩͱɺ 3FRVFTU.BQQJOH)BOEMFS.BQQJOH
 3FRVFTU.BQQJOH)BOEMFS"EBQUFS


    ͋ͨΓΛಡΉͱ͍Ζ͍ΖΘ͔Γ·͢
  48. ͍Ζ͍Ζ࢖͑ͦ͏ͳςΫχοΫ͸͋ Δ͚Ͳɺը໘͸ʮਫ෺ʯͳͷͰɺԿ ͔ಠࣗͷ෦඼Λ࡞ΓࠐΜͰ࢖͏Α͏ ͳࣄΛؤுͬͯ΋අ༻ରޮՌ͸ബ͍ ༗Γ෺Λૉ௚ʹ࢖͏͜ͱ͕େࣄ