Questions on Spring Boot – Part 3
Posted VickyFengYu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.
//具体怎么配置?
以上是关于Questions on Spring Boot – Part 3的主要内容,如果未能解决你的问题,请参考以下文章
Spring Boot Interview Questions
学记:spring boot整合shiro出现UnavailableSecurityManagerException
关闭Spring Boot的Jsckson的FAIL_ON_EMPTY_BEANS