gpt4 book ai didi

maven - Spring 启动: how do I create a self-contained executable jar?

转载 作者:行者123 更新时间:2023-12-02 00:16:24 25 4
gpt4 key购买 nike

我是 Spring Boot 新手,无法创建独立的可执行 jar。 Maven 创建的 jar 无法检测到运行时所需的 Bean。

Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

我检查了工厂是否有工厂的实现在 jar 中,情况就是如此。我还仔细检查了其他帖子并确保 Spring Boot 注释已到位。它包括@ComponentScan 和其他。

@SpringBootApplication
public class InitService {

我假设我的 pom 已正确设置依赖项,因为当我从 Eclipse 项目启动应用程序时,该应用程序运行良好。

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>de.newbe.create.InitService</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

所以现在我向社区发起挑战,并希望获得您宝贵的专业知识和支持。提前致谢!

最佳答案

关于maven - Spring 启动: how do I create a self-contained executable jar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34037388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com