我是Spring Boot的新成員,未能創建自包含的可執行jar。 Maven創建的jar無法檢測到它在運行時需要的Beans。Spring Boot:我如何創建一個自包含的可執行jar?
Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
我檢查了工廠,如果工廠的實施是在這種情況下的罐子。我還仔細檢查了其他帖子,並確保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的組件,插件似乎是春天引導錯誤的選擇將無法檢測到的罐子。相反,Mathias指出,需要spring-boot-maven-plugin。 – otembajelle