The previous article Java package the Spring Boot project and run in the Windows system and the packaging and deployment of the Spring Boot project to the Alibaba Cloud Linux server to tell the process of the packaging deployment of the Spring Boot project,
but here we may encounter a situation at this time. At this time, our server Java project takes up 80 but we need to put on a more important thing. We need Need to use the 80 our Java project to be changed to port 8080, so we have configured in the project's Application.yml configuration file, but we pack
it
up
.
For example, we now start this program on port 80.
Here we use http://localhost/books to call and return the result, everything is normal.
Then we stop the program and enter it as usual
java -jar WebDom-0.0.1-SNAPSHOT.jar
It can also be followed by temporary variables
, such as this
java -jar WebDom-0.0.1-SNAPSHOT.jar --server.port=8080
Change the started server.port to 8080 at zero time
and press Enter to run
Our console outputs port 8080.
At this time, we can use the default port 80 to call the interface, but he can’t find it.
But we can run normally again with the following: 8080.
Here, our single zero-time variable has been fixed.
But some people may say what if I want to change two?
Then let's change the password of the database so that he can't connect to the database to see the effect.
Our terminal stops the program and enters
java -jar WebDom-0.0.1-SNAPSHOT.jar --server.port=8080 --spring.datasource.druid.password=erw
In fact, it is as simple as that. Multiple zero-time variables are empty after the previous zero-time variable. Then -- the corresponding value is fine.
This time we changed the database link password to erw, which is a wrong password. We press Enter to run the program.
Of course, the error of the database password will not affect the startup of our java project.
The result will not be found after re-running
. At the same time, our console is always reporting errors.