我有以下 pom.xml 包含手动 jax deps jaxb-api
,jaxb-impl
并且jaxb-core
由于它从 JDK 11 中删除:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.M2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--TEST-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!--Three below dependencies due to JDK 11 removed jaxb-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<!--For Eureka Client-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- Spring Cloud Config Client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!--To provide version for Eureka Client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
mvn clean:install
但是,在尝试运行应用程序之后,我不断收到有关过滤器的错误消息。
22:45:16.622 [main] 调试 org.springframework.beans.factory.support.DefaultListableBeanFactory - 在线程“main”java.lang 中创建单例 bean 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer' 的共享实例。 TypeNotPresentException:java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117) 的 java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature 中不存在类型 javax.servlet.Filter( Reifier.java:125) 在 java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) 在 java.base/sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java: 68) 在 java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) 在 java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) 在 java.base/sun.reflect.generics.repository.ClassRepository.computeSuperInterfaces(ClassRepository.java:117)在 java.base/sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:95) 在 java.base/java.lang.Class.getGenericInterfaces(Class.java:1138) 在 org.springframework.core.ResolvableType .getInterfaces(ResolvableType.java:491) 在 org.springframework.core.ResolvableType.as(ResolvableType.java:449) 在 org.springframework.core.ResolvableType.as(ResolvableType.java:450) 在 org.springframework.core。 ResolvableType.forMethodParameter(ResolvableType.java:1305) at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1272) at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1262) at org.springframework.core.BridgeMethodResolver.isResolvedTypeMatch(BridgeMethodResolver.java:157) at org.springframework.core.BridgeMethodResolver.isBridgeMethodFor(BridgeMethodResolver.java:141) at org .springframework.core.BridgeMethodResolver.searchCandidates(BridgeMethodResolver.java:120) at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:82) at org.springframework.core.annotation.AnnotationsScanner.processMethodAnnotations(AnnotationsScanner.java:386 ) 在 org.springframework.core.annotation.AnnotationsScanner.processMethod(AnnotationsScanner.java:236) 在 org.springframework.core.annotation.AnnotationsScanner.processMethodHierarchy(AnnotationsScanner.java:266) 在 org.springframework.core.annotation.AnnotationsScanner.process(AnnotationsScanner.java:109) at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:96) at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner. java:77) 在 org.springframework.core.annotation.TypeMappedAnnotations.isPresent(TypeMappedAnnotations.java:97) 在 org.springframework.core.annotation 的 org.springframework.core.annotation.TypeMappedAnnotations.scan(TypeMappedAnnotations.java:241) .AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:531) at org.springframework.context.annotation.BeanAnnotationHelper.isBeanAnnotated(BeanAnnotationHelper.java:41) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.isMatch(ConfigurationClassEnhancer.java:439)在 org.springframework.cglib.proxy.Enhancer.emitMethods(Enhancer.java:1214)在 org.springframework.cglib.proxy .Enhancer.generateClass(Enhancer.java:723) 在 org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33) 在 org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) 在org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareGeneratorStrategy.generate(ConfigurationClassEnhancer.java:252) 在 org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:358) 在 org.springframework.cglib.proxy.Enhancer。在 org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java: 108)在 org.springframework 的 java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 的 org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)。 cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) 在 org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) 在 org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData。 get(AbstractClassGenerator.java:134) 在 org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) 在 org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:569) at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:416) at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer. java:137) 在 org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:429) 在 org.springframework.context.annotation 的 org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109) .ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:263) 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:130) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext. java:531) at org.springframework.context.annotation.AnnotationConfigApplicationContext.(AnnotationConfigApplicationContext.java:88) at com.example.authservice.AuthServiceApplication.main(AuthServiceApplication.java:13) 原因:java.lang.ClassNotFoundException: javax. servlet.Filter 在 java.base/jdk.internal.loader.ClassLoaders$AppClassLoader 的 java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)。loadClass(ClassLoaders.java:178) 在 java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) 在 java.base/java.lang.Class.forName0(Native Method) 在 java.base/java。 lang.Class.forName(Class.java:398) 在 java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
添加 3 个额外的部门后还有什么问题?