Description
Spring is currently the most widely used Java framework for developing business applications. It has always offered an alternative to the complexity of Java EE. Its advantages: increase developer productivity, facilitate testing, improve performance, facilitate technology integration.
Spring is built primarily around three key design patterns: inversion of control or dependency injection, aspect-oriented programming and abstraction layers identifying all the needs of an enterprise application (Persistence, Messaging, Security, Tracing, etc.).
This Spring training starts with an in-depth review of the basic concepts of the Spring framework. This essential chapter allows you to demystify the magical aspect of Spring and to understand the underlying mechanisms used in the following chapters. Then, each chapter is devoted to the different software layers of applications currently developed in companies, data persistence, the web layer, security and testing. The auto-configuration mechanisms provided by SpringBoot, the Spring project accelerator, are detailed in each chapter.
Who is this training for ?
For whom ?
This course is aimed at Java developers wishing to use the Spring framework to facilitate the development and testing of their applications. Also concerned are Java SE / Java EE architects who have to think about the infrastructure of enterprise Java applications.
Prerequisites
Participants must have a good knowledge of Java demonstrated in one or more professional projects. To fully benefit from all the chapters, they must be aware of web issues, data access (persistence) and application testing.
Training objectives
Training program
- Introduction au framework Spring
- The genesis of the project, its positioning with respect to Java EE
- The Pivotal Software offer, the use cases of the framework, the 10 commandments of a Spring project
- IoC and dependency injection: The design pattern at the heart of the framework
- The types of injections supported by Spring
- Spring: as a Factory to Bean, lightweight container
- How to configure the framework: XML, annotations, auto-configuration with Spring Boot
- Spring: A lightweight container
- Browsing the BeanDefinition, BeanFactory and ApplicationContext APIs
- The life cycle of beans
- The Environment interface: configuration properties and profiles
- Other core features: SpEl, Messages, Resource loading
- Spring and annotations
- Configuration via annotations.
- Component and its different stereotypes
- Inject dependencies via annotations: Autowired, Resource, Inject
- The implicit injection by constructor
- Annotations for profiles, their use case, activation modes
- Spring AOP
- The concepts of AOP, the problems solved by AOP
- The terminology used: aspect, joinpoint, advice, shortcut, weaving
- The different types of “advice”: around, before, throws, after
- What is the support for AOP in Spring?
- XML configuration, benefits/disadvantages
- Integration with the AspectJ framework, AOP via annotations
- Spring Boot
- The principle of auto-configuration, application to Java
- How to get started? Spring Initializ and the available starters
- A single file: Management of configuration properties
- Spring Tools Suite IDE Support
- Spring Data and data access (JDBC / Hibernate / JPA / NoSQL)
- The objective of Spring Data, the Repository and CrudRepository abstractions
- Alternatives for querying domain objects
- Application to JPA: Spring Data JPA
- The support classes provided: JdbcTemplate, HibernateTemplate
- How to manage transactions, the @Transactional annotation
- The benefits of SpringBoot auto-configuration to configure the DataSource
- Application to NoSQL: Spring Data MongoDB
- Query and support class
- The contributions of SpringBoot auto-configuration, An embedded MongoDB
- Spring MVC for web applications
- Reminders of the MVC architectural pattern, implementation in Spring
- SpringBoot auto-configuration and its customization with WebMvcConfigurer
- How to write a Spring controller?
- Resolution of views, the example of Thymeleaf,
- Management of locales and themes, handling of exceptions, Error page
- Spring MVC pour les APIs RESTFul
- The specificities of REST controllers
- Typical configuration: CORS
- Do not neglect JSON serialization: Customization via annotations from the Jackson library
- Automatically document your API with SpringDoc and OpenAPI
- Query a Restful API with the RestTemplate support classes
- Spring Security
- The contributions of SpringSecurity and basic concepts
- The auto-configuration of SpringBoot, the protection filters
- The different alternatives for authentication, SecurityContext object
- Web security via the SpringSecurityFilterChain bean, understand its configuration, know how to debug security
- GrantedAuthoriry vs Role
- Implementation: Stateful security or security Stateless?
- The oAuth2 protocol and the JWT standard
- Support for oAuth2 in Spring5
- Protection of the business layer, mechanism and implementation
- Spring and testing
- The contributions of Spring-test, The SpringBoot context
- The @SpringBootTest annotation, what is the configuration detection mechanism, the resulting use cases
- Layer-based integration tests with self-configured tests
- Testing an API secured by SpringSecurity
- Deploying Spring applications
- For Ops: the starter actuator
- Preparing for production, the build-info objective of the Maven plugin
- The different packaging formats, support of the Maven or Gradle plugin
- The SISE as a SpringBoot application service
- Creating a docker image, typical kubernetes manifest document