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 signatures it should reload cleanly with no side effects.

//不是affect class or method signatures的话, 举个具体的例子

  • How do you Switch off the Spring Boot security configuration?

If you define a @Configuration with @EnableWebSecurity anywhere in your application it will switch off the default webapp security settings in Spring Boot.

//有代码举例更好

  • How to execute Spring Batch jobs on startup?

Spring Batch auto-configuration is enabled by adding @EnableBatchProcessing (from Spring Batch) somewhere in your context. By default it executes all Jobs in the application context on startup

//有代码举例更好,用在哪里,怎么用

  • Does spring boot need Logging? What is the default one?

Spring Boot has no mandatory logging dependency, except for the Commons Logging API.

//如何引入, https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html

  • How do you configure Configure Logback for logging?

If you put a logback.xml in the root of your classpath it will be picked up from there

// 详细,https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html

  • How do you Configure Log4j for logging?

Spring Boot supports Log4j 2 for logging configuration if it is on the classpath. If you are using the starters for assembling dependencies that means you have to exclude Logback and then include log4j 2 instead

//详细, https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html

//log有必要写blog或者github project

//需要比较一下 logback和log4j吗?怎么include log4并且exclude logback

  • How do you write a Write a JSON REST service in spring boot?

Any Spring @RestController in a Spring Boot application should render JSON response by default as long as Jackson2 is on the classpath

  • How do you Write an XML REST service in spring boot?

If you have the Jackson XML extension (jackson-dataformat-xml) on the classpath, it will be used to render XML responses

//是不是要比较一下两者? github project

  • What is the default Multipart File Uploads size in spring boot?

By default Spring Boot configures Spring MVC with a maximum file of 1MB per file and a maximum of 10MB of file data in a single request.

  • How do you Enable HTTP response compression in spring boot?

HTTP response compression is supported by Jetty, Tomcat, and Undertow. It can be enabled by adding server.compression.enabled=true in application.properties

//  server compression 有什么作用?

  • How do you add Add a Servlet, Filter or Listener to an application ?

There are two ways to add Servlet, Filter, ServletContextListener and the other listeners supported by the Servlet spec to your application. You can either provide Spring beans for them, or enable scanning for Servlet components.

//代码实例?

  • How do you Change tomcat or jetty HTTP port?

You can change the tomcat http port by changing default http property in application.properties file.

//具体怎么配置?

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

时间: 2024-11-13 10:05:18

Questions on Spring Boot – Part 3的相关文章

【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