如何解决Java中找不到错误bean的错误?

问题描述 投票:0回答:1

我有在NoteService接口中定义的调用方法,该方法的实现在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.

我需要帮助解决此错误。

这是我尝试从call访问NoteImpl class方法的地方,是我的Refresh类>

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);

}

我有在NoteService接口中定义的调用方法,该方法的实现在NoteImpl类中。我正在尝试从Refresh类访问此方法,但出现此错误...

java spring-boot javabeans
1个回答
0
投票

在构造函数的头上添加@Autowired注释:

© www.soinside.com 2019 - 2024. All rights reserved.