SpringBoot plugin spring-boot-maven-plugin principle, and jar package deployment of SpringBoo project slimming practice

spring-boot-maven-plugin We directly use maven package (the package packaging function that comes with maven). When packaging the Jar package, the Jar package that the project depends on will not be entered together. When using java -jar When the command starts the project, an error will be reported, and the project cannot be started normally. At […]

Communication (1): springboot uses websocket

refer to : https://www.cnblogs.com/web-learn/p/15148141.html SpringBoot uses WebSocket_springboot websocket_Looking at the Milky Way Blog-CSDN Blog java WebSocketConfig import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.server.standard.ServerEndpointExporter; import javax.servlet.ServletContext; import javax.servlet.ServletException; /** * @author: xxt * @date: 2022/5/23 16:22 * @Description: Enable WebSocket support */ @Configuration public class WebSocketConfig implements ServletContextInitializer { /** * The registration of this […]

SpringBoot + minio realizes fragment upload, second transmission and resume transmission

Lao Pao said Java 2023-05-24 20:15 Published in Shanxi Included in collection #老炒说Java541 #springboot28 Old Cannon Talks about Java Ten-year-old programmers take you to play with technology No public What is minio MinIO is a Go-based high-performance object storage compatible with the S3 protocol. It adopts the GNU AGPL v3 open source protocol, and the […]

Implement multi-tenant architecture based on SpringBoot: support application multi-tenant deployment and management

1. Overview 1 What is a multi-tenant architecture? Multi-tenant architecture refers to supporting simultaneous access by multiple tenants (Tenant) in an application, each tenant has independent resources and data, and is completely isolated from each other. In layman’s terms, multi-tenancy is to “split” an application into multiple independent instances according to customer needs, and each […]

springboot integrates Redis to save commodity and commodity inventory information

1. Add dependencies and configuration <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> Add the following configuration in application.yaml: spring: redis: # address host: localhost # port, default is 6379 port: 6379 # password password: # Connection timeout timeout: 10s lettuce: pool: # The minimum idle connection in the connection pool min-idle: 0 # The maximum idle connection in […]

How to dynamically refresh the configuration of SpringBoot (scheme)

For microservices, configuration localization is a big problem. It is impossible to restart the service every time you need to change the configuration. Therefore, the final solution is to externalize the configuration and host it on a platform to achieve unnecessary Restart the service to modify multiple valid purposes at once. But for the Spring […]

SpringBoot master-slave data source switching, Mybatis Plus annotation method association query

1. Project structure 2. Main code 1 Use druid to configure the master-slave data source # data source configuration spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver druid: # Main database data source db1: url: jdbc:mysql://47.93.96.145:3306/xiaozhu_database?useUnicode=true & amp;characterEncoding=utf8 & amp;zeroDateTimeBehavior=convertToNull & amp;useSSL=true & amp;serverTimezone=GMT+8 username: root password: xiaozhu123456 # From the database data source (temporarily local) db2: […]

How to dynamically refresh the configuration of SpringBoot (custom)

The custom part of this article includes 1. Custom refresh event (with RefreshScope to achieve automatic refresh) 2. Force refresh the context (restart the entire ApplicationContext) 3. Implement Http interface loading of configuration files (similar to Nacos) Custom refresh event (with RefreshScope to achieve automatic refresh) Manual refresh of configuration based on org.springframework.cloud.context.config.annotation.RefreshScope Spring uses […]

Example explanation of redis using pipeline mode to write performance tuning under Java Springboot

Instance of redis write pipeline mode performance tuning under Springboot 1. Real scene In the process of producing real projects, it is necessary to write the data of the database to redis synchronously, and encounter the bottleneck of writing to redis during this process. Every time the project is started, the database data must be […]

Realize timed task parsing headerless .csv file into pgsql library (java, SpringBoot)

1. Scheduled tasks package cn.com.dhcc.sspcsystem.data; import cn.com.dhcc.sspcsystem.entity.ElectronicFenceInfo; import cn.com.dhcc.sspcsystem.mapper.ElectronicFenceInfoMapper; import cn.com.dhcc.sspcsystem.util.CsvImportUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import com.alibaba.fastjson.JSONArray; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.stereotype.Component; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author stb * @date 2023-05-24 * @description Synchronize XXX data regularly */ @Slf4j @Component […]