の欠落にEmbeddedWebApplicationContextを開始することができません私は、SBTのアセンブリを使用して、私の春のブートアプリケーションをパッケージ化して、私は春ブーツ:原因EmbeddedServletContainerFactory
Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is
org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
プロジェクトはのIntelliJでだけで正常に動作受け取るjarファイルを実行しようとするとしています。私はいくつかの周りに掘っやったし、それが(代わりに、SBTのアセンブリを使用して作成されたようなユーバージャーの)Spring Boot requires the jar to contain nested jarsのように見えます
lazy val news = (project in file("wherever")).
enablePlugins(DockerPlugin).
settings(commonSettings: _*).
settings(
name := "name",
mainClass in assembly := Some("mainEntry"),
test in assembly := {},
assemblyJarName := "jarName",
libraryDependencies ++= dependency1,
libraryDependencies ++= dependency2,
libraryDependencies += ScalaTest,
scalaSource in Compile := baseDirectory.value/"src/main/scala",
dockerfile in docker := {
val artifact: File = assembly.value
val artifactTargetPath = "/"
new Dockerfile {
from("openjdk:8-jre-alpine")
add(artifact, artifactTargetPath)
add(new File("./config/"),"/config")
cmd("java", "-jar", " -Denv=$env","jarName")
env("env","stage")
}
},
imageNames in docker := Seq(
ImageName("imageName")
)
)
の下に私のbuild.sbtです。だから、2つの選択肢があります。私のjarファイルをsbtで入れ子にしてパッケージ化するか、通常のクラスローダーを使用してUber jarファイルからロードするようにspringを構成します。
私は入れ子になったjarのsbtプラグインを調べましたが、私は維持されているものを見つけることができませんでした(または中央のmavenでも)。 Thisとthisは古いものであり、中央のものではありません。誰もこれを行うための任意の提案がありますか?
私はまた、uber jarを使用するようにスプリングブートを設定しました。圧倒的なレスポンスは、ここでは適用できない「mavenプラグインを使用する」ことです。