【发布时间】:2020-01-16 00:45:11
【问题描述】:
我在 NoteService 接口中定义了 call 方法,该方法的实现在 NoteImpl 类中。我正在尝试从 Refresh 类访问此方法,但出现此错误
Parameter 3 of constructor in com.new.macro.rest.Refresh required a bean of type 'com.new.macro.unity.processorService' that could not be found.
Action:Consider defining a bean of type 'com.new.macro.unity.NoteService' in your configuration.
我需要帮助解决此错误。
这是我的 Refresh 类,我尝试从 call 访问 NoteImpl class 方法
package com.new.macro.rest;
@Component
public class Refresh implements BaseService {
private final NoteService<Inbuild> iNoteService;
public Refresh(final NoteService iNoteService) {
this.iNoteService = iNoteService;
}
@PUT
public String firstRefresh() {
iNoteService.call(Types);
return RefreshStatus.STARTED.toJsonResponse();
}
这是带有 call method functionality 的 NoteImpl 类
@Configuration
public abstract class NoteImpl implements NoteService{
private static final Logger LOGGER = LogManager.getLogger(NoteImpl.class);
private final RestTemplate restTemplate;
private final String Url;
public NoteImpl( RestTemplate restTemplate,@Value("${url}") String Url){
this.restTemplate = restTemplate;
this.Url = Url;
}
public void call(Set<Inbuild> Types, String Url) {
Set<String> results = new HashSet<>();
\\ Remaining functionality
}
}
界面如下
package com.new.macro.unity;
import java.util.Set;
public interface NoteService<T> {
void call(Set<? extends T> Types);
}
【问题讨论】:
标签: java spring-boot javabeans