Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing port number in Spring boot program. No application.properties

I just imported a java project from spring.io https://spring.io/guides/gs/rest-service/

I did it in my eclipse. I want to change the port number for the embedded tomcat to run but I can't see any application.properties (there is no src/main/resources) as it used to be when I would manually create a spring boot application through File->New->...

This is how the structure looks like

enter image description here

I checked out manifest.yml and even typed

server: port : 9090

but it says, unknown property 'server' for type 'Cloudfoundary Manifest'

like image 371
pluto20010 Avatar asked Mar 07 '23 10:03

pluto20010


2 Answers

add application.properties in your resource folder

#--------------------------------
# Tomcat Port 
#----------------------------------
server.port = 8080

# ----------------------------------------
# Logging Level
# ----------------------------------------
logging.level.root=error
logging.level.org.springframework=info
logging.level.org.hibernate=error

# ----------------------------------------
# MySQL DataBase Connection Properties
# ----------------------------------------
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/db
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true

# ----------------------------------------
# ACTUATOR PROPERTIES
# ----------------------------------------
endpoints.actuator.enabled=false
management.security.enabled=false

# ----------------------------------------
# DevTols PROPERTIES
# ----------------------------------------
spring.devtools.restart.enabled=true

# ----------------------------------------
# JSP PREFIX/POSTFIX PROPERTIES
# ----------------------------------------
#spring.thymeleaf.prefix=/view/
#spring.thymeleaf.suffix=.html
like image 194
Satya Prakash Avatar answered Mar 10 '23 05:03

Satya Prakash


YOu can add application.properties

You source folder will look like this ignore other files

enter image description here

like image 42
gladiator Avatar answered Mar 10 '23 06:03

gladiator