作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 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>
所以现在我向社区发起挑战,并希望获得您宝贵的专业知识和支持。提前致谢!
最佳答案
我会尝试像这里一样设置项目(参见pom.xml)https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-simple
一个简单的mvn package
应该足以生成jar。
关于maven - Spring 启动: how do I create a self-contained executable jar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34037388/
我是一名优秀的程序员,十分优秀!