Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Springを用いた社内ライブラリ開発

4,490 views

Published on

Spring Fest 2017発表資料 - SpringFrameworkを用いた社内ライブラリ開発について

Published in: Software
  • Be the first to comment

Springを用いた社内ライブラリ開発

  1. 1. 
 2
  2. 2. 3
  3. 3. 4
  4. 4. 5
  5. 5. 6
  6. 6. 7
  7. 7. 8
  8. 8. 9
  9. 9. 10
  10. 10. 11
  11. 11. 12
  12. 12. 13
  13. 13. 14
  14. 14. 15
  15. 15. 16 @Conditionl @ConditionalOnXxx
  16. 16. 17 @GetMapping @ResponseBody public Response get(@Xxx String xxx) { // do something }
  17. 17. HandlerMethodArgumentResolver 18
  18. 18. 19 public class SessionAttributeArgumentResolver implements HandlerMethodArgumentResolver { @Override public Object resolveArgument( MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { final HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); final HttpSession session = servletRequest.getSession(); return retrieveSessionAttribute(session, getKey()); } } @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addArgumentResolvers( List<HandlerMethodArgumentResolver> resolvers) { resolvers.add(new SessionAttributeArgumentResolver(Xxx.class)); } }
  19. 19. 20 <—- xml configuration —-> <bean class="j.c.r.s.s.a.c.AccessConditionConfig"> <constructor-arg name=“urlPattern” value="/users/*" /> <constructor-arg name=“voter” ref="roleVoter" /> <constructor-arg name=“accessDeniedHandler” ref="handler" /> </bean> // JavaConfig @Bean @Autowired public AccessConditionConfig condition(AccessDecisionVoter voter, AccessDeniedHandler handler) { return new AccessConditionConfig(“/users/*”, roleVoter, handler); }
  20. 20. Filter HandlerInterceptorAdapter AccessDecisionManager ExceptionTranslationFilter 21 url-pattern (RequestMapping )
  21. 21. 22
  22. 22. 23
  23. 23. 24
  24. 24. 25
  25. 25. 26
  26. 26. 27
  27. 27. 28
  28. 28. 29
  29. 29. 30
  30. 30. 31
  31. 31. 32
  32. 32. 33
  33. 33. 34
  34. 34. 35
  35. 35. 36

×