package com.ecep.contract.ds.contract; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import com.ecep.contract.ds.contract.service.ContractService; import com.ecep.contract.model.Contract; import com.ecep.contract.util.EntityStringConverter; import jakarta.annotation.PostConstruct; @Lazy @Component public class ContractStringConverter extends EntityStringConverter { @Lazy @Autowired ContractService service; public ContractStringConverter() { } @PostConstruct private void init() { setInitialized(project -> service.findById(project.getId())); setSuggestion(service::search); // TODO 按名称找出,容易出问题 setFromString(service::findByName); } }