小编Fen*_*zox的帖子

Spring Boot Maven 安装错误 - 无法找到 @SpringBootConfiguration

在为我的项目创建 Jar 文件之前,我试图在我的 Spring Boot 项目上进行清理和安装,但是我遇到了这个错误

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
Run Code Online (Sandbox Code Playgroud)

我是 Spring Boot 的新手,从未真正使用过它的测试功能。所以我的测试类几乎是项目最初创建的默认类。

我的测试班

   package com.Alex.demo;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;


@SpringBootTest
class WebAppApplicationTests {

    @Test
    void contextLoads() {
    }

}
Run Code Online (Sandbox Code Playgroud)

文件目录

在此处输入图片说明

java spring maven spring-boot

6
推荐指数
0
解决办法
255
查看次数

Eclipse 调试器不工作(禁用跳过断点)

这是我第一次运行调试器来检查我的二叉搜索树的值,但它似乎跳过了所有调试器,并且在蓝点旁边有一个奇怪的箭头。顺便说一句,跳过所有断点被禁用我确定它。

这是我运行程序的简短 GIF https://gyazo.com/e236c1bd75ac746bf9982871ca847233

添加了我的其他课程

public class BinaryTree<T extends Comparable<T>> {

private class Node{

    private T data;
    private Node left;
    private Node right;

    // left and right child do not have to nessary exist
    public Node ( T data) {
        this.data = data;
        this.left = null;
        this.right = null; 
    }}

    private Node root;
    private int count = 0;

    public void add( T data) {
        if ( isEmpty()) {
            root = new Node(data);
            count++;
        }
        else {
            insert(data, root);
            count++;
        } …
Run Code Online (Sandbox Code Playgroud)

java eclipse debugging

5
推荐指数
0
解决办法
124
查看次数

多线程 Spring-boot 控制器方法

因此,我的应用程序 (spring-boot) 运行速度非常慢,因为它使用 Selenium 来抓取数据、处理数据并显示在主页中。我遇到了多线程,我认为它可以对我的应用程序有用以使其运行得更快,但是教程似乎显示在带有 main.js 的普通 java 应用程序的设置中。如何在我的控制器中多线程这个单一方法?

get.. 的方法都是 selenium 方法。我希望同时运行这 4 行代码

   @Autowired
        private WebScrape webscrape;
    
    @RequestMapping(value = "/")
    public String printTable(ModelMap model) {
        model.addAttribute("alldata", webscrape.getAllData());
        model.addAttribute("worldCases", webscrape.getWorlValues().get(0));
        model.addAttribute("worldDeaths", webscrape.getWorlValues().get(1));
        model.addAttribute("worldPop", webscrape.getWorlValues().get(2));

        return "index";
    }
Run Code Online (Sandbox Code Playgroud)

java spring multithreading threadpool spring-boot

5
推荐指数
0
解决办法
87
查看次数