小编Rya*_* Cy的帖子

如何解决 java 错误:包 javax.annotation 不可见,Java 版本 9

使用 gradle 在 Spring 会话示例下构建时:https ://docs.spring.io/spring-session/docs/current/reference/html5/guides/boot-findbyusername.html

我遇到了关于 java.annotation 模块的错误,有人知道如何解决吗?

/spring-session/spring-session-core/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java:22: error: package javax.annotation is not visible
import javax.annotation.PostConstruct;
            ^
  (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
warning: unknown enum constant When.MAYBE
  reason: class file for javax.annotation.meta.When not found
1 error
1 warning

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':spring-session-core:compileJava'.
> Compilation failed; see the compiler error output for details.
Run Code Online (Sandbox Code Playgroud)

我尝试在 build.gradle 中添加以下配置,但问题仍然存在。

tasks.withType(AbstractCompile) { …
Run Code Online (Sandbox Code Playgroud)

java gradle spring-session

5
推荐指数
2
解决办法
3850
查看次数

标签 统计

gradle ×1

java ×1

spring-session ×1