1、增加开启注解

//开启定时任务
@EnableScheduling
//开启异步调用方法
@EnableAsync
public class SpringBootStarterApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootStarterApplication.class, args);
    }

}

2、创建任务类

@Component
public class TestTask {
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    //定义每过3秒执行任务
    @Scheduled(fixedRate = 3000)
    //@Scheduled(cron = "4-40 * * * * ?")
    public void reportCurrentTime() {
        System.out.println("现在时间:" + dateFormat.format(new Date()));
    }
}

一些解释

  1. fixedRate:如果任务的处理时间大于fixedRate配置的时间,那么当任务结束的时候则会立马执行。如果是在相隔的时间段内处理完毕,假设设置的是5s,任务花了3s执行完毕,那么在2s后则会执行下一个任务。
  2. fixedDelay:如果设定的是相隔5s执行,当前任务假设需要花费8s,那么下一次的执行的时间为当前任务执行完毕后,相隔5s后再执行。

将img文件(2022101-Ipv4-Bypass-5.15-x86-64-generic-squashfs-combined-efi.img)解压出来,使用VBoxManage.exe进行转换,cmd语句如下:

D:\vbox\openwrt>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" convertfromraw -format VDI 2022101-Ipv4-Bypass-5.15-x86-64-generic-squashfs-combined-efi.img 2022101-Ipv4-Bypass-5.15-x86-64-generic-squashfs-combined-efi.vdi

新建虚拟机使用转换出来的vdi虚拟硬盘文件,首次启动前先扩大虚拟磁盘空间,否则磁盘空间满,配置文件修改后重启会恢复默认值。

KVM安装完所有驱动后还是有未知设备。

参考微软文章

Hyper-V integration components update for Windows virtual machines (microsoft.com)

https://support.microsoft.com/en-us/topic/hyper-v-integration-components-update-for-windows-virtual-machines-8a74ffad-576e-d5a0-5a2f-d6fb2594f990

下载对应版本补丁,然后用cmd管理员方式执行,然后重启即可。

dism /online /Add-Package /PackagePath:C:\Users\neo\Desktop\windows6.x-hypervintegrationservices-x64.cab