【Spring实战】----开篇(包含系列目录链接)
终于还是要对Spring进行解剖,接下来Spring实战篇系列会以应用了Spring技术的Java Web的应用mango为例,来分析Spring各个模块的技术,包括源码解析等,谨以此记!!!
【Spring实战】----springMVC4.3.2的配置
【Spring实战】----springMVC配置文件*-servlet.xml的解析
【Spring实战】----Spring4.3.2集成Hibernate5.2.5
【Spring实战】----源码解析SessionFactory及Session的管理及getCurrentSession的使用
【Spring实战】----spring security4.1.3配置以及踩过的坑
【Spring实战】----源码解析Spring Security4.1.3中的过滤器Filter配置
【Spring实战】----security4.1.3认证的过程以及原请求信息的缓存及恢复(RequestCache)
【Spring实战】----Security4.1.3实现根据请求跳转不同登录页以及登录后根据权限跳转到不同页配置
【Spring实战】----Security4.1.3认证过程源码分析
【Spring实战】----Security4.1.3鉴权之美--基于投票的AccessDecisionManager实现及源码分析
【Spring实战】Spring容器初始化完成后执行初始化数据方法
本系列数据库2017年6月16日改为hsqldb数据库测试,不用安装直接配置,hsqldb使用参见
hsqldb数据库在java web项目(androidpn)中的使用(spring+hibernate+hsqldb)
附:
1)图谱位置
2)代码位置
[1] Java反射知识-->Spring IoC :http://www.iteye.com/topic/1123081
[2] Java动态代理-->Spring AOP :http://www.iteye.com/topic/1123293
[3] 属性编辑器,即PropertyEditor-->Spring IoC:http://www.iteye.com/topic/1123628
[4] XML基础知识-->Spring配置:http://www.iteye.com/topic/1123630
[5] 注解-->Spring配置:http://www.iteye.com/topic/1123823
[6] 线程本地变更,即ThreadLocal-->Spring事务管理:http://www.iteye.com/topic/1123824
[7] 事务基础知识-->Spring事务管理:http://www.iteye.com/topic/1124043
[8] 国际化信息-->MVC:http://www.iteye.com/topic/1124044
[9] HTTP报文-->MVC:http://www.iteye.com/topic/1124408
Spring Tutorials
The Spring Framework, created by Rod Johnson, provides a comprehensive programming and configuration model for modern Java-based enterprise applications – on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the “plumbing” of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.
In this series of tutorials, we provide step by step examples on how to use the Spring framework.
Spring Quick Start
Quick start to understand the basic of Spring framework development.
Spring Configuration
Traditionally Spring configuration is being done through XML. Spring 3.0 supports JavaConfig, now you can use annotations to do the configuration in Spring.
- Spring 3 Java Config Example
- Spring 3 Java Config @Import Example
- Spring Java Configuration
- Spring 3.1 profiles and Tomcat configuration
- Swapping out Spring Bean Configuration at Runtime
- Spring Configurable Magic
- Spring 4 Conditional
- Spring: Make your java-based configuration more elegant
Spring Dependency Injection (DI)
This section explains how Spring utilizes dependency Injection (DI) to manage object dependencies.
- Spring 3 Dependency Injection via Constructor and Setter
- Spring 3: Type safe dependency injection
- Wire object dependencies outside a Spring Container
- Type Conversion in Spring
Bean Basic
All the classes you need to use in Spring IoC container are considered “beans” and should be declared in a Spring bean configuration file or via annotations.
- Spring 3 Bean Reference Example
- How to inject value into Bean properties in Spring
- Spring Inner Bean Example
- Spring Bean Scopes Example
- Spring Collections (List, Set, Map and Properties) Example
- Spring ListFactoryBean, SetFactoryBean and MapFactoryBean Example
- Spring Inject Date into Bean property with CustomDateEditor
- Spring PropertyPlaceholderConfigurer Example
- Spring Bean Configuration Inheritance Example
- Spring Dependency Checking Example
- Spring Property Placeholder Configurer – A few not so obvious options
- Spring Bean Lifecycle Example
- Spring Collection Merging
- Spring Framework: Three Spring Bean Lifecycle Techniques
- Dynamic Property Management in Spring
- Project Configuration with Spring
- Spring 3.1 – Loading Properties For XML Configuration From Database
- Properties with Spring
- Exposing a POJO as a JMX MBean with Spring
- JMX and Spring – Part 1
- JMX and Spring – Part 2
- JMX and Spring – Part 3
- Spring Remoting Support and Developing RMI Service
- Spring Remoting Support with Http Invoker
- Spring Thread Pool Services
- How to use Events in Spring 3.x
- Why I like Spring bean aliasing
- Optimising Your ApplicationContext
- Better error messages with Bean Validation 1.1 in Spring MVC application
- Using Spring managed Bean in non-managed object
- Spring from the Trenches: Injecting Property Values Into Configuration Beans
Spring Expression Language
Spring 3.0 introduces a powerful, featured rich, expression language known as Spring expression language or in short Spring EL.
Spring AutoWiring Bean
Spring “auto-wiring” modes to wire beans automatically, both in XML and annotation.
Spring Aspect Oriented Programming (AOP)
Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect. Aspects enable the modularization of concerns such as transaction management that cut across multiple types and objects. While the Spring IoC container does not depend on AOP, meaning you do not need to use AOP if you don’t want to, AOP complements Spring IoC to provide a very capable middleware solution.
- Spring AOP Example
- Implementing Active Record Pattern with Spring AOP
- Spring – Adding AOP support
- Spring AOP in security – controlling creation of UI components via aspects
- Applying aspect oriented programming
- Spring 4: CGLIB-based proxy classes with no default constructor
- Aspect Oriented Programming with Spring
Spring AOP + AspectJ framework
AspectJ supported since Spring 2.0, a more flexible and powerful solution compared to Spring AOP.
- Spring AOP AspectJ Example
- Aspect Oriented Programming with Spring AspectJ and Maven
- Auditing a Spring MVC Webapp with AspectJ. Part 1
- Auditing a Spring MVC Webapp with AspectJ. Part 2
- Spring Test Context Caching + AspectJ @Transactional + Ehcache pain
- How does Spring @Transactional Really Work?
Spring Object/XML Mapper
Spring Object to XML mapping Tool (OXM).
Spring JDBC Support
Spring provides many helper classes to simplify JDBC based database operations.
- Spring JdbcTemplate Example
- Adding C3PO Connection Pooling in Spring JDBC
- Getting started with Spring JDBC in a web application
- Spring Transaction Management Example with JDBC Example
Spring JPA/ORM Support
Spring comes with many handy classes to support JPA and ORM frameworks.
- JBoss 4.2.x Spring 3 JPA Hibernate Tutorial
- Spring Declarative Transactions Example
- The persistence layer with Spring 3.1 and Hibernate
- Simplifying the Data Access Layer with Spring and Java Generics
- The Persistence Layer with Spring 3.1 and JPA
- Transaction configuration with JPA and Spring 3.1
- Enabling JMX in Hibernate, EhCache, Quartz, DBCP and Spring
- Spring – Persistence layer – writing entities and configuring Hibernate
- Spring – DAO 1and Service layer
- Designing the domain model and the service layer
- Synchronizing transactions with asynchronous events in Spring
- Spring JpaRepository Example (In-Memory)
- Spring MVC 3 Controller for MyBatis CRUD operation
- Spring MVC + Hibernate + Maven: CRUD operations example
- MyBatis 3 – Spring integration tutorial
- Spring JPA Data + Hibernate + MySQL + Maven
- Spring Hibernate – MySql and Maven Showcase
- Spring Transactions Visibility
- Spring-injected Beans in JPA EntityListeners
Spring E-mail Support
Spring provides MailSender to send email via JavaMail API. This section also provides tutorials on how to integrate Spring with third party mail providers and their APIs.
- Sending e-mails in Java with Spring – GMail SMTP server example
- Spring, Quartz and JavaMail Integration Tutorial
- Spring E-Mail Support – GMail SMTP Server Example
- How to compose html emails in Java with Spring and Velocity
Spring Caching support
Spring provides a cache abstraction layer for caching frameworks to plug-in. You can utilize the cache for method calls, database interaction and distributes service execution.
- Spring 3.1 Cache Abstraction Tutorial
- Spring 3.1 Caching and @CacheEvict
- Spring 3.1: Caching and EhCache
- Spring 3.1 Caching and Config
- Spring 3.1 Caching and @Cacheable
- Simple Spring Memcached – Spring Caching Abstraction and Memcached
- @Cacheable overhead in Spring
- Distribute Spring Beans in Oracle Coherence
- Oracle Coherence: Distributed Data Management
- Coherence Event Processing by using Map Trigger Feature
- Hazelcast Distributed Execution with Spring
- Spring request-level memoization
Spring Scheduling Support
Spring has very good support for both JDK timers and the Quartz framework.
- Spring & Quartz Integration with Custom Annotation
- Spring & Quartz Integration with Custom Annotation, the SPANN way
- Spring and Quartz: Multi-Job Scheduling Service
- Configuring Quartz with JDBCJobStore in Spring
- Spring 3 Scheduler Example – JDK Timer and Quartz Showcase
- Spring 3 Scheduler Example – JDK Timer and Quartz Showcase
- Spring from the Trenches: Invoking a Secured Method from a Scheduled Job
Spring Web MVC framework
Spring Web Model-View-Controller (MVC) framework.
- Spring MVC Hello World Example
- Spring MVC Handler Mapping Example
- Spring MVC Handler Interceptors Example
- Spring MVC Controller Example
- Spring MVC Exception Handling Example
- Spring MVC View Resolver Example
- Spring MVC Textbox Example
- Spring MVC Password Example
- A Guide To Authenticating Users With Mozilla Persona
- Spring MVC Development – Quick Tutorial
- Spring MVC Form Validation (With Annotations)
- Spring MVC Controller JUnit Testing
- Spring MVC Error Handling Example
- SpringMVC 3 Tiles 2.2.2 Integration Tutorial
- jqGrid, REST, AJAX and Spring MVC Integration
- Spring MVC Interceptors Example
- Spring MVC for Atom Feeds
- Spring 3 MVC Exception Handlers
- Ajax with Spring MVC 3 using Annotations and JQuery
- Spring MVC and JQuery for Ajax Form Validation
- Spring MVC Customized User Login Logout Implementation Example
- Spring – Adding Spring MVC – part 1
- Spring – Adding Spring MVC – part 2
- Spring MVC 3: Upload multiple files
- Spring MVC: form handling vol. 5 – select, option, options tags
- Spring MVC Form Validation (With Annotations)
- Spring MVC Session Tutorial
- Spring MVC Form Tutorial
- Simple Spring MVC Web Application using Gradle
- Spring MVC: Introduction in testing
- Spring MVC, Ajax and JSON Part 1 – Setting The Scene
- Spring MVC, Ajax and JSON Part 2 – The Server Side Code
- Spring MVC, Ajax and JSON Part 3 – The Client Side Code
- Spring MVC Tutorial
- Spring MVC: Validator and @InitBinder
- Spring MVC: Security with MySQL and Hibernate
- Spring MVC: form handling vol. 1
- Spring MVC: form handling vol. 2 – checkbox processing
- Spring MVC: form handling vol. 3 – checkboxes processing
- Spring MVC: form handling vol. 4 – radiobuttons
- Spring MVC Error handling flow
- Spring MVC Custom Validation Annotations
- Spring MVC: Session advanced
- Spring MVC – Customizing RequestMappingHandlerMapping
- DeferredResult – asynchronous processing in Spring MVC
- Spring MVC: Creation of a simple Controller with Java based config
- Spring MVC: REST application with CNVR vol. 1
- Spring MVC: REST application with CNVR vol. 2
- Spring MVC: REST application with CNVR vol. 3
- Spring MVC – @RequestBody and @ResponseBody demystified
- Exception Handling with the Spring 3.2 @ControllerAdvice Annotation
- Spring MVC: Resources
- Long Polling with Spring 3.2′s DeferredResult
- Understanding Spring Web Initialization
- Migrating Spring MVC RESTful web services to Spring 4
- Configure favicon.ico in Spring MVC based application
- Spring MVC Integration Testing: Assert the given model attribute(s) have global errors
- Validation groups in Spring MVC
- Customizing HttpMessageConverters with Spring Boot and Spring MVC
- Spring MVC: Ajax & JQuery
- Adding Social Sign In to a Spring MVC Web Application: Configuration
- Adding Social Sign In to a Spring MVC Web Application: Registration and Login
- Adding Social Sign In to a Spring MVC Web Application: Unit Testing
- Adding Social Sign In to a Spring MVC Web Application: Integration Testing
- SpringMVC4 + Spring Data JPA + SpringSecurity configuration using JavaConfig
- @ControllerAdvice improvements in Spring 4
- Spring MVC 4 Quickstart Maven Archetype Improved
- Web App Architecture – the Spring MVC – AngularJs stack
- Spring MVC login example
Spring REST Support
Spring supports exporting beans as REST services through its MVC framework. This section also provides tutorials on how to export Spring services over REST using popular third party tools.
- Spring 4 REST Hello World Example
- RESTful Web Services with RESTeasy JAX-RS on Tomcat 7 – Eclipse and Maven project
- Spring 3 RESTful Web Services
- Integrating Jersey with Spring
- Building a RESTful Web Service with Spring 3.1 and Java based Configuration, part 2
- RESTful Web Service Discoverability, part 4
- REST Service Discoverability with Spring, part 5
- REST Pagination in Spring
- RESTful Web Applications with Jersey and Spring
- Automatically generating WADL in Spring MVC REST application
- How to use RestTemplate with Basic Authentication in Spring
- REST CXF for Spring JPA2 backend
- ETags for REST with Spring
- Spring MVC – Easy REST-Based JSON Services with @ResponseBody
- Spring MVC REST Calls With Ajax
- Develop Restful web services using Spring MVC
- Spring MVC and REST at Google App Engine
- Spring from the Trenches: Adding Validation to a REST API
- Exception Handling for REST with Spring 3.2
- Bootstrap a Web Application with Spring 3
- Tutorial – REST API design and implementation in Java with Jersey and Spring
- Spring REST: Exception handling vol. 1
- Spring REST: Exception handling vol. 2
- Spring REST: Exception handling vol. 3
- Spring RestTemplate with a linked resource
- Building a HATEOAS API with JAX-RS and Spring
Spring WEB Services
Spring Web Services (Spring-WS) is a product of the Spring community focused on creating document-driven Web services. Spring Web Services aims to facilitate contract-first SOAP service development, allowing for the creation of flexible web services using one of the many ways to manipulate XML payloads.
- JAX-WS with Spring and Maven Tutorial
- Spring 3, Spring Web Services 2 & LDAP Security
- JAX-WS Spring Integration Example
- Building a SOAP Webservices Proxy Module using Spring Webservices
Spring Unit Test Support
Spring integrates with many popular unit test frameworks to test its services.
- Spring 3 Testing with JUnit 4 – ContextConfiguration and AbstractTransactionalJUnit4SpringContextTests
- Enhancing Spring Test Framework with beforeClass and afterClass setup
- Integration testing scoped beans in CDI 1.0 and Spring 3.1
- Spring Testing Support with TestNG
- Spring Testing Support and Context caching
- Unit Testing of Spring MVC Controllers: Configuration
- Getting Started With Spring’s MVC Test Framework – Part 1
- Getting Started With Spring’s MVC Test Framework – Part 2
- Testing Spring Data Neo4j Applications with NoSQLUnit
- Unit Testing of Spring MVC Controllers: REST API
- Maven Integration Testing And Spring Restful Services
- DBUnit, Spring and Annotations for Database testing
- Spring JUnit Test Example
Spring JMS Support
Spring provides a JMS integration framework that simplifies the use of the JMS API and shields the user from differences between the JMS 1.0.2 and 1.1 APIs. This section also provides tutorials on how to integrate Spring with popular third party JMS providers.
- Spring 3 HornetQ 2.1 Integration Tutorial
- JMS and Spring: Small Things Sometimes Matter
- Spring JMS, message automatic conversion, JMS template
- Spring JMS: Processing messages within transactions
Spring Data
Spring Data makes it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services as well as provide improved support for relational database technologies.
- The Persistence Layer with Spring Data JPA
- Spring Data JDBC generic DAO implementation – most lightweight ORM ever
- Domain modeling with Spring Data Neo4j
- Testing Spring Data Neo4j Applications with NoSQLUnit
- Spring Data Solr Tutorial: Introduction to Solr
- Spring Data Solr Tutorial: Configuration
- Spring Data Solr Tutorial: CRUD (Almost)
- Spring Data Solr Tutorial: Query Methods
- Spring Data Solr Tutorial: Adding Custom Methods to a Single Repository
- Spring Data Solr Tutorial: Pagination
- Spring Data Solr Tutorial: Sorting
- Spring Data Solr Tutorial: Dynamic Queries
- Spring Data Solr Tutorial: Adding Custom Methods to All Repositories
- Auditing entities in Spring Data MongoDB
- Caching with Spring Data Redis
- Spring Data JPA and pagination
- Implement Bootstrap Pagination With Spring Data And Thymeleaf
- Using Redis with Spring
- Redis pub/sub using Spring
- Getting started with Spring Data Solr
- Spring Data MongoDB cascade save on DBRef objects
- Spring Data JPA Tutorial: Introduction
- Spring Data JPA Tutorial: Getting the Required Dependencies
- Spring data tutorial for beginners
- Spring Data Gemfire Example
- Spring Data Cassandra Example
- Spring Data Redis Example
- Spring Data MongoDB REST Example
- Spring Data Solr Example
- Spring Data MongoDB Example
- Spring Data Rest Example
Spring Security
Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications.
- Securing GWT apps with Spring Security
- Spring Security: Prevent brute force attack
- Securing your Tomcat app with SSL and Spring Security
- OAuth with Spring Security
- Securing a RESTful Web Service with Spring Security 3.1, part 3
- Basic and Digest authentication for a RESTful Service with Spring Security 3.1, part 6
- Authentication against a RESTful Service with Spring Security
- Spring Security Part 1 – Simple Login application with database
- Spring Security Part 2 – Password Encryption, Customize 404 and 403 error page
- Spring Security Login
- Add RememberMe Authentication With Spring Security
- Spring Security Misconfiguration
- Secure REST services using Spring Security
- Stateless Spring Security Part 1: Stateless CSRF protection
- Stateless Spring Security Part 2: Stateless Authentication
- Spring Security – Behind the scenes
- How to secure Jersey REST services with Spring Security and Basic authentication
Spring Social
Spring Social is an extension of the Spring Framework that allows you to connect your applications with Software-as-a-Service (SaaS) providers such as Facebook and Twitter.
- Getting Started with Spring Social
- Getting Started with Spring Social – Part 2
- Spring Social Twitter Setup
- Tweeting StackExchange Questions with Spring Social
- Tweeting StackExchange with Spring Social – part 1
- Spring social example on spring boot or how I stopped worrying and loved autoconfiguration
Spring Integration
Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns. It enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters. Those adapters provide a higher-level of abstraction over Spring’s support for remoting, messaging, and scheduling.
- Spring Integration with reCAPTCHA
- Rube Goldberg Spring Integration
- Spring Integration File Polling and Tests
- Aggregating async results using Spring Integration
- Spring Integration – Robust Splitter Aggregator
- Spring Integration – Application from scratch, Part 1
- Spring Integration – Application from scratch, Part 2
- Spring Integration: A lightweight integration Approach
- Spring Integration – Using RMI Channel Adapters
- How error handling works in Spring Integration
- Spring Integration Standalone application with Spring Boot
- Spring Integration 4.0: A complete XML-free example
- Spring Integration Java DSL sample
- Creating a REST API with Spring Boot and MongoDB
- Getting started with Jersey and Spring Boot
- High Available AMQP Backed Message Channels via Spring Integration and RabbitMQ
- Spring rest template example
- Spring struts integration example
Spring Batch
Spring Batch is a lightweight, comprehensive batch framework designed to enable the development of robust batch applications vital for the daily operations of enterprise systems.
- Chunk Oriented Processing in Spring Batch
- TaskletStep Oriented Processing in Spring Batch
- Spring Batch Tutorial with Spring Boot and Java Configuration
- Scaling Spring Batch – Step Partitioning
- Spring Boot and Spring Data REST – exposing repositories over REST
- Spring Batch Tasklet Example
- Spring Batch Job Example
- Spring Batch Quartz Example
- Spring Batch Scheduler Example
- Spring Batch JobRepository Example
- Spring Batch Partitioning Example
Spring Roo
Spring Roo is a next-generation rapid application development tool for Java developers. It focuses on higher productivity, stock-standard Java APIs, high usability, avoiding engineering trade-offs.
Spring Boot
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that can you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
- Spring Boot: Fast MVC start
- Testing mail code in Spring Boot application
- Deploying a Spring boot application to Cloud Foundry with Spring-Cloud
- Using @ConfigurationProperties in Spring Boot
- Spring boot war packaging
- Black Box Testing of Spring Boot Microservice is so easy
- Creating a REST API with Spring Boot and MongoDB
- Configure a Spring JMS application with Spring Boot and annotation support
https://www.javacodegeeks.com/tutorials/java-tutorials/enterprise-java-tutorials/spring-tutorials