com.google.inject.ProvisionException:无法提供

com.google.inject.ProvisionException: Unable to provision

我根据 http://seedstack.org/docs/basics/

中提到的指南创建了简单的 seedstack Web 项目

Undertow 也是从 seedstack:run 开始的。

但是,在访问 "hello" 资源时会抛出以下异常:

ERROR 2018-07-25 21:37:34,468 XNIO-1 task-2 io.undertow.request
UT005023: Exception handling request to /api/seed-w20/application/configuration

null returned by binding at org.seedstack.w20.internal.W20Module.configure(W20Module.java:51) (via modules: com.google.inject.util.Modules$OverrideModule -> io.nuun.kernel.core.internal.injection.KernelGuiceModuleInternal -> org.seedstack.w20.internal.W20Module) but the 3rd parameter of org.seedstack.w20.internal.FragmentManagerImpl.(FragmentManagerImpl.java:32) is not @Nullable at org.seedstack.w20.internal.W20Module.configure(W20Module.java:51) (via modules: com.google.inject.util.Modules$OverrideModule -> io.nuun.kernel.core.internal.injection.KernelGuiceModuleInternal -> org.seedstack.w20.internal.W20Module) while locating org.seedstack.w20.internal.ConfiguredApplication for the 3rd parameter of org.seedstack.w20.internal.FragmentManagerImpl.(FragmentManagerImpl.java:32) while locating org.seedstack.w20.internal.FragmentManagerImpl while locating org.seedstack.w20.FragmentManager for field at org.seedstack.w20.internal.rest.application.ApplicationConfigurationResource.fragmentManager(ApplicationConfigurationResource.java:38) while locating org.seedstack.w20.internal.rest.application.ApplicationConfigurationResource

有什么帮助吗?

这是最近引入 w20-bridge 的错误,当没有 w20.app.json 配置文件时会发生。

您可以通过在类路径的根目录下创建一个空对象 w20.app.json 文件来解决它:

{}

您还可以将所有 w20-bridge 依赖项的版本更新到 3.2.4,它有一个修复程序。这可以通过使用 POM 的 dependencyManagement 部分来完成:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.seedstack</groupId>
                <artifactId>seedstack-bom</artifactId>
                <version>18.4.3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.seedstack.addons.w20</groupId>
                <artifactId>w20-bridge-web</artifactId>
                <version>3.2.4</version>
            </dependency>
            <dependency>
                <groupId>org.seedstack.addons.w20</groupId>
                <artifactId>w20-bridge-web-bootstrap-3</artifactId>
                <version>3.2.4</version>
            </dependency>
            <dependency>
                <groupId>org.seedstack.addons.w20</groupId>
                <artifactId>w20-bridge-web-business-theme</artifactId>
                <version>3.2.4</version>
            </dependency>
            <dependency>
                <groupId>org.seedstack.addons.w20</groupId>
                <artifactId>w20-bridge-web-components</artifactId>
                <version>3.2.4</version>
            </dependency>
            <dependency>
                <groupId>org.seedstack.addons.w20</groupId>
                <artifactId>w20-bridge-rest</artifactId>
                <version>3.2.4</version>
            </dependency>
            <dependency>
                <groupId>org.seedstack.addons.w20</groupId>
                <artifactId>w20-bridge-specs</artifactId>
                <version>3.2.4</version>
            </dependency>                                   
        </dependencies>
</dependencyManagement>

此修复将包含在即将发布的 SeedStack 18.7 中。