Scope of spring learning bean

scope It includes Singleton, Prototype, request, session, application and websocket. It mainly talks about the commonly used Singleton and Prototype. Singleton When a bean is defined as a singleton object, the IoC container creates only one instance of the bean object. The bean object is stored in the container's cache (map). Subsequent referen ...

Posted by dillonit on Tue, 15 Oct 2019 19:08:41 -0700

Lazy load of spring learning

Lazy Under normal circumstances, bean loading starts after the container is started, so if there is an error in the loading process, it can be found immediately. Due to some specific business requirements, some beans need to be created at the first request of the IoC container. These beans can be marked as delayed loading. XML In the XML config ...

Posted by Robert07 on Tue, 15 Oct 2019 12:53:13 -0700

springboot solves the problem that the @ RequestBody parameter in the controller cannot read the body content after the interceptor reads the body content of the web request input stream parameter.

In the previous chapter, we briefly introduced the source code demo of the interceptor. , there is no exception when getting get parameter in interceptor, but after reading body content in input stream in interceptor, @ RequestBody annotation parameter in controller cannot get content The following desc ...

Posted by smokebusted on Tue, 15 Oct 2019 10:21:40 -0700

Realize the synchronization between redis cache and database

I. Through annotation, spring 3 above provides annotation for cache programming. @Cacheable: used when querying. Note that Long type needs to be converted to Sting type, otherwise exceptions will be thrown. @CachePut: used when updating. With this annotation, data will be queried from the DB. @CacheEvic ...

Posted by JeroenVO on Tue, 15 Oct 2019 09:08:27 -0700

[step by step implementation of advertising system in Spring cloud] configuration project structure & Implementation of Eureka service

Parent project management First, before creating the delivery system, let's take a look at our engineering structure: Mscx ad sponsor is our advertising system. For the above structure, we need to create a parent project mscx ad first To write the pom of the parent project to manage our unified dependency information. <?xml version="1.0" en ...

Posted by r2ks on Tue, 15 Oct 2019 09:06:19 -0700

The naming of spring learning bean

bean name Each bean has one or more identifiers that must be unique in the container. XML If neither id nor name is specified, the IOC container will automatically generate a unique identifier, that is, the full class name. Unique identifier if only id or name is specified. If specified at the same time, id is an identifier and name is an alia ...

Posted by gabrielkolbe on Tue, 15 Oct 2019 07:23:17 -0700

Spring boot2 unit test

Introduce maven dependency powermock is introduced to solve the problem of static method mock. <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>2.0.2</version> <scope>test</scope> </dependency> <dependency> ...

Posted by leeharvey09 on Tue, 15 Oct 2019 03:50:03 -0700

Spring Boot 2.X: Spring Cache

Introduction to Spring Cache Multi-Cache support is introduced in Spring 3.1. In the spring-context package, two interfaces, org.spring framework.cache.Cache and org.spring framework.cache.CacheManager, are defined to unify different caching technologies. Cache interfaces include common operations of caching: add, delete, read, and so on. Cache ...

Posted by copernic67 on Mon, 14 Oct 2019 20:00:28 -0700

Design Patterns-Dynamic Agent Principle and Writing a Dynamic Agent of Our Own by Imitating JDK Proxy

This article contains a lot of code, which may be a bit rough. You can read it selectively. The purpose of this article is to simply analyze the principle of dynamic agent, to imitate JDK Proxy to write a dynamic agent and to summarize several agents. For the introduction and explanation of the agency model, there are many high-quality articles ...

Posted by grga on Mon, 14 Oct 2019 18:13:34 -0700

Spring Cloud Stream for communication between services

Spring Cloud Stream The underlying implementation of Srping cloud Bus is Spring Cloud Stream, which is designed to build a message-driven (or event-driven) micro-service architecture. Spring Cloud Stream itself encapsulates (integrates) and extends modules such as Spring Messaging, Spring Integration, Spring Boot Actuator, Spring Boot Externali ...

Posted by offnordberg on Mon, 14 Oct 2019 13:21:14 -0700