public class XXService {
private RestTemplate restTemplate;
public XXService (RestTemplate restTemplate, ObjectMapper objectMapper) {
this.restTemplate = restTemplate;
this.objectMapper = objectMapper;
}
}
这个类是有参函数,build没问题,但是运行报错:
Parameter 0 0f OSTrto co.damlr.mtfcti.vicMotifictonservice meined ben f tp “SnramwMt.cient estieamdlate’ that cold mot me fou
The injection point has the following annotations:@org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type ‘org.springframework.web.client.RestTemplate’ in your configuration.Disconnected from the target VM, address: ‘127.0.0.1:56114’, transport: ‘socket
需要手动创建一个类的无参函数。
public class XXService {
private RestTemplate restTemplate;
public XXService(){
}
public XXService (RestTemplate restTemplate, ObjectMapper objectMapper) {
this.restTemplate = restTemplate;
this.objectMapper = objectMapper;
}
}
版权声明:本文为u014234260原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。