⚡ 为配置类添加@RefreshScope支持Nacos配置动态刷新

This commit is contained in:
刘泉佳
2026-10-09 18:35:06 +08:00
parent 5e6ff08460
commit e41863d7f7
5 changed files with 10 additions and 0 deletions
@@ -28,6 +28,7 @@ package org.springblade.transport.config;
import lombok.Data;
import org.springblade.thirdparty.bfi.constant.BfiConstant;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/**
@@ -42,6 +43,7 @@ import org.springframework.stereotype.Component;
*/
@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "thirdparty.bfi")
public class BfiProperties {
@@ -78,6 +78,7 @@ import org.springblade.transport.support.KingdeeApBillSyncSupport;
import org.springblade.transport.support.KingdeeReceivedInvoiceSyncSupport;
import org.springblade.transport.wrapper.InvoiceReceiptWrapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -104,6 +105,7 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
@RefreshScope
@RequiredArgsConstructor
public class InvoiceReceiptServiceImpl extends BaseServiceImpl<InvoiceReceiptMapper, InvoiceReceipt>
implements IInvoiceReceiptService {
@@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.transport.service.ICustomerArchiveService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -47,6 +48,7 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
@RefreshScope
@RequiredArgsConstructor
public class CustomerKingdeeSyncTask {
@@ -48,6 +48,7 @@ import org.springblade.transport.support.hcs.HcsPaymentSyncSupport;
import org.springblade.transport.support.hcs.HcsProjectSyncSupport;
import org.springblade.transport.support.hcs.HcsReceiptBillSyncSupport;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -81,6 +82,7 @@ import java.util.function.Supplier;
*/
@Slf4j
@Component
@RefreshScope
@RequiredArgsConstructor
public class HcsPushTask {
@@ -26,6 +26,7 @@ import org.springblade.transport.service.IInvoiceApplicationService;
import org.springblade.transport.service.IInvoiceReceiptService;
import org.springblade.transport.service.IPaymentApplicationService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -47,6 +48,7 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
@RefreshScope
@RequiredArgsConstructor
public class PaymentKingdeeResultTask {