Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 启动spring boot secound后获取ClassNotFoundException的时间_Java_Spring_Spring Boot_Spring Mvc - Fatal编程技术网

Java 启动spring boot secound后获取ClassNotFoundException的时间

Java 启动spring boot secound后获取ClassNotFoundException的时间,java,spring,spring-boot,spring-mvc,Java,Spring,Spring Boot,Spring Mvc,在第二次启动spring boot(通过Intellij)应用程序时,我得到一个ClassNotFoundException。因此,第一次一切正常,然后出现异常 例外情况:JavaHotSpot(TM)64位服务器VM警告:选项-Xverify:none和-noverify在JDK13中已被弃用,并可能在将来的版本中删除。错误:无法找到或加载主类com.demo.demo.DemoApplication,原因是:java.lang.ClassNotFoundException:com.demo.

在第二次启动spring boot(通过Intellij)应用程序时,我得到一个ClassNotFoundException。因此,第一次一切正常,然后出现异常

例外情况:
JavaHotSpot(TM)64位服务器VM警告:选项-Xverify:none和-noverify在JDK13中已被弃用,并可能在将来的版本中删除。错误:无法找到或加载主类com.demo.demo.DemoApplication,原因是:java.lang.ClassNotFoundException:com.demo.DemoApplication

在我的演示项目中使用Java15和gradle

build.gradle文件:

plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'}
group = 'com.demo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '15'

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
    exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'


  }
}
演示应用程序Java文件

package com.demo.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
演示控制器我的测试控制器

package com.demo.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DemoController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }
}

是否可以在已发布的类中添加导入语句Yes sure and donedoes如果连续使用gradle bootRun,则此问题仍然存在?任务:bootRun的执行失败。“>无法查询属性“mainClass”的值。“>主类名尚未配置且无法解析能否在已发布的类中添加导入语句Yes sure and donedoes如果连续使用gradle bootRun,则此问题仍然存在?任务的执行失败:bootRun'>无法查询属性“mainClass”的值。“>主类名尚未配置,无法解析