1.

Explain the difference between Embedded Server & War file.

Answer»

EMBEDDED Server(in context of Spring Boot) means a Web Server that comes in-built with Spring Boot. Spring Boot supports 3 web servers :

  • Tomcat (This is a DEFAULT web server): In FACT when you include Spring Boot web starter dependency, you get this without any more configuration.
  • Jetty: To override the default and include this, you can use spring-boot-starter-jetty dependency. At the same time, make sure you exclude tomcat web server dependency (default).
  • Undertow: This is another webserver supported by Spring Boot. To include this, you can use spring-boot-starter-undertow dependency.

If you would like to disable the web starter, you can do so by adding the following property to application.PROPERTIES :

spring.main.web-application-type=none

This is how you can customize/override various default properties associated with the webserver:

  • Port

You can override port by SPECIFYING it in application properties as :

server.port =8081

You can also override by including it as an environment variable(SERVER_PORT=8081).

To disable , HTTP port set :

server.port=-1

While, if you want to look for the best open port, use :

server.port=0

  • HTTP response Compression 

Use the following in property file :

server.compression.enabled=true

  • SSL

SSL can be configured by setting appropriate properties in application.properties file , for example :

server.ssl.key-store=classpath:keystore.jks

server.ssl.key-store-password=secret

server.ssl.key-password=another-secret



Discussion

No Comment Found