简体   繁体   中英

spring boot start from bat or cmd file

How do I run a Spring boot jar application from bat or cmd file? When start the executable jar in the command line everything works, but when I run it as a bat file, Spring return 404 code from a request.

Log from console

2016-01-15 14:06:52.408 DEBUG 5104 --- [http-nio-81-exec-10] o.s.b.c.web.OrderedRequestContextFilter  : Bound request context to thread: org.apache.catalina.connector.RequestFacade@1899d750

2016-01-15 14:06:52.417 DEBUG 5104 --- [http-nio-81-exec-10] o.s.b.c.web.OrderedRequestContextFilter  : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1899d750

In browser after spring security redirect to login page I have 404.

Just place your bat file in the same directory where your jar has been generated. Because currently it is searching for jar file in your current directory where your bat file is located.

Run with Maven using mvn spring-boot:run -Drun.arguments=--debug

The plugin will build and run in one step.

  1. Open notepad or any other text editor
  2. Copy & paste the below code

     call mvn clean install call mvn spring-boot:run 
  3. Save as fileName.bat or fileName.cmd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM