[英]Problem in running spring boot jar artifact
I have a spring boot project which works fine when running from Intellij, but when I execute the jar file from the command line I get not found an exception.我有一个 spring boot 项目,它在从 Intellij 运行时运行良好,但是当我从命令行执行 jar 文件时,我没有发现异常。 can anyone help me with this, please?任何人都可以帮助我吗?
Here is my application.properties
file这是我的application.properties
文件
spring.mvc.view.prefix: / spring.mvc.view.suffix: .jsp spring.messages.basename=validation
I have put login template inside src\\main\\webapp
folder我已将登录模板放在src\\main\\webapp
文件夹中
and here is my userController
:这是我的userController
:
@GetMapping("/login")
public String login(Model model, String error, String logout) {
if (error != null)
model.addAttribute("error", "Your username and password is invalid.");
if (logout != null)
model.addAttribute("message", "You have been logged out successfully.");
return "login";
}
Here is the error I get when trying to rich /login
URL:这是我在尝试丰富/login
URL 时遇到的错误:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
You can do the packaging war and run same as jar.您可以进行打包战争并像 jar 一样运行。
java -jar sampleApp.war
works fine. java -jar sampleApp.war
工作正常。
Check working example :: https://github.com/khatriarpit/spring-boot-web-jsp-example-master检查工作示例 :: https://github.com/khatriarpit/spring-boot-web-jsp-example-master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.