viraj
viraj

Reputation: 129

Where to specify a specific port number in spring boot service file in systemd?

Need to know where can I specify the spring boot port aa when I check my service status I get this:

"Serverkt.log started at server-name with process id" But I don't get the port number. Also wanted to know where I can find the spring logs in the server

Upvotes: 0

Views: 1160

Answers (2)

Cais Manai
Cais Manai

Reputation: 966

Since you're starting spring boot from a service file, you can set the port using command line arguments e.g.port 8083 would look like this:

ExecStart=/usr/bin/java -jar /opt/corda/spring.jar --server.port=8083

Upvotes: 1

bilak
bilak

Reputation: 4932

spring boot has its configuration file. I guess that you have it included in your jar/war file. So basically unzip that file and look inside it (try to search for application.properties or application.yaml|yml).

property server.port defines the port on which application is running. It defaults to 8080. If you are using spring-boot 2 then with property logging.path you can change the path where output file will be placed. However I don't know if this works when you have logback/log4j/... configuration.

if you run your application you can override those properties specified in appplication.properties|yaml by providing command line properties. For example you can change the port with command java -jar your-boot.jar --server.port=9090

Upvotes: 2

Related Questions