Spring Framework

Spring Framework, Spring Boot & Spring Cloud

Vue + Spring Boot: Document Batch Upload Design

Document Batch Upload Conversation Vue + Spring Boot: Document Batch Upload Design 🧩 Scenario You are building a batch document upload feature with the following requirements: Each file has its own metadata: originalFileName, title The group of files shares metadata: description, tags, categoryId, accessLevel When submitted, Spring Boot backend stores group metadata to upload_groups table […]

Vue + Spring Boot: Document Batch Upload Design Read More »

Combined Development Environment: Spring Boot + Vue 3

Spring + Vue 3 Development Environment Setup 1. Project Structure your-project/ ├── backend/ ← Spring Boot project (Maven or Gradle) ├── frontend/ ← Vue 3 project (Vite preferred) Use this monorepo structure to keep backend and frontend organized. 2. Backend Setup (Spring Boot) Create project in IntelliJ via Spring Initializr. Add dependencies: Spring Web, Spring

Combined Development Environment: Spring Boot + Vue 3 Read More »

How ServiceInstanceListSuppliers is connected with Eureka server to get the registry list of microservices?

Spring Cloud LoadBalancer and Eureka How ServiceInstanceListSuppliers Connects to Eureka 🔗 Overview In a Spring Cloud microservices architecture using Eureka and Spring Cloud LoadBalancer, service discovery and load balancing involve the following flow: The Eureka Client registers services with the Eureka Server. The client keeps a local cache of the registry information from the server.

How ServiceInstanceListSuppliers is connected with Eureka server to get the registry list of microservices? Read More »

Spring Cloud 中自定义 FeignClient 负载均衡算法:加权随机示例

Spring Cloud 中自定义 FeignClient 负载均衡算法:加权随机示例 Spring Cloud 中自定义 FeignClient 负载均衡算法:加权随机示例 🧩 场景描述 本文将介绍如何在 Spring Cloud 2023+ 中,将 RestTemplate 替换为 FeignClient,并使用自定义的 加权随机负载均衡算法 实现服务实例选择。 1️⃣ 使用 FeignClient @FeignClient(name = “my-service”) public interface MyServiceClient { @GetMapping(“/api/hello”) String sayHello(); } 2️⃣ 实现 WeightedLoadBalancer public class WeightedLoadBalancer implements ReactorServiceInstanceLoadBalancer { private final ObjectProvider<ServiceInstanceListSupplier> serviceInstanceListSupplierProvider; private final String serviceId; public WeightedLoadBalancer(ObjectProvider<ServiceInstanceListSupplier>

Spring Cloud 中自定义 FeignClient 负载均衡算法:加权随机示例 Read More »

Spring Security – Individual Realm Access Control Spring Security – Ensuring Each Customer Accesses Only Their Realm Q: In a bank online app, every individual customer has their own sole realm. How can this requirement be satisfied with Spring’s role-based security mechanism? Spring’s role-based mechanism controls access to functionality like user vs. admin, but doesn’t

Read More »

What is Eureka REST API?

Eureka REST API in Spring Cloud Spring Cloud 中的 Eureka REST API 说明 🧩 什么是 Eureka REST API? 在 Spring Cloud 生态中,Eureka 是 Netflix 提供的一个服务注册与发现组件。 Eureka REST API 是 Eureka Server 提供的基于 HTTP 的接口,用于: 服务实例注册 服务心跳续约 服务下线注销 服务查询 Spring Cloud 已封装 Eureka 的调用逻辑,但我们也可以手动调用 REST API。 🔧 Eureka REST API 使用方式 1. 注册服务实例 POST /eureka/apps/{app-name} Content-Type:

What is Eureka REST API? Read More »

How to Satisfy “Only-Access-Own-Realm” in Spring Security

In a banking application where each individual customer has their own realm of data (e.g., account info, transaction history), the traditional role-based security mechanism in Spring Security (e.g., ROLE_USER, ROLE_ADMIN) is not enough on its own to enforce access control at the data level. What Role-Based Security Does Well Role-based access in Spring Security is

How to Satisfy “Only-Access-Own-Realm” in Spring Security Read More »

A colorful array of tulips blooming in a field, showcasing the beauty of spring season.

Secure Spring API Endpoints with KeyCloak & Spring Security 6+

Securing a Spring Boot endpoint with Keycloak and Spring Security 6 involves integrating your Spring Boot application with Keycloak as the identity provider (IdP) using the spring-boot-starter-oauth2-resource-server module. Below are the key steps: 1. Add Dependencies Add these to your pom.xml for Maven: 2. Configure application.yml or application.properties Assuming your Keycloak realm is myrealm, client

Secure Spring API Endpoints with KeyCloak & Spring Security 6+ Read More »