我是Spring Boot的新手,无法创建一个自包含的可执行jar.Maven创建的jar无法在运行时检测到它需要的Bean.
Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
Run Code Online (Sandbox Code Playgroud)
我检查了工厂,如果工厂的实施是在罐子里就是这种情况.我还仔细检查了其他帖子,并确保Spring Boot注释到位.它包括@ComponentScan和其他.
@SpringBootApplication
public class InitService {
Run Code Online (Sandbox Code Playgroud)
我假设我的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>
Run Code Online (Sandbox Code Playgroud)
所以现在我向社区发起挑战,并希望获得宝贵的专业知识和支持.提前致谢!