Motivation
The most recent work involved web framework building, and the Web development technology stack has been upgraded and recorded at the same time, based on the understanding of the company's original adoption framework.
Audience
Java EE Web application Developer, Spring user,
Scope
Rapid application development, Web layer + security, persistence layer
Progress
2015/6/14 Init
Outline
1 quickly develop applications with spring boot
2 Spring web framework and security cross-sectional
3 Spring Data: Universal Data Persistence solution
Content
1 quickly develop applications with spring boot
1.1 Basic concepts
(1) Spring boot starters
Aggregation is a common set of dependencies that can be added to a maven or Gradle build
Some common starter, note that there are some include reference relationships between starter :
Spring-boot-starter
Spring-boot-starter-test
Spring-boot-starter-web
Spring-boot-starter-freemarker
Spring-boot-starter-tomcat
Spring-boot-starter-security
spring-boot-starter-log4j
Spring-boot-starter-logging
Spring-boot-starter-jdbc
Spring-boot-starter-data-jpa
Spring-boot-starter-redis
(2) Autoconfiguration
With Spring4 's conditional configuration, it is reasonable to guess the beans needed in the application and do the automatic configuration
Principle: Introduction of environment/conditional Bean
Two ways: a reference to the jar package in the classpath, a starter trigger auto-configuration
(a) Spring MVC thymeleaf template view
General needs configuration: Thymeleafviewresolver, Springtemplateengine, Templateresolver
Put its jar package into classpath, and when Spring boot detects it, it will make you use the Thymeleaf view and automatically configure the beans
(b) Web starter
After the Web starter is added to the dependency, spring boot detects that some beans are configured to support Spring Mvc:view Resovler, resource handler, message converters.
(3) command-line interface (CLI)
Further simplify spring application development with groovy and auto-configuration
(4) Actuator
Add some management features to the spring boot app
2 Spring web framework and security cross-sectional
Aside from the impact of the introduction of MVC design patterns, the introduction of the Javaconfig, Servlet3.0 brought by spring Webapplicationinitializer to Web.
The introduction of @RestController and Contentnegotiatingviewresolver has facilitated the development of rest applications.
Spring Security provides a basic implementation of web security considerations.
The subsequent spring session will provide a universal solution for Web session processing.
TODO add more descriptive examples
3 Spring Data: Universal Data Persistence solution
The ambitious spring project is expected to provide a consistent solution for RDBMS and NoSQL database access.
Because the main use of JPA 2.1, this will only discuss SPRING-DATA-JPA.
TODO add more descriptive examples
References
[1] Spring in Action, 4th Edition
[2] Spring Framework Reference documentation[4.1.6.release].pdf
[3] Spring Boot Reference guide[1.2.4.release].pdf
[4] Spring Security Reference[4.0.1.release]
[5] Spring Data jpa-referencedocumentation[1.8.0.release].pdf
Spring Framework-based Web application development Note-incomplete