Giter Club home page Giter Club logo

spring4's Introduction

Spring4

This is a super Hello World Project ;-)

It consists:

Section 1 Spring:

  1. Mult-Way Spring Bean/IoC Configations
  2. Spring AOP
  3. Spring Jdbc
  4. Spring-Hibernate
  5. Spring-Struts2

Section 2 Spring-MVC:

  1. @RequestMapping(value, method, headers), @RequestParam, @PathVariable, @ResponseBody ......

  2. SpringMVC Handler Method: POJO, Servlet API, ModelAndView, Map, Model, @SessionAttribute, @ModelAttribute, forward:, redirect:

  3. REST CRUD

  4. Spring Form: Form Input -> Java Object(modelAttribute, path, cssClass. cssErrorClass,htmlEscape, form:input,radiobutton, errors, select ......)

  5. DataBinding - Formatting - Validating:

ServletRequest -> WebDataBinderFactory -> DataBinder -> ConversionService -> Validator -> BindingResult
Bind + Convert + Validate and Result. 

a. Convert:
CustomConversionService: Coverter<S,T>, ConverterFactory, GenericConverter
@InitBinder method to init WebDataBinder

b. Format:
FormattingConversionService e.g. @DateTimeFormat(pattern, iso, style), @NumberFormat(Style.CURRENCY) apply to Entity Classes

c. Validate:
JSR 303 + Hibernate Validator + Spring LocalValidatorFactoryBean + @valid (@argument + BindingResult or Errors). 
JSP can also access thru form:error path="???"
Validation Annotation applies to Entity Classes
Validation Msg Localization with i18n
  1. JSON + HttpMessageConverter @RequestBody + @ResponseBody on Mehotd or HttpEntity + ResponseEntity on method arug and return DataType

  2. Localization with i18n; LocalResolver, CookieLocaleResolver, SessionLocaleResolver, LocalChangeInterceptor

  3. File Upload: MultipartResolver implements CommonsMultipartResolver. By default SpringMVC would not init MultipartResolver, so add CommonsFileUpload + CommonsIO dependencies and config multipartResolver Bean

  4. Interceptor: preHandle, postHandle, and afterCompletion when pre returns TRUE: pre -> handler -> post -> render -> after when pre returns FALSE: pre Also, the mult-interceptors flow with some pre returns false ;-)

  5. Exception: HandlerExceptionResolver a. ExceptionHandlerExceptionResolver: @ExceptionHandler (order? the closer Class to the Exception Class). If cannot find any matching method in the handler class, app will look for a method has @ExceptionHandler of a @ControllerAdvise Class b. @ResponseStatus: apply to CustomException Class c. DefaultFhandlerExceptionResolver d. SimpleMappingExceptionResolver

  6. Reconfig Spring + Spring MVC App: Spring IoC Bean: Parent vs Spring MVC: Child Spring cannot access Spring MVC Spring MVC can access Spring e.g. Spring IoC Bean includes everything but @Controller and Spring MVC only includes @Controller

  7. Spring MVC vs Struts2 Spring MVC: Pro: Servlet - methods (a bit faster), JSR303, AJAX Struts2: Filter - classes Pro: OGNL better Font-end

spring4's People

Contributors

hcheng628 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.