我在Eclipse中使用Spring STS来创建一个简单的基于Web的spring boot项目.我可以在Eclipse中运行它,但当我尝试将其导出为JAR文件时,我得到:
rg.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
Run Code Online (Sandbox Code Playgroud)
我public static void main的位于Application.java,带有@SpringBootApplication注释.
我已经对所有Maven依赖项进行了一次双重检查.
我究竟做错了什么?
我在尝试迭代枚举时注意到了这一点.
说你有:
enum Gender {
Male = 1,
Female = 2
}
Run Code Online (Sandbox Code Playgroud)
你也是:
for (let gender in Gender) {
console.log(gender)
}
Run Code Online (Sandbox Code Playgroud)
这将运行4(?)次.首先打印1和2的字符串(!)表示,然后打印字符串Male和Female.
我只能假设这是有意的.我的问题是为什么会这样?这个(在我看来)奇怪的实现背后的原因是什么?