Backend Development 7 min read

Solving Coupling Issues in Java Backend Services with a Dedicated TPS Microservice

The article analyzes high coupling problems caused by multiple controller calls and third‑party integrations in a Java settlement backend, and proposes a dedicated TPS microservice with unified Feign interfaces, enum‑based routing, and factory patterns to decouple frontend and backend logic while providing implementation examples and diagrams.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
Solving Coupling Issues in Java Backend Services with a Dedicated TPS Microservice

1. Coupling Issues

Sometimes when calling interfaces, such as a push notification interface, multiple channels may be involved.

In my current scenario, the settlement backend interacts with the Kingdee financial system and handles multiple settlement order types. Exposing a separate controller for each type and sharing common third‑party interfaces leads to high coupling.

Problems on the Frontend

Need to call multiple backend controllers with different parameters; any backend change requires modifications in many pages, resulting in high coupling.

Need to configure permissions for multiple buttons.

Problems on the Backend

Each business interface must implement its own push method to third‑party services, causing duplicated code and high coupling.

If a third‑party service changes, many backend interfaces must be updated.

2. How to Solve

Create a dedicated microservice (tentatively named tps ) that handles all third‑party integrations, encapsulating common parameters.

Other business systems (order, settlement, supplier) call this tps service via a unified Feign interface.

Business systems focus only on service‑layer logic, without dealing with integration details.

The overall flow diagram is as follows:

3. Concrete Implementation

Tps Service

The tps service is exposed as a Feign interface; the frontend calls it uniformly.

//对接第三方服务接口
public interface IKingdeeManagementService {
    Boolean push(KingdeePushCO.Request request);
}

Feign interface implementation class:

@Slf4j
@Service
public class KingdeeManagementServiceImpl implements IKingdeeManagementService {

    @Autowired
    private ApplicationContext applicationContext;
    @Autowired
    private KingdeeThirdSettingService kingdeeThirdSettingService;

    @Override
    public Boolean push(KingdeePushCO.Request request) {
        KingdeeBusinessPushServiceEnum kingdeePushServiceEnum = KingdeeBusinessPushServiceEnum.getKingdeePushServiceEnumByType(request.getBusinessType());
        IKingdeeBusinessPushService kingdeePushService = null;
        try {
            kingdeePushService = (IKingdeeBusinessPushService) applicationContext.getBean(kingdeePushServiceEnum.getClazz());
        } catch (BeansException e) {
            log.error("当前类型暂未实现,请联系开发");
            throw new ServiceException("当前类型暂未实现,请联系开发");
        }
        R
result = null;
        result = kingdeePushService.pushKingdee(request);
        return true;
    }
}

Enum definition:

public enum KingdeeBusinessPushServiceEnum {

    private Class clazz;
    private Integer type;
    private String interFaceName;

    KingdeeBusinessPushServiceEnum(Class clazz, Integer type, String interFaceName) {
        this.clazz = clazz;
        this.type = type;
        this.interFaceName = interFaceName;
    }
    // example constant omitted for brevity
}

The enum contains clazz , type , and interFaceName attributes:

clazz : the Feign interface provided by the business system.

type : integer value passed from the frontend, mapping to a specific Feign interface.

interFaceName : name of the third‑party interface to invoke.

Business System

Taking the BMS service as an example: it inherits the tps Feign interface and overrides the push method.

Feign implementation is initialized via a factory class, producing different service implementations.

JaKingdeeFactoryUtil obtains factory instances; enumeration mapping can reduce case statements.

JaKingdeeServiceFactory is an interface providing methods.

The implementation follows a double‑checked singleton pattern with pessimistic locking to avoid multiple creations; SpringContextUtils/getBean retrieves service instances, allowing business layers to simply call the service interface.

4. Summary

This design demonstrates a unified approach to calling third‑party interfaces, addressing repeated calls, result caching, timeout handling, and fallback strategies, serving as a starting point for further improvement.

Backend Technical Community

Build a high‑quality technical exchange community; developers, technical recruiters, and anyone willing to share internal job referrals are welcome to join and help each other progress.

Maintain civil discourse, focusing on technical exchange , job referrals , and industry discussion .

Advertisers are prohibited; do not trust private messages to avoid scams.

Contact me to be added to the group.

JavaMicroservicesBackend Developmentfeignservice architecturecoupling
Selected Java Interview Questions
Written by

Selected Java Interview Questions

A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.