Spring Boot Questions- Part 2

  • What is spring-boot-devtools ?

Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change. This can be a useful feature when working in an IDE as it gives a very fast feedback loop for code changes.

  • What is LiveReload?

The spring-boot-devtools module includes an embedded LiveReload server that can be used to trigger a browser refresh when a resource is changed. LiveReload browser extensions are freely available for Chrome, Firefox and Safari from livereload.com.

Read More spring boot devtools 

  • How to exclude auto restart for static files?

By default changing resources in /META-INF/maven, /META-INF/resources, /resources, /static, /public or /templates will not trigger a restart
But If you want to customize these exclusions you can use the spring.devtools.restart.exclude property
if you want to keep those defaults and add additional exclusions, use the spring.devtools.restart.additional-exclude property instead

Read More spring boot devtools

  • How to start spring boot application in debug mode?

java -jar myproject-0.0.1-SNAPSHOT.jar –debug

  • What are the advantages of YAML file than Properties file?

YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data. The SpringApplication class will automatically support YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath.

  • What are the different ways to load YAML file in Spring boot?

1. YamlPropertiesFactoryBean will load YAML as Properties
2. YamlMapFactoryBean will load YAML as a Map

  • What are the advantages of spring Externalized Configuration?

Externalize your configuration to work with the same application code in different environments. You can use properties files, YAML files, environment variables and command-line arguments to externalize configuration.

  • What are Profiles in spring boot?

Spring Profiles provide a way to segregate parts of your application configuration and make it only available in certain environments. Any @Component or @Configuration can be marked with @Profile to limit when it is loaded

  • How to write custom log configuration in spring boot?

You can force Spring Boot to use a particular logging system using the org.springframework.boot.logging.LoggingSystem system property. The value should be the fully-qualified class name of a LoggingSystem implementation. You can also disable Spring Boot’s logging configuration entirely by using a value of none.

  • How do you customize Favicon in spring boot web application?

Spring Boot looks for a favicon.ico in the configured static content locations and the root of the classpath (in that order). If such file is present, it is automatically used as the favicon of the application.

  • How spring boot handles error in application?

Spring Boot provides an /error mapping by default that handles all errors in a sensible way, and it is registered as a ‘global’ error page in the servlet container.

  • How do you Create a deployable war file in spring boot?

Step1: Extend SpringBootServletInitializer and override its configure method
Step 2: Change packing type to war in pom.xml or in build.gradle
Step 3: Mark the embedded servlet container dependency as provided

猜你喜欢

转载自www.cnblogs.com/vicky-project/p/9192905.html