1

如何为下面的 java 类创建 xml bean。我正在使用旧的 spring 版本,我需要为以下“TestSample”类创建一个 xml bean。

@Service
@EnableConfigurationProperties(SampleProperties.class)
public class TestSample{

    @Autowired
    public ClientService clientService;
    
    @Autowired
    public RestTemplate              restTemp;
        
    public Map<String, String> testing(String a, String b, String c) throws Exception {     
        Map<String, String> map =  clientService.find(a, b, c);
        System.out.println("**=="+map.get(0));
        return map;
    }
}

客户端服务类。

@Service
@Slf4j
@DependsOn("restTemp")
public class ClientService {
public ClientService(
             @Autowired  final SampleProperties sampleProperties,
             @Autowired(required = false) final ObjectMapper pObjectMapper) throws UnknownHostException {
             
}
//......
}
4

0 回答 0