Java 无法将yahoofinance导入我的代码

Java 无法将yahoofinance导入我的代码,java,maven,yahoo-finance,Java,Maven,Yahoo Finance,它一直显示红色标志,表示未导入。我检查了我的pom.xml:所有依赖项都存在。我还能试什么 下面是代码和pom.xml文件: import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpMethod; import org.springfra

它一直显示红色标志,表示未导入。我检查了我的pom.xml:所有依赖项都存在。我还能试什么

下面是代码和pom.xml文件:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import yahoofinance.Stock;        //also not importing
import yahoofinance.YahooFinance;  // this line is not importing

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/rest/stock")
public class StockResource {

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/{username}")
    public List<Stock> getStock(@PathVariable("username") 
final String userName) {
        ResponseEntity<List<String>> quoteResponse = restTemplate.exchange("http://localhost:8300/rest/db/" + userName, HttpMethod.GET,
                null, new ParameterizedTypeReference<List<String>>() {
                });
        List<String> quotes = quoteResponse.getBody();
        return quotes
                .stream()
                .map(this::getStockPrice)
                .collect(Collectors.toList());
    }
`
    private Stock getStockPrice(String quote) {
        try {
            return YahooFinance.get(quote);
        } catch (IOException e) {
            e.printStackTrace();
            return new Stock(quote);
        }
    }
}
import org.springframework.beans.factory.annotation.Autowired;
导入org.springframework.core.ParameterizedTypeReference;
导入org.springframework.http.HttpMethod;
导入org.springframework.http.ResponseEntity;
导入org.springframework.web.bind.annotation.GetMapping;
导入org.springframework.web.bind.annotation.PathVariable;
导入org.springframework.web.bind.annotation.RequestMapping;
导入org.springframework.web.bind.annotation.RestController;
导入org.springframework.web.client.rest模板;
进口金融.库存//也不进口
导入yahoofinance.yahoofinance;//此行不导入
导入java.io.IOException;
导入java.util.List;
导入java.util.stream.collector;
@RestController
@请求映射(“/rest/stock”)
公共类股票资源{
@自动连线
rest模板rest模板;
@GetMapping(“/{username}”)
公共列表getStock(@PathVariable(“用户名”)
最终字符串(用户名){
ResponseEntity quoteResponse=restTemplate.exchange(“http://localhost:8300/rest/db/“+用户名,HttpMethod.GET,
null,新的ParameteredTypeReference(){
});
List quotes=quoterresponse.getBody();
返回报价
.stream()
.map(此::getStockPrice)
.collect(Collectors.toList());
}
`
私人股票getStockPrice(字符串报价){
试一试{
返回YahooFinance.get(报价);
}捕获(IOE异常){
e、 printStackTrace();
返还新股(报价);
}
}
}

代码有什么问题吗?

在这里发布pom.xml的代码。它在我重新启动系统后开始工作,不知道为什么,在这里发布pom.xml的代码。它在我重新启动系统后开始工作,不知道为什么,