Java o、 s.boot.SpringApplication:应用程序运行失败
春天我是新来的。我得到了这个错误。这是我的日志:Java o、 s.boot.SpringApplication:应用程序运行失败,java,spring,Java,Spring,春天我是新来的。我得到了这个错误。这是我的日志: :: Spring Boot :: (v2.1.2.RELEASE) 2019-01-31 15:55:08.747 INFO 9396 --- [ main] com.booksotre.BookstoreApplication : Starting BookstoreApplication on DESKTOP-GK4K8H8 with PID 9396 (C:\Users\shakh
:: Spring Boot :: (v2.1.2.RELEASE)
2019-01-31 15:55:08.747 INFO 9396 --- [ main] com.booksotre.BookstoreApplication : Starting BookstoreApplication on DESKTOP-GK4K8H8 with PID 9396 (C:\Users\shakh\workspace\Bookstore\target\classes started by shakh in C:\Users\shakh\workspace\Bookstore)
2019-01-31 15:55:08.752 INFO 9396 --- [ main] com.booksotre.BookstoreApplication : No active profile set, falling back to default profiles: default
2019-01-31 15:55:09.042 WARN 9396 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.booksotre.BookstoreApplication]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
2019-01-31 15:55:09.380 ERROR 9396 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.booksotre.BookstoreApplication]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at com.booksotre.BookstoreApplication.main(BookstoreApplication.java:10) [classes/:na]
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:51) ~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:88) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:75) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:685) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:998) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:332) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:191) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:295) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
... 13 common frames omitted
::弹簧启动::(v2.1.2.版本)
2019-01-31 15:55:08.747 INFO 9396---[main]com.booksotre.BookstoreApplication:使用PID 9396在DESKTOP-GK4K8H8上启动BookstoreApplication(C:\Users\shakh\workspace\Bookstore\target\classes由shakh在C:\Users\shakh\workspace\Bookstore中启动)
2019-01-31 15:55:08.752信息9396---[main]com.bookotre.bookstore应用程序:未设置活动配置文件,返回默认配置文件:默认
2019-01-31 15:55:09.042警告9396---[main]ConfigServletWebServerApplicationContext:在上下文初始化过程中遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanDefinitionStoreException:无法解析配置类[com.bookotre.BookstoreApplication];嵌套异常为java.io.FileNotFoundException:无法打开类路径资源[org/springframework/security/config/annotation/web/configuration/websecurityConfigureAdapter.class],因为它不存在
2019-01-31 15:55:09.380错误9396---[main]o.s.boot.SpringApplication:应用程序运行失败
org.springframework.beans.factory.BeanDefinitionStoreException:无法解析配置类[com.booksotre.BookstoreApplication];嵌套异常为java.io.FileNotFoundException:无法打开类路径资源[org/springframework/security/config/annotation/web/configuration/websecurityConfigureAdapter.class],因为它不存在
在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
位于org.springframework.context.support.postprocessorregistrationlegate.invokeBeanDefinitionRegistryPostProcessors(postprocessorregistrationlegate.java:275)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.support.postprocessorregistrationlegate.invokeBeanFactoryPostProcessors(postprocessorregistrationlegate.java:95)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
位于org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:316)[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在com.bookstore.BookstoreApplication.main(BookstoreApplication.java:10)[classes/:na]
原因:java.io.FileNotFoundException:无法打开类路径资源[org/springframework/security/config/annotation/web/configuration/websecurityConfigureAdapter.class],因为它不存在
在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:51)~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.CreateMataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:88)~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:75)~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:685)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:998)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:332)~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
在org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242)~[spring-context-5.1.4。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.booksotre</groupId>
<artifactId>bookstore</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Bookstore</name>
<description>frontend part of book store</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RestAPI
{
public static void main(String[] args) {
SpringApplication.run(RestAPI.class, args);
}
}
package restapi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RestAPI
{
public static void main(String[] args) {
SpringApplication.run(RestAPI.class, args);
}
}
<groupId>com.spring</groupId>
<artifactId>RestAPI</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>restapi.RestAPI</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>