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.

// spring-boot-devtools 怎么使用,有哪些选项?

  • 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

//可以了解一下 LiveReload 的工作原理机制

//插件了解一下,写blog

  • 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

原文地址:https://www.cnblogs.com/vicky-project/p/9192905.html

时间: 2024-10-27 03:47:51

Spring Boot Questions- Part 2的相关文章

Questions on Spring Boot – Part 3

What is Hot swapping in spring boot? Reloading the changes without restarting the server is called hot swapping, Modern IDEs (Eclipse, IDEA, etc.) all support hot swapping of bytecode,  so if you make a change that doesn’t affect class or method sign

【spring boot+mybatis】注解使用方式(无xml配置)设置自动驼峰明明转换(),IDEA中xxDao报错could not autowire的解决方法

最近使用spring boot+mybatis,使用IntelliJ IDEA开发,记录一些问题的解决方法. 1.在使用@Mapper注解方式代替XXmapper.xml配置文件,使用@Select等注解配置sql语句的情况下,如何配置数据库字段名到JavaBean实体类属性命的自动驼峰命名转换? 使用spring boot后,越来越喜欢用注解方式进行配置,代替xml配置文件方式.mybatis中也可以完全使用注解,避免使用xml方式配置mapper.(参考  springboot(六):如何优

Spring boot打包为可部署在tomcat下运行的war文件的方法(使用Gradle、Intellij IDEA)

使用Gradle: dependencies { compile("org.springframework.boot:spring-boot-starter-web") providedCompile("org.springframework.boot:spring-boot-starter-tomcat")//此处使用providedCompile,则生成的jar包可放入tomcat内运行// compile("org.springframework.b

How to use JDBC-Authentication of Spring Boot/Spring Security with Flyway

java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) at org.springframework.test.context.suppo

【转】Spring boot 打成jar包问题总结

http://www.cnblogs.com/xingzc/p/5972488.html 1.Unable to find a single main class from the following candidates 1.1.问题描述 maven build时出现以下错误提示日志: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage

Spring Boot项目@RestController使用重定向redirect

Spring MVC项目中页面重定向一般使用return "redirect:/other/controller/";即可.而Spring Boot使用了@RestController注解,上述写法只能返回字符串,解决方法如下: 将一个HttpServletResponse参数添加到处理程序方法然后调用response.sendRedirect("some-url"); @RestController public class FooController { @Re

spring boot 表单的实体提交错误:Validation failed for object='book'. Error count: 2

一:错误信息 二:解决方法 在实体后加BindingResult 三:参考链接 http://stackoverflow.com/questions/30297719/cannot-get-validation-working-with-spring-boot-and-thymeleaf spring boot 表单的实体提交错误:Validation failed for object='book'. Error count: 2

How to configure spring boot through annotations in order to have something similar to <jsp-config> in web.xml?

JSP file not rendering in Spring Boot web application You will need not one but two dependencies (jasper and jstl) in your pom.xml for this to work. <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifa

【redis】spring boot利用redis的Keyspace Notifications实现消息通知

前言 需求:当redis中的某个key失效的时候,把失效时的value写入数据库. github: https://github.com/vergilyn/RedisSamples 1.修改redis.conf 安装的redis服务默认是: notify-keyspace-events "",修改成 notify-keyspace-events Ex; 位置:redis安装目下的redis.windows-service.conf 或 redis.windows.conf.(具体看re

一个Spring Boot, JWT,AugularJS接口安全验证的简单例子

最近研究REST接口的无状态安全验证,这个文章有一定参考价值,但相当不完善,token只是简单用了服务器回传的, 没有实现数据签名和防篡改,另外git代码也有问题, 我简单修改了,可以看到文章中的效果. 我修改代码的git地址: https://github.com/offbye/jwt-angular-spring 原文地址  http://niels.nu/blog/2015/json-web-tokens.html 28 January 2015 When you create a RES