标签搜索
全栈-04-后端-2
程序员的自留地

全栈-04-后端-2

fiora
2026-10-21 / 0 评论 / 14 阅读
本段 363 题 | 来源:fullstack + general + design | 知识点:后端

804. How is the dispatcher servlet instantiated?

dispatcher servlet是如何实例化的?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a47 | 官方: 否 | 付费: 否

答案:

The dispatcher servlet is instantiated by means of servlet containers such as Tomcat. The Dispatcher Servlet should be defined in web.xml The DispatcherServlet is instantiated by Servlet containers like Tomcat. The Dispatcher Servlet can be defined in web.xml as shown below:

dispatcher servlet通过诸如Tomcat之类的servlet容器进行实例化。Dispatcher Servlet应在web.xml中定义。DispatcherServlet由类似Tomcat的Servlet容器实例化。Dispatcher Servlet可以在web.xml中定义,如下所示:

<?xml version="1.0" encoding="UTF-8"?>

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">



appServlet
appServlet
org.springframework.web.servlet.DispatcherServlet
org.springframework.web.servlet.DispatcherServlet


contextConfigLocation
contextConfigLocation
/WEB-INF/spring/appServlet/servlet-context.xml
/WEB-INF/spring/appServlet/servlet-context.xml


1
1


InterviewBitServlet
InterviewBitServlet
/
/


Here, the load-on-startup tag is 1 which indicates that the DispatcherServlet is instantiated whenever the Spring MVC application to the servlet container. During this process, it looks for the servlet-name-context.xml file and initializes beans that are defined in the file.
在这里,load-on-startup标签的值为1,表示当Spring MVC应用程序启动时,DispatcherServlet会被实例化。在此过程中,它会查找servlet-name-context.xml文件,并初始化该文件中定义的bean。

805. What is the significance of @Repository annotation?

@Repository注解的意义是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a4a | 官方: 否 | 付费: 否

答案:

@Repository annotation indicates that a component is used as the repository that acts as a means to store, search or retrieve data. These can be added to the DAO classes.

@Repository注解表示一个组件被用作存储、搜索或检索数据的仓库。这些注解可以添加到DAO类上。

806. What are the differences between the <context:annotation-config> vs <context:component-scan> tags?

<context:annotation-config>和<context:component-scan>标签之间有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a4d | 官方: 否 | 付费: 否

答案:

is used for activating applied annotations in pre-registered beans in the application context. It also registers the beans defined in the config file and it scans the annotations within the beans and activates them.

它用于激活应用程序上下文中预先注册的bean上的已应用注解。它还会注册配置文件中定义的bean,并扫描bean内部的注解并激活它们。
The tag does the task of along with scanning the packages and registering the beans in the application context.
<context:component-scan>标签执行<context:annotation-config>的任务,同时扫描包并在应用程序上下文中注册bean。

= Scan and activate annotations in pre-registered beans. = Register Bean + Scan and activate annotations in package.

<context:annotation-config> = 扫描并激活预先注册bean中的注解。<context:component-scan> = 注册Bean + 扫描并激活包中的注解。

807. Are singleton beans thread-safe?

单例bean是线程安全的吗?
  • 知识点: 后端 / 编程语言基础 / 行为与软技能 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: behavioral | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a50 | 官方: 否 | 付费: 否

答案:

No, the singleton beans are not thread-safe because the concept of thread-safety essentially deals with the execution of the program and the singleton is simply a design pattern meant for the creation of objects. Thread safety nature of a bean depends on the nature of its implementation.

不,单例 bean 不是线程安全的,因为线程安全的概念本质上涉及程序的执行,而单例仅仅是一种用于创建对象的设计模式。Bean 的线程安全性取决于其实现的性质。

808. Differentiate between the @Autowired and the @Inject annotations.

@Autowired 和 @Inject 注解之间有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a53 | 官方: 否 | 付费: 否

答案:

@Autowired@Inject
This annotation is part of the Spring framework.
此注解是 Spring 框架的一部分。
This annotation is part of Java CDI.
此注解是 Java CDI 的一部分。
Has required attribute.
具有 required 属性。
Does not have the required attribute.
不具有 required 属性。
Singleton is the default scope for autowired beans.
单例是自动装配 bean 的默认作用域。
Prototype is the default scope of inject beans.
原型是注入 bean 的默认作用域。
In case of ambiguity, then @Qualifier annotation is to be used.
如果存在歧义,则需要使用 @Qualifier 注解。
In case of ambiguity, then @Named qualifier needs to be used.
如果存在歧义,则需要使用 @Named 限定符。
Since this annotation is provided by the Spring framework, in case you shift to another Dependency injection framework, there would be a lot of refactoring needed.
由于此注解由 Spring 框架提供,如果切换至另一个依赖注入框架,则需要进行大量重构。
Since this annotation is part of Java CDI, it is not framework dependent and hence less code refactoring when there are framework changes.
由于此注解是 Java CDI 的一部分,它不依赖于框架,因此在框架变更时,代码重构较少。

809. What is the importance of @Required annotation?

@Required 注解的重要性是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a56 | 官方: 否 | 付费: 否

答案:

The annotation is used for indicating that the property of the bean should be populated via autowiring or any explicit value during the bean definition at the configuration time. For example, consider a code snippet below where we need to have the values of age and the name:

该注解用于指示 bean 的属性应在配置时间的 bean 定义中通过自动装配或任何显式值进行填充。例如,考虑以下代码片段,其中我们需要 age 和 name 的值:

import org.Springframework.beans.factory.annotation.Required;

import org.Springframework.beans.factory.annotation.Required;
public class User {
public class User {
private int age;
private int age;
private String name;
private String name;

@Required

@Required
public void setAge(int age) {
public void setAge(int age) {
this.age = age;
this.age = age;
}
public Integer getAge() {
public Integer getAge() {
return this.age;
return this.age;
}

@Required

@Required
public void setName(String name) {
public void setName(String name) {
this.name = name;
this.name = name;
}
public String getName() {
public String getName() {
return this.name;
return this.name;
}
}

810. What is the importance of session scope?

会话作用域的重要性是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a59 | 官方: 否 | 付费: 否

答案:

Session scopes are used to create bean instances for HTTP sessions. This would mean that a single bean can be used for serving multiple HTTP requests. The scope of the bean can be defined by means of using scope attribute or using @Scope or @SessionScope annotations. - Using scope attribute:

会话作用域用于为HTTP会话创建bean实例。这意味着一个单一的bean可以用于服务多个HTTP请求。bean的作用域可以通过使用scope属性或使用@Scope或@SessionScope注解来定义。- 使用scope属性:
- Using @Scope annotation:
- 使用@Scope注解:
@Component
@Component
@Scope("session")
@Scope("session")
public class UserBean {
public class UserBean {
//some methods and properties
//some methods and properties
} - Using @SessionScope:
} - 使用@SessionScope:
@Component
@Component
@SessionScope
@SessionScope
public class UserBean {
public class UserBean {
//some methods and properties
//some methods and properties
}

811. What are the types of Spring MVC Dependency Injection?

Spring MVC依赖注入有哪些类型?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a5c | 官方: 否 | 付费: 否

答案:

There are two types of DI (Dependency Injection): - Construction-Based:

有两种类型的DI(依赖注入):- 基于构造器:
This type of DI is accomplished when the Spring IoC (Inversion of Control) container invokes parameterized constructor having a dependency on other classes. This cannot instantiate the values partially and ensures that the dependency injection is done fully. There are two possible ways of achieving this:
这种类型的DI是在Spring IoC(控制反转)容器调用具有对其他类依赖的参数化构造器时完成的。这不能部分实例化值,并确保依赖注入是完全完成的。有两种可能的方式来实现这一点:

Annotation Configuration: This approach uses POJO objects and annotations for configuration. For example, consider the below code snippet:

注解配置:这种方法使用POJO对象和注解进行配置。例如,考虑以下代码片段:

@Configuration

@Configuration
@ComponentScan("com.interviewbit.constructordi")
@ComponentScan("com.interviewbit.constructordi")
public class SpringAppConfig {
public class SpringAppConfig {
@Bean
@Bean
public Shape shapes() {
public Shape shapes() {
return new Shapes("Rectangle");
return new Shapes("Rectangle");
}
@Bean
@Bean
public Dimension dimensions() {
public Dimension dimensions() {
return new Dimension(4,3);
return new Dimension(4,3);
}
}
Here, the annotations are used for notifying the Spring runtime that the class specified with @Bean annotation is the provider of beans and the process of context scan needs to be performed on the package com.interviewbit.constructordi by means of @ComponentScan annotation. Next, we will be defining a Figure class component as below:
这里,注解用于通知Spring运行时,标有@Bean注解的类是bean的提供者,并且需要通过@ComponentScan注解对包com.interviewbit.constructordi执行上下文扫描过程。接下来,我们将定义一个Figure类组件,如下所示:

@Component

@Component
public class Figure {
public class Figure {
private Shape shape;
private Shape shape;
private Dimension dimension;
private Dimension dimension;

@Autowired

@Autowired
public Figure(Shape shape, Dimension dimension) {
public Figure(Shape shape, Dimension dimension) {
this.shape = shape;
this.shape = shape;
this.dimension = dimension;
this.dimension = dimension;
}
}
Spring encounters this Figure class while performing context scan and it initializes the instance of this class by invoking the constructor annotated with @Autowired . The Shape and Dimension instances are obtained by calling the methods annotated with @Bean in the SpringAppConfig class. Instances of Engine and Transmission will be obtained by calling @Bean annotated methods of the Config class. Finally, we need to bootstrap an ApplicationContext using our POJO configuration:
Spring在执行上下文扫描时遇到这个Figure类,并通过调用带有@Autowired注解的构造函数来初始化该类的实例。Shape和Dimension实例通过调用SpringAppConfig类中带有@Bean注解的方法获得。Engine和Transmission的实例将通过调用Config类中带有@Bean注解的方法获得。最后,我们需要使用我们的POJO配置来引导一个ApplicationContext:

ApplicationContext context = new AnnotationConfigApplicationContext(SpringAppConfig.class);

ApplicationContext context = new AnnotationConfigApplicationContext(SpringAppConfig.class);
Figure figure = context.getBean(Figure.class);
Figure figure = context.getBean(Figure.class);
XML Configuration : This is another way of configuring Spring runtime by using the XML configuration file. For example, consider the below code snippet in the springAppConfig.xml file:
XML配置:这是另一种通过XML配置文件配置Spring运行时的方式。例如,考虑springAppConfig.xml文件中的以下代码片段:






















The constructor-arg tag can accept either literal value or another bean’s reference and explicit index and type. The index and type arguments are used for resolving conflicts in cases of ambiguity. While bootstrapping this class, the Spring ApplicationContext needs to use ClassPathXmlApplicationContext as shown below:
constructor-arg 标签可以接受字面值或另一个 bean 的引用,以及显式的索引和类型。索引和类型参数用于解决歧义情况下的冲突。在引导此类时,Spring ApplicationContext 需要使用 ClassPathXmlApplicationContext,如下所示:

ApplicationContext context = new ClassPathXmlApplicationContext("springAppConfig.xml");

ApplicationContext context = new ClassPathXmlApplicationContext("springAppConfig.xml");
Figure figure = context.getBean(Figure.class);
Figure figure = context.getBean(Figure.class);
  • Setter-Based:
    This form of DI is achieved when the Spring IoC container calls the bean’s setter method after a non-parameterized constructor is called to perform bean instantiation.

    这种形式的依赖注入是在 Spring IoC 容器调用无参数构造函数后进行 bean 实例化时,调用 bean 的 setter 方法实现的。
    It is possible to achieve circular dependency using setter injection.
    通过 setter 注入可以实现循环依赖。
    For achieving this type of DI, we need to configure it through the configuration file under the tag. For example, consider a class InterviewBit that sets the property articles as shown below:
    为实现这种类型的依赖注入,我们需要在配置文件中的 标签下进行配置。例如,考虑一个名为 InterviewBit 的类,它设置属性 articles,如下所示:
    package com.interviewbit.model;
    package com.interviewbit.model;
    import com.interviewbit.model.Article;
    import com.interviewbit.model.Article;
    public class InterviewBit {
    public class InterviewBit {
    // Object of the Article interface
    // Article 接口的对象
    Article article;
    Article article;
    public void setArticle(Article article)
    public void setArticle(Article article)
    {
    this.article = article;
    this.article = article;
    }
    }
    In the bean configuration file, we will be setting as below:
    在bean配置文件中,我们将按如下方式设置:
















The ‘JsonArticle’ bean is injected into the InterviewBit class object by means of the setArticle method. In cases where both types of dependencies are used, then the setter dependency injection has more preference by considering the specificity nature.
通过setArticle方法将‘JsonArticle’bean注入到InterviewBit类对象中。当两种类型的依赖都被使用时,考虑到其特定性特性,setter依赖注入具有更高的优先级。

812. What is the importance of the web.xml in Spring MVC?

在Spring MVC中,web.xml的重要性是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a5f | 官方: 否 | 付费: 否

答案:

web.xml is also known as the Deployment Descriptor which has definitions of the servlets and their mappings, filters, and lifecycle listeners. It is also used for configuring the ContextLoaderListener. Whenever the application is deployed, a ContextLoaderListener instance is created by Servlet container which leads to a load of WebApplicationContext.

web.xml也被称为部署描述符,其中包含servlet及其映射、过滤器和生命周期监听器的定义。它还用于配置ContextLoaderListener。每当应用程序部署时,Servlet容器会创建ContextLoaderListener实例,这会导致WebApplicationContext的加载。

813. What is the role of @ModelAttribute annotation?

@ModelAttribute注解的作用是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a62 | 官方: 否 | 付费: 否

答案:

The annotation plays a very important role in binding method parameters to the respective attribute that corresponds to a model. Then it reflects the same on the presentation page. The role of the annotation also depends on what the developer is using that for. In case, it is used at the method level, then that method is responsible for adding attributes to it. When used at a parameter level, it represents that the parameter value is meant to be retrieved from the model layer.

该注解在将方法参数绑定到与模型相对应的相应属性方面起着非常重要的作用。然后它会在表示页面上反映相同的内容。该注解的作用还取决于开发者将其用于什么目的。如果用在方法级别,那么该方法负责向其添加属性。当用在参数级别时,它表示该参数值旨在从模型层检索。

814. What is the use of @Autowired annotation?

@Autowired注解的用途是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a65 | 官方: 否 | 付费: 否

答案:

@Autowired annotation is meant for the injection of a bean by means of its type along with methods and fields. This helps the Spring framework to resolve dependencies by injecting and collaborating the beans into another bean. For example, consider the below code snippet:

@Autowired注解旨在通过其类型以及方法和字段来注入bean。这有助于Spring框架通过将beans注入并协作到另一个bean中来解析依赖关系。例如,考虑下面的代码片段:
import org.Springframework.beans.factory.annotation.Autowired;
import org.Springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.*;
public class InterviewBit {
public class InterviewBit {
// Autowiring/Injecting FormatterUtil as dependency to InterviewBit class
// 将FormatterUtil作为依赖自动装配/注入到InterviewBit类中
@Autowired
@Autowired
private FormatterUtil formatterUtil;
private FormatterUtil formatterUtil;

public Date something( String value ){

public Date something( String value ){
Date dateFormatted = formatterUtil.formatDate(value);
Date dateFormatted = formatterUtil.formatDate(value);
return dateFormatted
return dateFormatted
}
}
/**
  • Util class to format any string value to valid date format

    • 用于将任何字符串值格式化为有效日期格式的工具类
      */
      public class FormatterUtil {
      public class FormatterUtil {

public Date formatDate(String value){

public Date formatDate(String value){
//code to format date
//格式化日期的代码
}
}

815. What is the Model in Spring MVC?

Spring MVC中的模型是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a68 | 官方: 否 | 付费: 否

答案:

  • Model is a reference to have the data for rendering.
  • It is always created and passed to the view in Spring MVC. If a mapped controller method has Model as a parameter, then that model instance is automatically injected to that method.
  • Any attributes set on the injected model would be preserved and passed to the View.

816. What will be the selection state of a checkbox input if the user first checks the checkbox and gets validation errors in other fields and then unchecks the checkbox after getting the errors?

如果用户先勾选复选框,在其他字段中出现验证错误,然后在收到错误后取消勾选复选框,复选框的选中状态会是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a6b | 官方: 否 | 付费: 否

答案:

The validation is generally performed during HTTP POST requests. During HTTP requests, if the state of the checkbox is unchecked, then HTTP includes the request parameter for the checkbox thereby not picking up the updated selection. This can be fixed by making use of a hidden form field that starts with _ in the Spring MVC.

验证通常在HTTP POST请求期间执行。在HTTP请求期间,如果复选框的状态未选中,则HTTP不会包含复选框的请求参数,从而不会拾取更新后的选择。这可以通过在Spring MVC中使用一个以下划线_开头的隐藏表单字段来解决。

Conclusion:

结论:
In this article, we have seen the most commonly asked Spring Interview Questions during an interview. Spring is a very powerful framework that allows building enterprise-level web applications. Applications developed using Spring are generally quick, scalable, and transparent. Due to this, Spring has been embraced by a huge Java Developer’s community thereby making it an inevitable part of any Java Developer’s Job Role. Knowing Spring ensures that an added advantage is with the developers to progress steadily in their careers too.
在本文中,我们介绍了面试中最常见的Spring面试问题。Spring是一个非常强大的框架,允许构建企业级Web应用程序。使用Spring开发的应用程序通常快速、可扩展且透明。因此,Spring已被庞大的Java开发者社区所接受,使其成为任何Java开发者职位中不可避免的一部分。了解Spring确保开发者在职业发展中也具有稳步前进的额外优势。

Tip: We also recommend reading guides posted here .

提示:我们也推荐阅读此处发布的指南。

817. How is it possible to use the Tomcat JNDI DataSource in the Spring applications?

如何在Spring应用程序中使用Tomcat JNDI DataSource?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a6e | 官方: 否 | 付费: 否

答案:

To use the servlet container which is configured in the JNDI (Java Naming and Directory Interface) DataSource, the DataSource bean has to be configured in the spring bean config file and then injected into the beans as dependencies. Post this, the DataSource bean can be used for performing database operations by means of the JdbcTemplate. The syntax for registering a MySQL DataSource bean:

要使用在JNDI(Java命名和目录接口)DataSource中配置的servlet容器,必须在Spring bean配置文件中配置DataSource bean,然后将其作为依赖注入到各bean中。完成此操作后,可以使用DataSource bean通过JdbcTemplate执行数据库操作。注册MySQL DataSource bean的语法:





818. What do you understand by MultipartResolver?

你如何理解MultipartResolver?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a71 | 官方: 否 | 付费: 否

答案:

The MultipartResolver is used for handling the file upload scenarios in the Spring web application. There are 2 concrete implementations of this in Spring, they are: - CommonsMultipartResolver meant for Jakarta Commons FileUpload

MultipartResolver用于处理Spring Web应用程序中的文件上传场景。Spring中有两个具体的实现,它们是:- 用于Jakarta Commons FileUpload的CommonsMultipartResolver
  • StandardServletMultipartResolver meant for for Servlet 3.0 Part API
    To implement this, we need to create a bean with id=“multipartResolver” in the application context of DispatcherServlet. Doing this ensures that all the requests handled by the DispatcherServlet have this resolver applied whenever a multipart request is detected. If a multipart request is detected by the DispatcherServlet, it resolves the request by means of the already configured MultipartResolver, and the request is passed on as a wrapped/abstract HttpServletRequest. Controllers then cast this request as the MultipartHttpServletRequest interface to get access to the Multipart files. The following diagram illustrates the flow clearly:

    要实现此功能,我们需要在DispatcherServlet的应用程序上下文中创建一个id为“multipartResolver”的bean。这样做可以确保每当检测到multipart请求时,DispatcherServlet处理的所有请求都会应用此解析器。如果DispatcherServlet检测到multipart请求,它会通过已配置的MultipartResolver解析请求,并将请求作为包装/抽象的HttpServletRequest传递。控制器随后将此请求转换为MultipartHttpServletRequest接口以访问Multipart文件。以下图表清晰说明了此流程:

819. How are i18n and localization supported in Spring MVC?

在Spring MVC中如何支持i18n和本地化?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a74 | 官方: 否 | 付费: 否

答案:

Spring MVC has LocaleResolver that supports i18n and localization. for supporting both internationalization and localization. The following beans need to be configured in the application: - SessionLocaleResolver: This bean plays a vital role to get and resolve the locales from the pre-defined attributes in the user session.

Spring MVC具有支持i18n和本地化的LocaleResolver,以同时支持国际化和本地化。需要在应用程序中配置以下bean:- SessionLocaleResolver:这个bean在从用户会话中的预定义属性中获取和解析区域设置方面起着至关重要的作用。
Syntax:
语法:





  • LocaleChangeInterceptor: This bean is useful to resolve the parameter from the incoming request.

Syntax:

语法:





  • DefaultAnnotationHandlerMapping: This refers to the HandlerMapping interface implementation which maps the handlers/interceptors based on the HTTP paths specified in the @RequestMapping at type or method level.

Syntax:

语法:













820. Differentiate between a Bean Factory and an Application Context.

区分Bean工厂和应用程序上下文。
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a77 | 官方: 否 | 付费: 否

答案:

BeanFactory and the ApplicationContext are both Java interfaces. The difference is that the ApplicationContext extends the BeanFactory. BeanFactory provides both IoC and DI basic features whereas the ApplicationContext provides more advanced features. Following are the differences between these two:

BeanFactory和ApplicationContext都是Java接口。区别在于ApplicationContext扩展了BeanFactory。BeanFactory提供IoC和DI的基本功能,而ApplicationContext提供更高级的功能。以下是这两者之间的差异:
Category
类别
BeanFactoryApplicationContext
Internationalization (i18n)
国际化(i18n)
Does not provide support for i18n.
不提供对i18n的支持。
Provides support for i18n.
提供对i18n的支持。
Event Publishing
事件发布
Provides the ability to publish events to listener beans by using ContextStartedEvent and ContextStoppedEvent to publish context when it is started and stopped respectively.
通过使用ContextStartedEvent和ContextStoppedEvent分别在上下文启动和停止时发布事件,提供向监听器bean发布事件的能力。
ApplicationContext supports event handling by means of the ApplicationListener interface and ApplicationEvent class.
ApplicationContext通过ApplicationListener接口和ApplicationEvent类支持事件处理。
Implementations
实现
XMLBeanFactory is a popular implementation of BeanFactory.
XMLBeanFactory是BeanFactory的流行实现。
ClassPathXmlApplicationContext is a popular implementation of ApplicationContext. Also, Java uses WebApplicationContext that extends the interface and adds getServletContext() method.
ClassPathXmlApplicationContext是ApplicationContext的流行实现。此外,Java使用WebApplicationContext,它扩展了该接口并添加了getServletContext()方法。
Autowiring
自动装配
For autowiring, beans have to be registered in the AutoWiredBeanPostProcessor API.
对于自动装配,bean必须在AutoWiredBeanPostProcessor API中注册。
Here, XML configuration can be done to achieve autowiring.
这里,可以通过XML配置来实现自动装配。

821. How to get ServletConfig and ServletContext objects in spring bean?

如何在Spring bean中获取ServletConfig和ServletContext对象?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a7a | 官方: 否 | 付费: 否

答案:

This can be done by either implementing the spring-aware interfaces or by using the @Autowired annotation.

这可以通过实现Spring感知接口或使用@Autowired注解来完成。

@Autowired

@Autowired
private ServletContext servletContext;
private ServletContext servletContext;
@Autowired
@Autowired
private ServletConfig servletConfig;
private ServletConfig servletConfig;

822. How is the form data validation done in Spring Web MVC Framework?

Spring Web MVC框架中,表单数据验证是如何进行的?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a7d | 官方: 否 | 付费: 否

答案:

Spring MVC does the task of data validation using the validator object which implements the Validator interface. In the custom validator class that we have created, we can use the utility methods of the ValidationUtils class like rejectIfEmptyOrWhitespace() or rejectIfEmpty() to perform validation of the form fields.

Spring MVC使用实现了Validator接口的验证器对象来进行数据验证。在我们创建的自定义验证器类中,可以使用ValidationUtils类的工具方法,如rejectIfEmptyOrWhitespace()或rejectIfEmpty(),来对表单字段执行验证。

@Component

@Component
public class UserValidator implements Validator
public class UserValidator implements Validator
{
public boolean supports(Class clazz) {
public boolean supports(Class clazz) {
return UserVO.class.isAssignableFrom(clazz);
return UserVO.class.isAssignableFrom(clazz);
}

public void validate(Object target, Errors errors)

public void validate(Object target, Errors errors)
{
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.name", "Name is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.name", "Name is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "age", "error.age", "Age is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "age", "error.age", "Age is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "phone", "error.phone", "Phone is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "phone", "error.phone", "Phone is required.");
}
}
In the fields that are subject to validation, in case of errors, the validator methods would create field error and bind that to the field.
在需要验证的字段中,如果出现错误,验证器方法会创建字段错误并将其绑定到该字段。

To activate the custom validator as spring bean, then: - We have to add the @Component annotation on the custom validator class and initiate the component scanning of the package containing the validator declarations by adding the below change:

要将自定义验证器激活为Spring bean,则需要:- 在自定义验证器类上添加@Component注解,并通过添加以下更改来启动包含验证器声明的包组件扫描:
<context:component-scan base-package="com.interviewbit.validators"/>
<context:component-scan base-package="com.interviewbit.validators"/>

OR

或者

The validator class can be registered in the context file directly as a bean as shown:

验证器类可以直接在上下文文件中注册为bean,如下所示:

823. What are the differences between @RequestParam and @PathVariable annotations?

@RequestParam和@PathVariable注解之间有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a80 | 官方: 否 | 付费: 否

答案:

  • Even though both these annotations are used to extract some data from URL, there is a key difference between them.
    The @RequestParam is used to extract query parameters that is anything after “?” in the URL.

    @RequestParam用于提取查询参数,即URL中“?”之后的内容。
    The @PathVariable is used to extract the data present as part of the URI itself.]
    @PathVariable用于提取URI本身中包含的数据。
    For example, if the given URL is http://localhost:8080/InterviewBit/Spring/SpringMVC/?format=json, then you can access the query parameter “format” using the @RequestParam annotation and /Spring/{type} using the @PathVariable, which will give you SpringMVC.
    例如,如果给定的URL是http://localhost:8080/InterviewBit/Spring/SpringMVC/?format=json,则可以使用@RequestParam注解访问查询参数“format”,并使用@PathVariable访问/Spring/{type},这将返回SpringMVC。
    @RequestMapping("/Spring/{type}")
    @RequestMapping("/Spring/{type}")
    public void getQuestions(@PathVariable("type") String type,
    public void getQuestions(@PathVariable("type") String type,
    @RequestParam(value = "format", required = false) String format){
    @RequestParam(value = "format", required = false) String format){
    / Some code /
    / 一些代码 /
    }

824. What is ContextLoaderListener and what does it do?

什么是ContextLoaderListener,它的作用是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a83 | 官方: 否 | 付费: 否

答案:

  • The ContextLoaderListener loads and creates the ApplicationContext, so a developer need not write explicit code to do create it. In short, it is a listener that aids to bootstrap Spring MVC.The application context is where Spring bean resides. For a web application, there is a subclass called WebAppliationContext.
  • The lifecycle of the ApplicationContext is tied to the lifecycle of the ServletContext by using ContextLoaderListener. The ServletContext from the WebApplicationContext can be obtained using the getServletContext() method.

825. Can you create a controller without using @Controller or @RestController annotations?

你能在不使用@Controller或@RestController注解的情况下创建控制器吗?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a86 | 官方: 否 | 付费: 否

答案:

  • Yes! You can create a controller without @Controller or @RestController annotations by annotating the Spring MVC Controller classes using the @Component annotation. In this case, the real job of request mapping to handler method is done using the @RequestMapping annotation.

826. What is the @Controller annotation used for?

@Controller注解用于什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a8d | 官方: 否 | 付费: 否

答案:

  • The @Controller is a stereotype Spring MVC annotation to define a Controller.

827. What is a View Resolver pattern and explain its significance in Spring MVC?

什么是视图解析器模式,并解释它在Spring MVC中的重要性?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a90 | 官方: 否 | 付费: 否

答案:

  • It is a J2EE pattern that allows the applications to dynamically choose technology for rendering the data on the browser (View).Any technology like HTML, JSP, XSLT, JSF, or any other such technology can be used as View.
  • The View Resolver has the information of different views. The Controller returns the name of the View which is then passed to View Resolver by the DispatcherServlet for selecting the appropriate View technology and then the data is displayed.
  • The default ViewResolver used in Spring MVC is InternalResourceViewResolver.

828. What is DispatcherServlet in Spring MVC? In other words, can you explain the Spring MVC architecture?

什么是Spring MVC中的DispatcherServlet?换句话说,你能解释Spring MVC架构吗?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: system-design
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a94 | 官方: 否 | 付费: 否

答案:

Spring MVC framework is built around a central servlet called DispatcherServlet that handles all the HTTP requests and responses. The DispatcherServlet does a lot more than that: - It seamlessly integrates with the IoC container and allows you to use each feature of Spring in an easier manner.

Spring MVC框架围绕一个名为DispatcherServlet的中心servlet构建,它处理所有的HTTP请求和响应。DispatcherServlet的作用远不止于此:- 它与IoC容器无缝集成,允许你以更简单的方式使用Spring的每个功能。
  • The DispatcherServlet contacts HandlerMapping to call the appropriate Controller for processing the request on receiving it. Then, the controller calls appropriate service methods to set or process the Model data. The service processes the data and returns the view name to DispatcherServlet. DispatcherServlet then takes the help of ViewResolver and picks up the defined view for the request. Once the view is decided, the DispatcherServlet passes the Model data to View where it is finally rendered on the browser.

829. What are the benefits of Spring MVC framework over other MVC frameworks?

Spring MVC框架相比其他MVC框架有哪些优势?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a98 | 官方: 否 | 付费: 否

答案:

  • Clear separation of roles – There is a specialised dedicated object for every role.
  • Reusable business code logic – With Spring MVC, there is no need for duplicating the code. Existing objects can be used as commands instead of replicating them in order to extend a particular framework base class.
  • Spring MVC framework provides customizable binding and validation.
  • Also provides customizable locale and theme resolution.
  • Spring MVC supports customizable handler mapping and view resolution too.

830. What is the Spring MVC framework?

什么是Spring MVC框架?
  • 知识点: 后端 / 编程语言基础 (主题: spring, java, backend;标签: interviewbit, spring, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5958d557c902bc7a9b | 官方: 否 | 付费: 否

答案:

  • Spring MVC is a request driven framework and one of the core components of the Spring framework.
  • It comes with ready to use loosely coupled components and elements that greatly aid developers in building flexible and robust web applications.
  • The MVC (Model - View - Controller) architecture separates and provides loose coupling between the different aspects of the application – input logic (Model), business logic (Controller), and UI logic (View).

831. Why is @Repository important beyond being a marker annotation?

为什么 @Repository 除了作为标记注解外很重要?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b12 | 官方: 否 | 付费: 否

答案:

Repository enables automatic translation of persistence exceptions into Spring’s DataAccessException hierarchy.

Repository 支持将持久化异常自动转换为 Spring 的 DataAccessException 层次结构。

Benefits: - Consistent exception handling

好处:- 一致的异常处理
  • Database independent exception abstraction
  • Cleaner service layer code
    This behavior does not occur with @Component.

    此行为不会发生在 @Component 上。

832. What are stereotype annotations in Spring and how are they different?

什么是 Spring 中的原型注解,它们有何不同?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b15 | 官方: 否 | 付费: 否

答案:

Stereotype annotations include: - @Component

原型注解包括:- @Component
  • @Service
  • @Repository
  • @Controller
    They are functionally similar but convey intent.

    它们在功能上相似,但传达意图。

Differences: - @Service represents business logic

差异:- @Service 表示业务逻辑
  • @Repository represents data access layer
  • @Controller represents web layer
  • @Component is a generic stereotype
    Using specific stereotypes improves readability and enables additional behavior such as exception translation.

    使用特定的原型可提高可读性,并启用额外行为,如异常转换。

833. What is the difference between @Bean and @Component?

@Bean 和 @Component 之间有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b18 | 官方: 否 | 付费: 否

答案:

@Component is used at class level and allows Spring to detect the class automatically through component scanning.

@Component 在类级别使用,允许 Spring 通过组件扫描自动检测类。

@Bean is used at method level inside a @Configuration class and gives full control over object creation.

@Bean 在 @Configuration 类内部的方法级别使用,并提供对对象创建的完全控制。

Key differences: - @Component relies on classpath scanning

主要区别:- @Component 依赖类路径扫描
  • @Bean is explicitly defined
  • @Bean is preferred for third party classes
  • @Component is preferred for application classes

834. What is Configuration and what problem does it solve?

什么是配置(Configuration),它解决了什么问题?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b1b | 官方: 否 | 付费: 否

答案:

@Configuration marks a class as a source of bean definitions.

@Configuration 将类标记为 Bean 定义的来源。

It ensures: - Beans are singletons by default

它确保:- Bean 默认是单例的
  • Method calls to @Bean are intercepted
  • Same bean instance is returned every time
    Without @Configuration, multiple bean instances can be created unintentionally.

    没有 @Configuration 时,可能会意外创建多个 Bean 实例。

835. What is the difference between RequestParam, PathVariable, and RequestBody?

RequestParam、PathVariable 和 RequestBody 之间有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b1e | 官方: 否 | 付费: 否

答案:

  • @RequestParam extracts query parameters
  • @PathVariable extracts values from URL path
  • @RequestBody binds request payload to an object

Each is used based on API design and HTTP semantics.

每种都根据 API 设计和 HTTP 语义来使用。

836. What are common reasons for slow Spring Boot application startup?

Spring Boot 应用启动缓慢的常见原因是什么?
  • 知识点: 后端 / 编程语言基础 / 行为与软技能 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: behavioral | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b21 | 官方: 否 | 付费: 否

答案:

Common causes include excessive auto configuration, large classpath scanning, slow database initialization, unnecessary dependencies, and heavy logging. Using actuator startup metrics helps identify bottlenecks.

常见原因包括过度自动配置、大范围类路径扫描、数据库初始化缓慢、不必要的依赖以及繁重的日志记录。使用 Actuator 启动指标有助于识别瓶颈。

837. Why does field injection cause testing and immutability issues?

为什么字段注入会导致测试和不可变性问题?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b24 | 官方: 否 | 付费: 否

答案:

Field injection: - Hides dependencies

字段注入:- 隐藏依赖
  • Makes unit testing difficult
  • Prevents immutability
    Constructor injection is preferred because it: - Makes dependencies explicit

    构造器注入更受青睐,因为它:- 使依赖显式化
  • Enables immutability
  • Improves testability

838. What causes circular dependency errors and how do you fix them?

什么导致循环依赖错误,以及如何修复它们?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b27 | 官方: 否 | 付费: 否

答案:

Circular dependencies occur when beans depend on each other directly or indirectly.

当 Bean 直接或间接相互依赖时,会发生循环依赖。

Fixes include: - Refactoring responsibilities

修复方法包括:- 重构职责
  • Using constructor injection
  • Introducing interfaces
    Applying @Lazy carefully

    谨慎应用 @Lazy

839. Why does Transactional sometimes not work in Spring Boot?

为什么 Transactional 有时在 Spring Boot 中不起作用?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b2a | 官方: 否 | 付费: 否

答案:

Transactional may not work due to self invocation, private method usage, or when the class is not managed by Spring. Transaction management relies on proxy based interception, which requires public methods and external calls.

Transactional 可能因自调用、私有方法使用或类未由 Spring 管理而失效。事务管理依赖于基于代理的拦截,这要求方法是公共的且通过外部调用。

840. What is the difference between application.properties and bootstrap.properties?

application.properties 和 bootstrap.properties 有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b2d | 官方: 否 | 付费: 否

答案:

bootstrap.properties is loaded before application.properties and is mainly used in Spring Cloud applications for external configuration sources. In most Spring Boot applications, application.properties or application.yml is sufficient.

bootstrap.properties 在 application.properties 之前加载,主要用于 Spring Cloud 应用中的外部配置源。在大多数 Spring Boot 应用中,application.properties 或 application.yml 就足够了。

841. Why does LazyInitializationException occur in Spring Boot?

为什么在 Spring Boot 中会出现 LazyInitializationException?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b30 | 官方: 否 | 付费: 否

答案:

LazyInitializationException occurs when a lazily loaded JPA association is accessed outside an active Hibernate session or transaction. This commonly happens when entities are returned directly from controllers instead of using DTOs.

当在活动的 Hibernate 会话或事务之外访问延迟加载的 JPA 关联时,会发生 LazyInitializationException。这通常发生在实体直接从控制器返回而并非使用 DTO 时。

842. What is the role of ConfigurationProperties in Spring Boot?

ConfigurationProperties 在 Spring Boot 中的作用是什么?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b33 | 官方: 否 | 付费: 否

答案:

ConfigurationProperties binds external configuration to strongly typed Java objects. It provides type safety, better structure, and supports validation, making it preferable over multiple @Value annotations for complex configuration.

ConfigurationProperties 将外部配置绑定到强类型的 Java 对象。它提供了类型安全性、更好的结构并支持验证,使其在复杂配置中优于多个 @Value 注解。

843. Why is spring.jpa.hibernate.ddl-auto=update not recommended in production?

为什么 spring.jpa.hibernate.ddl-auto=update 不推荐用于生产环境?
  • 知识点: 后端 / 编程语言基础 (主题: spring-boot, java, backend;标签: interviewbit, spring-boot, topic-specific, java, backend)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c5a58d557c902bc7b36 | 官方: 否 | 付费: 否

答案:

Using ddl-auto=update can cause unintended schema changes and data loss in production. Schema changes should be handled using controlled migration tools such as Flyway or Liquibase.

使用 ddl-auto=update 可能导致意外的模式更改和数据丢失。模式更改应使用受控的迁移工具(如 Flyway 或 Liquibase)进行管理。

844. What is ASP.NET Web API?

什么是ASP.NET Web API?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc982f | 官方: 否 | 付费: 否

答案:

ASP stands for Active server pages. ASP.NET is an updated version of legacy ASP. It is a framework that is used for developing HTTP services to provide responses to client requests. It can be accessed in different applications on different platforms. It is provided by Microsoft open-source technology for developing and consuming HTTP-based services on top of .NET Framework. It is very easy to build HTTP services using ASP.NET Web API. These services can be used by different clients as given below: - Desktop Applications

ASP代表Active Server Pages。ASP.NET是传统ASP的更新版本。它是一个用于开发HTTP服务以响应客户端请求的框架。它可以被不同平台上的不同应用程序访问。它由微软开源技术提供,用于在.NET Framework之上开发和消费基于HTTP的服务。使用ASP.NET Web API构建HTTP服务非常容易。这些服务可以被不同的客户端使用,如下所示:- 桌面应用程序
  • Mobile Applications
  • IOTs
  • Browsers

845. What are the advantages of using ASP.NET Web API?

使用ASP.NET Web API有什么优势?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9832 | 官方: 否 | 付费: 否

答案:

Some of the core advantages of using ASP.NET Web API are given below: - It provides the best platform for developing RESTful applications on .NET Framework.

使用ASP.NET Web API的一些核心优势如下所示:- 它为在.NET Framework上开发RESTful应用程序提供了最佳平台。
  • It works the same way that HTTP works with help of HTTP verbs such as GET, POST, PUT, DELETE for all crud operations.
  • It provides enough flexibility in Web API creation.
  • It completely supports routing.
  • It also supports model binding, validation, Odata (Open Data Protocol) that allows creation and consumption of RESTful APIs.
  • It has the ability to develop custom help and test pages with help of ApiExplorer.
  • One can develop non-SOAP-based services such as plain XML, JSON strings, etc.
  • It also increases the TDD (Test Data-Driven) approach in the development of RESTful services.

846. What are new features used in ASP.NET Web API 2.0

ASP.NET Web API 2.0中使用了哪些新功能?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9835 | 官方: 否 | 付费: 否

答案:

ASP.NET Web API includes a number of new exciting features as given below: - Attribute Routing

ASP.NET Web API包含了许多令人兴奋的新功能,如下所示:- 属性路由
  • CORS (Cross-Origin Resource Sharing)
  • OWIN (Open Web Interface for .NET) self-hosting
  • IHttpActionResult
  • Web API OData

847. What is the use of HttpResponseMessage?

HttpResponseMessage的用途是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9838 | 官方: 否 | 付费: 否

答案:

It is used to set response values such as header and status control. It simply allows us to work with HTTP protocol. It represents HTTP response messages that encapsulate data and status code.

它用于设置响应值,如头部和状态控制。它只是允许我们使用HTTP协议。它表示封装了数据和状态代码的HTTP响应消息。

// GetEmployee action

// GetEmployee动作
public HttpResponseMessage GetEmployee(int id)
public HttpResponseMessage GetEmployee(int id)
{
Employee emp = EmployeeContext.Employees.Where(e => e.Id == id).FirstOrDefault();
Employee emp = EmployeeContext.Employees.Where(e => e.Id == id).FirstOrDefault();
if (emp != null)
if (emp != null)
{
return Request.CreateResponse(HttpStatusCode.OK, emp);
return Request.CreateResponse(HttpStatusCode.OK, emp);
} else
} else
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Employee Not Found");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "员工未找到");
}
}

848. What is the difference between ApiController and Controller?

ApiController 和 Controller 有什么区别?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc983b | 官方: 否 | 付费: 否

答案:

ApiController: It is used to return data that is arranged in series and then sent to the client.

ApiController:它用于返回按系列排列的数据,然后发送给客户端。

public class TweetsController : ApiController

public class TweetsController : ApiController
{
// GET: /Api/Tweets/
// GET: /Api/Tweets/
public List Get()
public List Get()
{
return Twitter.GetTweets();
return Twitter.GetTweets();
}
}
Controller: It is used to provide normal views.
Controller:它用于提供普通视图。

public class TweetsController : Controller

public class TweetsController : Controller
{
// GET: /Tweets/  [HttpGet]  public ActionResult Index()
// GET: /Tweets/ [HttpGet] public ActionResult Index()
{
return Json(Twitter.GetTweets(), JsonRequestBehavior.AllowGet);
return Json(Twitter.GetTweets(), JsonRequestBehavior.AllowGet);
}
}

849. What do you mean by Caching and What are its types?

缓存是什么意思,它有哪些类型?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc983e | 官方: 否 | 付费: 否

答案:

Caching is basically a technique or process of storing data somewhere or in the cache for future requests. The cache is a temporary storage area. Caching keeps all frequently or recently accessed files or data in the cache memory and accesses them from the cache itself rather than actual address of data or files. The cache interface simply improves the storage mechanism for request/response object pairs that are being cached. Advantages of Caching: - It is considered the best solution to ensure that data is served where it is needed to be served that too at a high level of efficiency which is best for both client and server.

缓存基本上是一种将数据存储在某处或缓存中以便未来请求使用的技术或过程。缓存是一个临时存储区域。缓存将所有频繁或最近访问的文件或数据保存在高速缓存存储器中,并从缓存本身访问它们,而不是从数据或文件的实际地址访问。缓存接口仅改进了被缓存的请求/响应对象对的存储机制。缓存的优点: - 它被认为是确保数据在需要提供的地方以高效率提供的最佳解决方案,这对客户端和服务器都是最好的。
  • It delivers web objects faster to the end-user.
  • It reduces load time on the website server.
  • It leads to faster execution of any process.
  • It decreases network costs.
    Types of Caching: There are basically three types of caching as given below: - Page Caching

    缓存类型:基本上有三种类型的缓存,如下所示: - 页面缓存
  • Data Caching
  • Fragment Caching

850. WCF is replaced by ASP.NET Web API. True/False?

WCF 已被 ASP.NET Web API 取代。对/错?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9841 | 官方: 否 | 付费: 否

答案:

WCF: It is a framework used for developing SOAP (Service Oriented Applications Protocols). It also supports various transport protocols as given above. ASP.NET Web API: It is a framework used for developing non-SOAP-based services. It is limited to HTTP-based services. No, it's not true that ASP.NET Web API has replaced WCF. WCF was generally developed to develop SOAP-based services. ASP.NET Web API is a new way to develop non-SOAP-based services such as XML, JSON, etc. WCF is still considered a better choice if one has their service using HTTP as the transport and they want to move to some other transport like TCP, NetTCP, MSMQ, etc. WCF also allows one-way communication or duplex communication.

WCF:它是一个用于开发 SOAP(面向服务应用程序协议)的框架。它还支持上面给出的各种传输协议。ASP.NET Web API:它是一个用于开发非基于 SOAP 的服务的框架。它仅限于基于 HTTP 的服务。不,ASP.NET Web API 取代 WCF 并非事实。WCF 通常开发用于开发基于 SOAP 的服务。ASP.NET Web API 是开发非基于 SOAP 的服务(如 XML、JSON 等)的新方式。如果某人的服务使用 HTTP 作为传输并希望转移到其他传输协议(如 TCP、NetTCP、MSMQ 等),WCF 仍被视为更好的选择。WCF 还允许单向通信或双工通信。

851. What are the main return types supported in ASP. Net Web API?

ASP.NET Web API 支持的主要返回类型有哪些?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9844 | 官方: 否 | 付费: 否

答案:

It supports the following return types: - HttpResponseMessage

它支持以下返回类型:- HttpResponseMessage
  • IHttpActionResult
  • Void
  • Other types such as string, int, etc.

852. What is ASP.NET Web API routing?

什么是 ASP.NET Web API 路由?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9847 | 官方: 否 | 付费: 否

答案:

Routing is the most important part of ASP.NET Web API. Routing is a way how Web API matches a URI to an action. It is basically a process that decides which action and controller should be called. The controller is basically a class that handles all HTTP requests. All public methods of controllers are basically known as action methods or just actions. Whenever a Web API framework receives any type of request, it routes that request to action.

路由是 ASP.NET Web API 中最重要的部分。路由是 Web API 将 URI 匹配到操作的一种方式。它基本上是一个决定应调用哪个操作和哪个控制器的过程。控制器基本上是一个处理所有 HTTP 请求的类。控制器的所有公共方法基本上被称为操作方法或简称操作。每当 Web API 框架接收到任何类型的请求时,它都会将该请求路由到操作。

There are basically two ways to implement routing in Web API as given below: Convention-based routing : Web API supports convention-based routing. In this type of routing, Web API uses route templates to select which controller and action method to execute. Attribute-based routing : Web API 2 generally supports a new type of routing known as attribute routing. As the name suggests, it uses attributes to define routes. It is the ability to add routes to the route table via attributes.

在 Web API 中实现路由基本上有两种方式,如下所示:基于约定的路由:Web API 支持基于约定的路由。在这种路由类型中,Web API 使用路由模板来选择要执行的控制器和操作方法。基于特性的路由:Web API 2 通常支持一种称为特性路由的新路由类型。顾名思义,它使用特性来定义路由。它是通过特性向路由表添加路由的能力。

853. HOW to secure ASP.NET Web API?

如何保护 ASP.NET Web API?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc984c | 官方: 否 | 付费: 否

答案:

Web API has become key to programming web-based interactions. It can be accessed by anyone who knows the URL. Therefore, they have become targets for hackers. One needs to secure Web API by controlling Web API and by deciding who can and who cannot have access to Web API. There are basically two ways or techniques that make our Web API more secure. Authentication: It is a process that helps to identify and check users by their credentials such as password, username, etc. To have access to the web API, firstly user credentials are needed to be passed in the request header. If user credentials are not passed into the request header, then the server returns 401 status code (unauthorized). The best authentication to be used is OAuth 2.0. Authorization: It is a process that helps to decide whether or not a user has access to perform an action. Authorization filters are used to implement authorization.

Web API 已成为编程基于 Web 交互的关键。任何知道 URL 的人都可以访问它。因此,它们已成为黑客攻击的目标。需要通过控制 Web API 并决定谁可以访问 Web API 以及谁不能访问来保护 Web API。基本上有两种方式或技术可以使我们的 Web API 更安全。身份验证:这是一个通过密码、用户名等凭据来识别和检查用户的过程。要访问 Web API,首先需要在请求头中传递用户凭据。如果请求头中没有传递用户凭据,则服务器会返回 401 状态代码(未授权)。最好使用的身份验证是 OAuth 2.0。授权:这是一个帮助决定用户是否有权执行操作的过程。授权过滤器用于实现授权。

854. What are Exception filters in ASP.NET Web API?

ASP.NET Web API 中的异常过滤器是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc984f | 官方: 否 | 付费: 否

答案:

Exception filter is generally used to handle all unhandled exceptions that are generated in web API. It implements IExceptionFilters interface. It is the easiest and most flexible to implement. This filter is executed whenever the controller method throws any unhandled exception at any stage that is not an HttpResponseExecption exception.

异常过滤器通常用于处理 Web API 中生成的所有未处理异常。它实现了 IExceptionFilters 接口。它是最简单且最灵活的实现方式。当控制器方法在任何阶段抛出任何未处理的异常(不是 HttpResponseExecption 异常)时,都会执行此过滤器。

855. Which .NET framework supports ASP.NET Web API?

哪个 .NET 框架支持 ASP.NET Web API?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9852 | 官方: 否 | 付费: 否

答案:

.NET Framework 4.0 generally supports the first version of ASP.NET Web API. After that, .NET Framework 4.5 supports the latest version of web API i.e., ASP.NET Web API 2.

.NET Framework 4.0 通常支持 ASP.NET Web API 的第一个版本。之后,.NET Framework 4.5 支持最新版本的 Web API,即 ASP.NET Web API 2。

856. What is HttpConfiguration in Web API?

Web API 中的 HttpConfiguration 是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9855 | 官方: 否 | 付费: 否

答案:

It is considered as the main class that includes different properties with help of which one can override the default behavior of Web API. Some properties are given below: - DependencyResolver: It sets or gets a dependency resolver for dependency injection.

它被认为是包含不同属性的主类,借助这些属性可以覆盖 Web API 的默认行为。下面给出一些属性:- DependencyResolver:它为依赖注入设置或获取依赖解析器。
  • Services: It gets web API services.
  • ParameterBindingRules: It gets a collection of rules for how parameters should be bound.
  • MessageHandlers: It sets or gets message handlers.
  • Formatters: It sets or gets media-type formatters.

857. Can we return View from ASP.NET Web API method?

我们可以从 ASP.NET Web API 方法返回视图吗?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9858 | 官方: 否 | 付费: 否

答案:

No, we cannot return the view from the ASP.NET Web API method. ASP.NET web API develops HTTP services that provide raw data or information. ApiController in ASP.NET MVC application only renders data that is serialized and sent to the client. One can use a controller to provide normal views.

不,我们不能从 ASP.NET Web API 方法返回视图。ASP.NET Web API 开发提供原始数据或信息的 HTTP 服务。ASP.NET MVC 应用程序中的 ApiController 仅渲染序列化并发送给客户端的数据。可以使用控制器来提供正常的视图。

858. What is content negotiation in ASP.Net Web API?

ASP.NET Web API 中的内容协商是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc985b | 官方: 否 | 付费: 否

答案:

Content negotiation is basically a process of selecting the best representation from multiple representations that are available for a given response. It simply allows one to choose rather than negotiate content that one wants to get in response. It is performed at the server-side. In simple words, it chooses the best media type for matters to return a response to an incoming request.

内容协商基本上是一个从给定响应可用的多种表示形式中选择最佳表示形式的过程。它允许人们选择而不是协商希望在响应中获得的内容。它在服务器端执行。简单来说,它为返回对传入请求的响应选择最佳媒体类型。

859. Difference between HTTP GET vs HTTP Post?

HTTP GET 与 HTTP POST 的区别是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc985e | 官方: 否 | 付费: 否

答案:

HTTP (HyperText Transfer Protocol) simply manages request-response between client and server. It works as a request-response protocol between client and server. HTTP GET : This method is used to get information or data from a respective server at a specified URL. Example: GET/RegisterStudent.asp?user=value1&pass=value2 HTTP POST : This method is used to send data or information to respective servers. Example: POST/RegisterStudent.asp HTTP/1.1 Host: www.guru99.com user=value1&pass=value2

HTTP(超文本传输协议)简单地管理客户端和服务器之间的请求-响应。它作为客户端和服务器之间的请求-响应协议工作。HTTP GET:此方法用于从指定 URL 的相应服务器获取信息或数据。示例:GET/RegisterStudent.asp?user=value1&pass=value2 HTTP POST:此方法用于向相应服务器发送数据或信息。示例:POST/RegisterStudent.asp HTTP/1.1 Host: www.guru99.com user=value1&pass=value2
HTTP GETHTTP POST
Its parameters are included in the URL.
其参数包含在 URL 中。
Its parameters are included in the body.
其参数包含在请求体中。
This method is used to request data from specified resources and has no other effect.
此方法用于从指定资源请求数据,没有其他副作用。
This method is used to send data to a server to create or update resources.
此方法用于向服务器发送数据以创建或更新资源。
It carries a request parameter appended in the URL string.
它携带附加在 URL 字符串中的请求参数。
It carries request parameters in the message body that make it a more secure way of sending data or information from the client to the server.
它在消息体中携带请求参数,这使其成为从客户端向服务器发送数据或信息的更安全方式。
Request method using GET is cacheable.
使用 GET 的请求方法可缓存。
Request method using POST is not cacheable.
使用 POST 的请求方法不可缓存。
GET requests are less safe than POST.
GET 请求不如 POST 安全。
Post request is safer than GET.
POST 请求比 GET 更安全。
There is a restriction on data type in GET method and only ASCII characters are allowed.
GET 方法对数据类型有限制,仅允许 ASCII 字符。
There are no restrictions on data type in this method and binary data is also allowed.
此方法对数据类型没有限制,也允许二进制数据。
Data is visible to everyone in the URL.
数据在 URL 中对所有人可见。
Data is not displayed in the URL. It is present in the payload.
数据不显示在 URL 中,而是存在于负载中。

860. What is CORS in Web API?

Web API 中的 CORS 是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9861 | 官方: 否 | 付费: 否

答案:

CORS (Cross-Origin Resource Sharing) is basically a mechanism that allows one to make requests from one website to another website in a browser that is normally not allowed by another policy called SOP (Same Origin Policy). It supports secure cross-origin requests and data transfers among clients or browsers and servers. Here, cross-origin request means requests coming from different origins. CORS simply resolves the same-origin restriction for JavaScript. One can enable CORS for web API using the respective web API package or OWIN middleware.

CORS(跨源资源共享)基本上是一种机制,允许在浏览器中从一个网站向另一个网站发出请求,而通常这被另一个称为 SOP(同源策略)的策略所禁止。它支持客户端或浏览器与服务器之间的安全跨源请求和数据传输。这里,跨源请求指的是来自不同源的请求。CORS 简单地解决了 JavaScript 的同源限制。可以使用相应的 Web API 包或 OWIN 中间件为 Web API 启用 CORS。

861. Name method that validates all controls on page?

说出验证页面上所有控件的方法名称?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9864 | 官方: 否 | 付费: 否

答案:

Page.Validate()

Page.Validate()

862. What parameters can be passed in the URL of API?

API 的 URL 中可以传递哪些参数?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9867 | 官方: 否 | 付费: 否

答案:

Context keys, documents keys, or anything that initiates API to hit the exact end-point are few parameters that one can pass in the URL to define the complete end-point.

上下文键、文档键或任何触发 API 以命中精确端点的内容,是可以在 URL 中传递以定义完整端点的一些参数。

863. What is the use of DelegatingHandler?

DelegatingHandler 的用途是什么?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc986a | 官方: 否 | 付费: 否

答案:

DelegatingHandler is used to develop a custom Server-Side HTTP Message Handler in ASP.NET Web API. It is used to represent Message Handlers before routing in Web API.

DelegatingHandler 用于在 ASP.NET Web API 中开发自定义的服务器端 HTTP 消息处理器。它用于在 Web API 中路由之前表示消息处理器。

864. Web API uses which library for JSON serialization?

Web API 使用哪个库进行 JSON 序列化?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc986d | 官方: 否 | 付费: 否

答案:

Json.NET library is used by Web API for JSON serialization.

Web API 使用 Json.NET 库进行 JSON 序列化。

865. Explain method to handle error using HttpError in Web API?

解释在 Web API 中使用 HttpError 处理错误的方法?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9870 | 官方: 否 | 付费: 否

答案:

CreateErrorResponse is an extension method that can be used in Web API controller methods to return error codes and error messages. It creates an HttpError object and then wraps it inside an HttpResponseMessage object.

CreateErrorResponse 是一个扩展方法,可用于 Web API 控制器方法中返回错误代码和错误消息。它创建一个 HttpError 对象,然后将其包装在 HttpResponseMessage 对象中。

866. How to unit test Web API?

如何对 Web API 进行单元测试?
  • 知识点: 后端 (主题: api, web;标签: interviewbit, web-api, topic-specific, api, web)
  • 类型: technical | 难度: medium | 子类型: concept
  • 分类: fullstack
  • id: 69b37c9258d557c902bc9873 | 官方: 否 | 付费: 否

答案:

Using Web API tools like Fiddler, we can perform unit testing in Web API. Fiddler is basically a free debugging proxy for any browser that can be used to compose and execute various HTTP requests to Web API and check HTTP response. It is simply used for testing restful web services. It allows one to inspect and check both incoming and outgoing data to monitor and modify requests and responses before the browser receives them. Below is given some setting that is needed to be done fiddler: Fiddler – Compose Tab -> Enter Request Headers -> Enter Request Body and then execute.

使用像 Fiddler 这样的 Web API 工具,我们可以对 Web API 进行单元测试。Fiddler 本质上是一个免费的调试代理,适用于任何浏览器,可用于编写和执行各种 HTTP 请求到 Web API,并检查 HTTP 响应。它简单来说就是用于测试 RESTful Web 服务。它允许人们检查和验证传入及传出的数据,以便在浏览器接收请求和响应之前进行监控和修改。下面给出了使用 Fiddler 所需的一些设置:Fiddler – Compose 选项卡 -> 输入请求头 -> 输入请求体,然后执行。

867. 如何以单用户模式或最小配置模式重启 SQL Server(Structured Query Language Server)?

  • 知识点: 后端 / 数据库 / 系统设计/架构 / UI/UX 设计 (主题: sql-server, admin;标签: SQLSERVER.EXE, Single User Mode, Minimal Configuration, -m, -f)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 6965da3dfa809e6d3885e889 | 官方: 是 | 付费: 否

答案:

答案命令行程序 SQLSERVER.EXE(SQL Server Executable)配合 ‘–m’ 将以单用户模式重启 SQL Server(Structured Query Language Server);配合 ‘–f’ 将以最小配置模式重启 SQL Server(Structured Query Language Server)。

868. 详细介绍一下 CMS(Concurrent Mark-Sweep)垃圾回收器(Garbage Collector)?

  • 知识点: 后端 (主题: jvm, gc;标签: CMS, Concurrent Mark-Sweep, 内存碎片, Concurrent Mode Failure, Serial Old)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 69675714fa809e6d38a7d915 | 官方: 是 | 付费: 否

答案:

答案
CMS 是英文 Concurrent Mark-Sweep 的简称,是以牺牲吞吐量(Throughput)为代价来获得最短回收停顿时间(Pause Time)的垃圾回收器(Garbage Collector)。对于要求服务器响应速度的应用上,这种垃圾回收器非常适合。在启动 JVM(Java Virtual Machine)的参数加上 -XX:+UseConcMarkSweepGC 来指定使用 CMS 垃圾回收器。

CMS 使用的是标记-清除(Mark-Sweep)的算法实现的,所以在 gc(Garbage Collection)的时候回产生大量的内存碎片(Memory Fragmentation),当剩余内存不能满足程序运行要求时,系统将会出现 Concurrent Mode Failure,临时 CMS 会采用 Serial Old 回收器进行垃圾清除,此时的性能会被降低。

869. 简述分代垃圾回收器(Generational Garbage Collector)是怎么工作的?

  • 知识点: 后端 (主题: jvm, gc;标签: 分代GC, Eden, Survivor, 晋升, Full GC)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 69675718fa809e6d38a7e236 | 官方: 是 | 付费: 否

答案:

答案
分代回收器有两个分区:老生代(Old Generation)和新生代(Young Generation),新生代默认的空间占比总空间的 1/3,老生代的默认占比是 2/3。

新生代使用的是复制算法(Copying Algorithm),新生代里有 3 个分区:Eden、To Survivor、From Survivor,它们的默认占比是 8:1:1,它的执行流程如下:

  • 把 Eden + From Survivor 存活的对象放入 To Survivor 区;
  • 清空 Eden 和 From Survivor 分区;
  • From Survivor 和 To Survivor 分区交换,From Survivor 变 To Survivor,To Survivor 变 From Survivor。

每次在 From Survivor 到 To Survivor 移动时都存活的对象,年龄就 +1,当年龄到达 15(默认配置是 15)时,升级为老生代。大对象(Large Object)也会直接进入老生代。

老生代当空间占用到达某个值之后会触发全局垃圾回收(Major GC),一般使用标记整理(Mark-Compact)的执行算法。以上这些循环往复就构成了整个分代垃圾回收的整体执行流程。

870. 通知系统里的“至少一次投递”(At-least-once Delivery)和“精确一次投递”(Exactly-once Delivery)有什么区别?在现实里怎么做到“准一次”(Effectively-once)?

  • 知识点: 后端 / 数据库 / 安全 / 系统设计/架构 / UI/UX 设计 (主题: system-design, notification-service, kafka, rabbitmq, sqs, redis, email, sms, push, dlq, observability, security;标签: delivery-semantics, idempotency, dedup)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696de228e6ae93548e964307 | 官方: 是 | 付费: 否

答案:

答案- At-least-once:保证不丢,但在重试/超时/重复消费时可能重复投递。

  • Exactly-once:理论上不重不漏,但跨队列+第三方通道很难做到端到端。
    工程上常用“准一次”(effectively once):
  • 为每条消息生成全局 messageId,下游做幂等(dedup store)。
  • 投递日志写入采用 upsert/唯一键约束,重复投递可被识别并短路。
  • 队列使用至少一次语义 + 幂等消费者。

871. 如何按渠道选择第三方供应商(SES/SendGrid、Twilio、FCM/APNs)并做降级与多供应商切换?

  • 知识点: 后端 / 数据库 / 安全 / 系统设计/架构 / UI/UX 设计 (主题: system-design, notification-service, kafka, rabbitmq, sqs, redis, email, sms, push, dlq, observability, security;标签: providers, fallback, degradation)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696de228e6ae93548e96430d | 官方: 是 | 付费: 否

答案:

答案做抽象层把“业务通知”与“供应商 API”隔离:Channel Processor 调用 Provider Adapter。

  • 配置主备供应商:主失败/超时后切到备(按错误码/健康度)。
  • 做配额与限流:避免单供应商触顶。
  • 记录 provider-level 指标:成功率、延迟、退信/退订、成本。
    降级策略:营销可延迟或丢弃;交易类优先级高,必要时切换渠道(如 push 失败改短信)。

872. 如何做安全与反滥用(auth、RBAC、API rate limit、数据归档)?为什么通知系统也需要归档策略?

  • 知识点: 后端 / 数据库 / 安全 / 系统设计/架构 / UI/UX 设计 (主题: system-design, notification-service, kafka, rabbitmq, sqs, redis, email, sms, push, dlq, observability, security;标签: security, rbac, archiving)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696de22be6ae93548e9644ff | 官方: 是 | 付费: 否

答案:

答案- Auth + RBAC:限制谁能发哪类通知,防内部误用。

  • API Gateway 限流:防 DoS 与突发误调用。
  • 敏感数据保护:加密传输、最小权限访问日志与偏好数据。
  • 归档:投递日志长期累积很快变成 TB 级,在线库只保留热数据,冷数据迁移到低成本存储(如对象存储/冷归档),同时满足审计与合规留存。

873. Serverless 的“至少一次投递(at-least-once delivery)”会带来什么问题?如何设计幂等(idempotency)来保证业务正确?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: serverless, event-driven, idempotency;标签: Reliability, Idempotency)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696dece0623565038f416f4d | 官方: 是 | 付费: 否

答案:

答案事件驱动场景常见“至少一次投递(at-least-once delivery)”,意味着函数可能因重试(retry)/超时(timeout)/网络抖动(network jitter)被重复触发,导致重复扣款、重复发货、重复写入等。解决思路是幂等(idempotency):为每个事件引入唯一 ID(requestId/eventId),在数据库中记录处理状态(去重表(deduplication table)/幂等键(idempotency key)),写操作使用条件更新(conditional update)/唯一索引(unique index);必要时把副作用拆成可重放的步骤,并将外部调用结果缓存或持久化。

874. Serverless 的 Vendor Lock-in(供应商锁定)风险从哪里来?如何降低锁定风险?

  • 知识点: 后端 / DevOps/云 / 系统设计/架构 / UI/UX 设计 (主题: serverless, cloud, architecture;标签: Vendor Lock-in, Portability)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696dece0623565038f416f86 | 官方: 是 | 付费: 否

答案:

答案锁定风险通常来自对云厂商专有触发器(proprietary trigger)、托管服务(managed service)与权限模型(permission model)的深度绑定(如特定事件源、工作流、队列、监控体系)。降低方法:抽象业务逻辑与云适配层(cloud adapter layer)(hexagonal architecture(六边形架构))、用云无关协议(cloud-agnostic protocol)(HTTP/CloudEvents)、使用跨云框架(cross-cloud framework)(Serverless Framework/Knative)或容器化运行时(containerized runtime)、把关键数据放在可迁移存储(migratable storage),并在设计时约束对专有特性的依赖范围。

875. Serverless 安全最佳实践(security best practice)有哪些?如何贯彻最小权限原则(principle of least privilege)?

  • 知识点: 后端 / 安全 / 系统设计/架构 / UI/UX 设计 (主题: serverless, security, iam;标签: Security, IAM)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696dece1623565038f416fa6 | 官方: 是 | 付费: 否

答案:

答案最佳实践包括:1)最小权限 IAM(identity and access management)(每个函数单独角色,精确到资源与动作);2)密钥不落地(用 Secrets Manager/KMS(key management service));3)入口限流与鉴权(API Gateway/WAF(web application firewall)/OAuth);4)网络隔离与出站控制(按需 VPC(virtual private cloud),控制 egress);5)依赖与镜像供应链安全(software supply chain security)(SCA(software composition analysis)、签名、漏洞扫描);6)审计与告警(CloudTrail/日志审计)。最小权限落地要从“函数要访问什么资源”倒推策略,并定期回收与审计权限。

876. 你会设计什么机制来统计网站访问量(page views,PV)与访客行为(visitor behavior)?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, analytics, streaming;标签: analytics, tracking, kafka, events)
  • 类型: technical | 难度: hard | 子类型:
  • 分类: fullstack
  • id: 696f1143120fcc15911596d3 | 官方: 是 | 付费: 否

答案:

答案方案:前端埋点 SDK(tracking SDK)采集 PV/UV(unique visitors)/点击等事件→写入日志/消息队列(message queue)(Kafka 等)→流处理(stream processing)清洗聚合→落到 OLAP(online analytical processing)/数仓做报表与漏斗分析(funnel analysis);实时看板可加缓存层。注意隐私合规(privacy compliance)(同意管理、脱敏、保留策略)与数据质量(data quality)(去重、迟到数据、补发)。

877. 用 .NET Core 设计并实现一个简单 Car API:支持列表展示(Title/Price/SellerType)、新增、删除、更新。你会怎么做?

  • 知识点: 后端 / 编程语言基础 (主题: dotnet, csharp, api;标签: ASP.NET Core, CRUD)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • 公司: Carsales
  • id: 697042d4120fcc15913041eb | 官方: 是 | 付费: 否

答案:

答案实现要点:定义 Car 模型与 DTO(data transfer object)(含 Make/Model/Year/Price/SellerType),列表端把 Title 由后端拼接返回;使用 ASP.NET Core Controllers/Minimal API;用 EF Core + SQLite/Postgres 做持久化;加入校验(DataAnnotations(数据注解));返回标准状态码(201/204/404)。
接口建议:GET /cars(分页可选)、POST /cars、PUT/PATCH /cars/{id}、DELETE /cars/{id}。
示例 DTO(简化)public record CarDto(
Guid Id,

Guid Id,
string Make,
string Make,
string Model,
string Model,
int Year,
int Year,
decimal Price,
十进制价格,
string SellerType,
字符串卖家类型,
string Title
字符串标题
);AnswerKey points: define Car model + DTOs; backend returns computed Title (Make+Model+Year); implement via ASP.NET Core Controllers/Minimal APIs; persist via EF Core (SQLite/Postgres); add validation; return proper status codes.
);答案关键点:定义 Car 模型和 DTO;后端返回计算出的 Title(Make+Model+Year);通过 ASP.NET Core 控制器/Minimal API 实现;通过 EF Core(SQLite/Postgres)持久化;添加验证;返回正确的状态码。
Endpoints: GET /cars, POST /cars, PUT/PATCH /cars/{id}, DELETE /cars/{id}.
端点:GET /cars,POST /cars,PUT/PATCH /cars/{id},DELETE /cars/{id}。
Sample DTO (simplified)public record CarDto(
示例 DTO(简化版)public record CarDto(
Guid Id,
Guid Id,
string Make,
string Make,
string Model,
string Model,
int Year,
int Year,
decimal Price,
十进制价格,
string SellerType,
字符串卖家类型,
string Title
字符串标题
);

878. 请描述你对 Web 架构设计(web architecture design)的理解,包括前后端分离(front-end and back-end separation)、API 设计(API design)和微服务架构(microservices architecture)方面的经验。

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: api-design, microservices, system-design;标签: jetstar, real-question, interviewcoder, swe, architecture)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: Jetstar Airways
  • id: 69b2b81b58d557c90297ab6e | 官方: 是 | 付费: 是

答案:

题目来源Glassdoor 和 InterviewCoder 报告,Jetstar Airways 软件工程师 Onsite 面试中的 Web 设计与架构讨论环节。
题目解析Jetstar 作为 Qantas 集团旗下的低成本航空公司,其技术团队负责开发和维护航班预订、旅客管理、运营支持等核心数字产品。该问题考察候选人对现代 Web 架构(modern web architecture)的全面理解。
参考回答思路- 前后端分离(front-end and back-end separation):描述 RESTful API 或 GraphQL 如何实现前后端解耦,提升团队协作效率

  • API 设计:讨论 API 版本管理、认证授权(OAuth 2.0)、速率限制等最佳实践
  • 微服务:解释如何将单体应用拆分为独立可部署的服务,以及服务间通信(REST、消息队列)
  • 航空场景:结合航班搜索、预订、支付等场景说明架构选择
    评分要点- 是否理解前后端分离(front-end and back-end separation)的优势和挑战
  • 是否有实际 API 设计经验
  • 是否能结合业务场景讨论架构决策
  • 是否了解微服务的优缺点和适用场景

879. 设计一个航班预订系统(flight booking system)的核心架构(core architecture),包括航班搜索(flight search)、座位选择(seat selection)和支付流程(payment flow),需要考虑高并发(high concurrency)和可用性(availability)。

  • 知识点: 后端 / 数据库 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices, database, caching;标签: jetstar, real-question, glassdoor, swe, system-design)
  • 类型: technical | 难度: hard | 子类型: system-design
  • 分类: fullstack
  • 公司: Jetstar Airways
  • id: 69b2b81b58d557c90297ab71 | 官方: 是 | 付费: 是

答案:

题目来源Glassdoor 和 InterviewCoder 报告,Jetstar Airways 高级软件工程师(Senior Software Engineer)Onsite 面试中的系统设计(system design)环节。系统设计环节主要针对 Senior 级别候选人。
需求分析(requirement analysis)- 功能需求:航班搜索(flight search)(多条件筛选)、座位选择(seat selection)(实时库存)、支付集成(payment integration)(多种支付方式)、确认通知(confirmation notification)

  • 非功能需求:高可用性(99.9%+)、高并发处理(促销期间流量激增)、低延迟搜索响应
  • 规模估算:Jetstar 年旅客量超 4000 万,日均预订量数万单
    高层架构(high-level architecture)- 搜索服务(search service):使用 Elasticsearch 或类似搜索引擎(search engine)实现快速航班查询,支持多维度筛选
  • 预订服务:分布式锁或乐观锁机制防止超卖,确保座位库存一致性
  • 支付服务:集成多支付网关(信用卡、PayPal),支持异步处理和补偿事务
  • 通知服务:异步消息队列发送确认邮件/短信
    扩展与优化(scaling and optimization)- 使用 Redis 缓存热门航线搜索结果
  • 数据库读写分离,搜索走从库
  • CDN 加速静态资源
    评分要点- 是否先做需求澄清(requirement clarification)
  • 是否考虑了高并发场景下的数据一致性
  • 是否了解航空预订领域的特殊挑战

880. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在Airbnb Platform中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: airbnb, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: 爱彼迎
  • id: 69b3792158d557c902b97986 | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

881. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在iOS中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: apple, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: 苹果
  • id: 69b3793c58d557c902b992cc | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

882. What kinds of computer programmes can be run on Amazon Web Services' Lambda?

在亚马逊网络服务的Lambda上可以运行哪些类型的计算机程序?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abce | 官方: 否 | 付费: 否

答案:

Using AWS Lambda, you can easily automate a wide range of different processes that take place in the cloud. For example, AWS Lambda can be utilized to gain access to and change data stored in Amazon DynamoDB so that it can be used in the development of mobile back-ends.

使用AWS Lambda,您可以轻松自动化云中发生的各种不同流程。例如,AWS Lambda可用于访问和更改存储在Amazon DynamoDB中的数据,以便将其用于移动后端的开发。

Other activities, such as reporting and auditing of API calls made to any Amazon Web Service, can also be carried out in the cloud with the assistance of AWS Lambda. These activities include handlers that modify and compress objects when they are uploaded to Amazon S3, serverless processing of streaming data using Amazon Kinesis, and so on.

其他活动,例如对任何Amazon Web Service进行的API调用进行报告和审计,也可以在AWS Lambda的协助下在云中执行。这些活动包括在上传到Amazon S3时修改和压缩对象的处理器,使用Amazon Kinesis对流数据进行无服务器处理等等。

883. What is SQS in Lambda. In what way does it function?

Lambda中的SQS是什么?它以何种方式运作?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abd1 | 官方: 否 | 付费: 否

答案:

Simply said, SQS is just a method wherein hosts and connectors can exchange and pass on data with one another. Lambda's many parts can be opened up to the outside world, allowing for inter-part communication. Different functional components can be easily linked together. With this method, many potential points of failure are removed, and parts may communicate with one another without issue.

简单来说,SQS只是一种主机和连接器可以相互交换和传递数据的方法。Lambda的许多部分可以对外开放,允许部件间通信。不同的功能组件可以轻松连接在一起。通过这种方法,消除了许多潜在故障点,部件之间可以无问题地通信。

884. How well versed are you in Lambda Expression?

您对Lambda表达式的熟悉程度如何?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abd4 | 官方: 否 | 付费: 否

答案:

When it comes to drafting concise code, they are typically taken into consideration. This is because they are generally used as anonymous means for this reason. Improved developer efficiency and more stable code can be achieved with little extra work. They serve an unnamed purpose.

在编写简洁代码时,通常会考虑它们。这是因为它们通常用作匿名手段。通过很少的额外工作,可以实现更高的开发人员效率和更稳定的代码。它们服务于未命名的目的。

885. Where can I find more information about the Final Variables and Effectively Final Variables of Lambda?

在哪里可以找到有关Lambda的最终变量和有效最终变量的更多信息?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abd7 | 官方: 否 | 付费: 否

答案:

Once they have been allocated, changes to Final Variables are not allowed under any circumstances. When they are in their more malleable early stage, we say that they have essentially variable characteristics. They do not currently have a value associated with them.

一旦分配,最终变量在任何情况下都不允许更改。当它们处于更可塑的早期阶段时,我们说它们具有基本可变的特征。它们目前没有关联值。

Effective variables are utilized because many scenarios require the outcome to be unrestricted; as a result, many circumstances ask for the outcome to be unrestricted. They are useful in testing in their own right. It is possible to use Effective Variables to endow final variables with a wide variety of additional properties by employing this technique. The majority of the time, Lambda's local expressions are final.

有效变量之所以被使用,是因为许多场景要求结果不受限制;因此,许多情况要求结果不受限制。它们本身在测试中很有用。通过采用这种技术,可以使用有效变量为最终变量赋予各种附加属性。大多数时候,Lambda的局部表达式是最终的。

886. Where exactly is the functionality that Lambda was designed for?

Lambda设计的功能到底在哪里?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abda | 官方: 否 | 付费: 否

答案:

Reading data from the Internet of Things devices, monitoring the responses of sensors, and reacting to user clicks on a website are just some of the possible applications for AWS Lambda. However, the availability covers a far wider range of topics than just this one particular element. Lambda is versatile enough to serve a wide range of additional functions as well. Lambda makes it possible to automate the process of provisioning back-end services.

从物联网设备读取数据、监控传感器的响应以及响应网站上的用户点击只是AWS Lambda的一些可能应用。然而,可用性涵盖的范围远比这单个特定元素广泛。Lambda足够多功能,可以服务于各种其他功能。Lambda使得自动化后端服务的供应过程成为可能。

887. What is "Serverless App"?

什么是“无服务器应用”?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abdd | 官方: 否 | 付费: 否

答案:

It is nothing more than a collection of Lambda processes that were developed to do a few tasks. It's called Node. Js-compatible.

它不过是一组为执行几项任务而开发的Lambda进程的集合。它被称为Node.Js兼容。

888. In what ways are anonymous classes and Lambda functions distinct from one another?

匿名类和Lambda函数在哪些方面彼此不同?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abe0 | 官方: 否 | 付费: 否

答案:

One significant difference is in the utilization of keywords . The term "this" in Lambda refers to the class that is currently being evaluated, whereas in Anonymous Class it refers to the anonymous class itself.

一个显著的区别在于关键字的使用。Lambda中的“this”指的是当前正在被评估的类,而在匿名类中它指的是匿名类本身。

889. Is code allowed to be paused in Lambda Expression without a label?

在Lambda表达式中允许在没有标签的情况下暂停代码吗?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abe3 | 官方: 否 | 付费: 否

答案:

Yes, it is a code suspension, but there is no obvious designation attached to it.

是的,这是一种代码暂停,但没有附带的明显标识。

890. In what ways does the coding that governs AWS Lambda functions impose limitations?

管理AWS Lambda函数的编码在哪些方面施加了限制?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abe6 | 官方: 否 | 付费: 否

答案:

The utilization of the operating system as well as common languages are kept to a minimum thanks to Lambda. In order to combat spam, the traffic on TCP port 25 has been disabled. Additionally, incoming network connections and trace calls, which are used as a troubleshooting method, have also been disabled. Outgoing connections are something that can be supported by IP/TCP sockets.

通过Lambda,操作系统和常用语言的使用被保持在最低限度。为了对抗垃圾邮件,TCP端口25的流量已被禁用。此外,传入的网络连接和用于故障排除的跟踪调用也已被禁用。传出连接可以通过IP/TCP套接字支持。

891. What are your thoughts on Configuration Management?

您对配置管理有何看法?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abe9 | 官方: 否 | 付费: 否

答案:

It is the traditional method for handling system administration and web activities. In the case of Lambda, the procedure is simple. This method is used to create widespread automation. It's possible to set up and manage a wide variety of jobs with confidence. There are ways to easily avoid many problems.

这是处理系统管理和网络活动的传统方法。在Lambda的情况下,过程很简单。这种方法用于创建广泛的自动化。可以放心地设置和管理多种多样的任务。有很多方法可以轻松避免许多问题。

892. How exactly does one go about automating a serverless app's processes?

究竟如何自动化无服务器应用的过程?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abec | 官方: 否 | 付费: 否

答案:

A serverless application's release process can be automated with the help of AWS CodePipeline and AWS CodeDeploy, which are both services offered by Amazon Web Services (AWS). The CodePipeline offers a continuous delivery solution that models, visualizes, and automates the necessary actions in order to make it possible to release serverless applications.

无服务器应用的发布过程可以借助AWS CodePipeline和AWS CodeDeploy(两者都是Amazon Web Services (AWS)提供的服务)来自动化。CodePipeline提供了一种持续交付解决方案,它建模、可视化并自动化必要的操作,以便发布无服务器应用成为可能。

The Lambda-based applications supported by CodeDeploy now have access to an automated deployment engine. It gives you the ability to set up substantial barriers to ensure that the newly deployed application is safe, reliable, and fit for industrial use. Additionally, it enables you to organize deployments in accordance with best-practice methodologies such as canary and linear deployment.

CodeDeploy支持的基于Lambda的应用现在可以使用自动化部署引擎。它赋予您设置实质性障碍的能力,以确保新部署的应用安全、可靠且适合工业使用。此外,它使您能够按照最佳实践方法(如金丝雀部署和线性部署)来组织部署。

893. What happens when the maximum number of executions that can take place on an account has been reached?

当账户上可执行的最大执行次数达到时会发生什么?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abef | 官方: 否 | 付费: 否

答案:

When the threshold is reached, synchronous calls to AWS Lambda functions result in the receipt of an error stating that the threshold has been reached (429 error- code). Asynchronously called Lambda functions to have to be able to withstand regular traffic spikes for fifteen to thirty minutes before they are required to begin rejecting and throttling incoming events.

当达到阈值时,对AWS Lambda函数的同步调用会导致收到指示阈值已达的错误(429错误代码)。异步调用的Lambda函数必须能够承受十五到三十分钟的常规流量峰值,之后它们才开始拒绝和限制传入事件。

If the Lambda function is being called in response to rejected Amazon S3 events, Amazon S3 may keep the events for up to 24 hours and try to process them again during that time. The events from the Amazon Kinesis and Amazon DynamoDB streams will be retried in the case that the Lambda function does not succeed or the data does not expire at the appropriate time. Amazon Kinesis and Amazon DynamoDB Streams are used to store the data for a full day each respectively.

如果Lambda函数是在响应被拒绝的Amazon S3事件时被调用的,Amazon S3可能会将这些事件保留最多24小时,并在此期间尝试再次处理它们。来自Amazon Kinesis和Amazon DynamoDB流的事件将在Lambda函数未成功或数据未在适当时间过期时重试。Amazon Kinesis和Amazon DynamoDB流各自将数据存储整整一天。

894. An application that does not need a server in order to execute is referred to as serverless.

不需要服务器即可执行的应用程序被称为无服务器。
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abf2 | 官方: 否 | 付费: 否

答案:

Lambda-based applications, commonly referred to as serverless applications, are constructed using functions that react to events as they occur. By default, a serverless application is made up of one or more of these functions that are activated in response to events such as an object being uploaded to Amazon S3, a message being delivered via Amazon SNS, or a call being made to an API.

基于Lambda的应用,通常称为无服务器应用,是通过响应事件而触发的函数构建的。默认情况下,一个无服务器应用由一个或多个这样的函数组成,这些函数会在诸如对象上传到Amazon S3、通过Amazon SNS传递消息或调用API等事件发生时被激活。

These routines are able to operate on their own or make use of other data sources like Amazon S3 buckets or DynamoDB tables. Either way, they are versatile. The most popular kind of serverless application is called a function.

这些程序可以独立运行,也可以利用其他数据源,如Amazon S3存储桶或DynamoDB表。无论哪种方式,它们都具有多功能性。最流行的无服务器应用类型称为函数。

895. What exactly is the Lambda architecture of AWS?

AWS的Lambda架构究竟是什么?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: system-design
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abf5 | 官方: 否 | 付费: 否

答案:

Lambda architecture, which is part of Amazon Web Services (AWS), is a software platform that does away with the requirement for servers (AWS). Users upload to AWS Lambda what are known as functions, which are miniature, self-contained applications that are created in one of the supported programming languages and runtimes. The service is then responsible for running these functions.

Lambda架构是Amazon Web Services(AWS)的一部分,是一个免去服务器需求的软件平台。用户将所谓的函数上传到AWS Lambda,这些函数是微型、自包含的应用程序,以受支持的编程语言和运行时创建。然后该服务负责运行这些函数。

AWS Lambda is a common choice among developers when it comes to hosting code for serverless apps. In most cases, a complete Serverless stack will have the following components:

在托管无服务器应用代码方面,AWS Lambda是开发者的常见选择。在大多数情况下,完整的无服务器堆栈将包含以下组件:
  1. computer-based service; service delivered by a computer 2. one that saves data, or a service for managing databases; and 3. service that functions as a gateway for requests sent via HTTP.

    1. 计算机服务;由计算机提供的服务 2. 数据存储服务或数据库管理服务;以及 3. 作为HTTP请求网关的服务。

A significant portion of the computing service offered by AWS can now be satisfied thanks to Lambda. Additionally, it is compatible with a wide range of other services that AWS provides, and in conjunction with API Gateway, DynamoDB, and RDS, it forms the basis for serverless solutions that may be implemented on AWS. Due to its compatibility with a large number of programming languages and runtime environments, Lambda can be of service to a diverse group of developers working with Serverless architectures.

AWS提供的计算服务中很大一部分现在可以通过Lambda来满足。此外,它与AWS提供的许多其他服务兼容,并且结合API Gateway、DynamoDB和RDS,它构成了可在AWS上实现的无服务器解决方案的基础。由于其兼容大量编程语言和运行时环境,Lambda可以为使用无服务器架构的各种开发者群体提供服务。

896. What are some of the ways in which a serverless architecture might be useful?

无服务器架构有哪些可能有用的方式?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: system-design
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abf8 | 官方: 否 | 付费: 否

答案:

Every possibility includes perks and drawbacks, which vary widely according to the specifics of the work that needs to be done. This is likewise the case for the method that does not require a server. Because the vendor retains full control over their maximum capacity when using this strategy, some situations may result in an increase in the amount of downtime experienced as well as monetary losses.

每一种可能性都包括优点和缺点,这些优缺点根据所需工作的具体情况而有很大差异。对于不需要服务器的方法也是如此。因为在使用这种策略时,供应商对其最大容量保持完全控制,某些情况可能会导致停机时间增加以及经济损失。

The limitations of the technology and its declining functionality are two more issues to consider. Not to mention, the approach that does not require a server does not require the use of any specialized hardware. As a direct consequence of this, enhancing performance while simultaneously enhancing security has emerged as a key challenge on many levels. It is also possible for issues to develop as a direct result of the customer's own carelessness. When shifting to Google Cloud functions, the only option left is to create new deployments and make use of monitoring tools that were developed expressly for it. There is no longer any other option.

技术的局限性及其功能下降是需要考虑的另外两个问题。更不用说,不需要服务器的方法不需要使用任何专用硬件。因此,在增强安全性的同时提高性能已成为多个层面的关键挑战。问题也可能直接源于客户自身的疏忽。在迁移到Google Cloud函数时,唯一剩下的选择是创建新的部署并利用专门为其开发的监控工具。不再有其他任何选择。

897. How do I begin using a serverless application?

如何开始使用无服务器应用?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abfb | 官方: 否 | 付费: 否

答案:

It is necessary to go to the administration portal of the AWS Lambda service in order to obtain a blueprint before beginning work with the service. The downloaded package will include both a file with an AWS SAM extension (which is used to define AWS resources in the application) and a file with a.ZIP extension (which contains the code for the function).

在开始使用该服务之前,必须前往AWS Lambda服务的管理门户以获取蓝图。下载的包将包括一个带有AWS SAM扩展名的文件(用于在应用中定义AWS资源)和一个带有.ZIP扩展名的文件(包含函数代码)。

Simply download the program that does not require a server, and then package and run it by following the instructions provided by AWS CloudFormation. In order to obtain additional information, please consult the handbook.

只需下载该不需服务器的程序,然后按照AWS CloudFormation提供的说明进行打包和运行。如需获取更多信息,请查阅手册。

898. What are the factors that decide how AWS Lambda is charged?

哪些因素决定了AWS Lambda的收费方式?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9abfe | 官方: 否 | 付费: 否

答案:

When you use AWS Lambda, you are only going to be charged for the resources that you actually put to use. The total number of requests made to your functions and the total amount of time that your code is in execution will be used to determine the amount of money that you are responsible for paying. Even in the case of test invokes from the console, if Lambda begins running as a result of receiving an event notification or invoking a function, it will have registered a request. This is true even if the console is used to test invokes.

使用AWS Lambda时,您只需为实际使用的资源付费。您的函数收到的请求总数和代码执行的总时间将用于确定您需要支付的金额。即使是在控制台进行测试调用的情况下,如果Lambda因接收到事件通知或调用函数而开始运行,它也会记录一次请求。即使使用控制台进行测试调用也是如此。

Conclusion

结论
A serverless computing service known as AWS Lambda is one of the most well-liked choices for developing cloud-based application software. As a programmer, your primary responsibility is not to worry about the management of servers; rather, you are responsible for actually writing the code. A significant advantage of this service is that you will only be charged for the amount of time that you spend utilizing the company's computers. To make things easier for you, we've broken its capabilities down into typical interview questions and answers.
AWS Lambda是一种无服务器计算服务,是开发基于云的应用程序软件最受欢迎的选择之一。作为程序员,您的主要职责不是担心服务器管理,而是实际编写代码。该服务的一个显著优势是,您只需为使用公司计算机的时间付费。为了方便您,我们将其功能分解为常见的面试问题和答案。

Useful Interview Resources

有用的面试资源
  • AWS Cheat Sheet
  • AWS Projects for Beginners to Advanced
  • AWS Salary in India – For Freshers & Experienced
  • Best Serverless Frameworks

899. Why exactly should someone take into consideration implementing a serverless strategy?

为什么有人确实应该考虑实施无服务器策略?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac01 | 官方: 否 | 付费: 否

答案:

The first advantage of utilizing this approach is the simplified nature of its workings. This, in turn, makes it possible to bring products to market more quickly and increase revenue. Because clients are only charged for using the coupon code when it is actually being used, significant cost reductions are possible, which can then be put to greater use.

采用这种方法的首个优势是其运作方式的简化性。这反过来又使得产品能更快推向市场并增加收入。由于客户仅在优惠券代码实际使用时才被收费,因此可以实现显著的成本削减,这些节省下来的资源可以用于更有价值的用途。

In addition, the most important aspects of the programme can be easily controlled with very little effort. In addition, there is no need for ancillary facilities as they are not required. The fact that customers do not need to be concerned about the servers actually running the code is the most significant feature.

此外,该程序最重要的方面可以轻松地以极小的努力进行控制。另外,无需辅助设施,因为不需要它们。客户无需担心实际运行代码的服务器这一事实是最显著的特点。

900. Is it possible to scale Lambda vertically?

Lambda是否可以进行垂直扩展?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: system-design
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac04 | 官方: 否 | 付费: 否

答案:

This is not only possible but also one of the most compelling arguments in favour of utilizing AWS Lambda. To put it another way, if you ever need to spin up a considerably larger instance, you should definitely give this some thought. You are free to put one that you are currently using on hold if you need to do so. In addition to this, you need to disconnect the same from the server. The operation can move forward once the ID of the newly added device has been documented.

这不仅可能,而且是支持使用AWS Lambda的最有说服力的论点之一。换句话说,如果你需要启动一个相当大的实例,你绝对应该考虑这一点。如果需要,你可以暂时搁置当前正在使用的实例。此外,你需要将其与服务器断开连接。一旦新添加设备的ID被记录下来,操作就可以继续进行。

901. What is your level of expertise in the craft of AMI construction?

你在AMI构建工艺方面的专业水平如何?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac07 | 官方: 否 | 付费: 否

答案:

Launching a new virtual machine (VM) from an Amazon Machine Image that has been verified as being reliable is the first step. After it is finished, you can move on to installing packages and any other components that are required. It is not recommended at this time to add sensitive information due to potential security risks. The subsequent action, which is to enter the required login information to create a database account, is now complete. It is possible to simply expand it up to any level you require, based on the amount of data that you need to store within it.

从已验证为可靠的Amazon Machine Image启动新的虚拟机(VM)是第一步。完成后,您可以继续安装所需包和其他组件。目前不建议添加敏感信息,因为存在潜在安全风险。下一步,即输入所需登录信息以创建数据库账户,现已完成。根据您需要在其中存储的数据量,可以简单地将它扩展到您需要的任何级别。

902. What is one simple way that the efficiency of your AWS Lambda deployment might be improved?

有什么简单方法可以提高AWS Lambda部署的效率?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac0a | 官方: 否 | 付费: 否

答案:

The RAID software that comes along with Linux makes accomplishing this task simple. An additional advantage is that the level of safety might be improved in an uncomplicated way.

Linux自带的RAID软件使完成此任务变得简单。另一个优点是安全级别可以以不复杂的方式得到提升。

903. In the context of Lambda, what precisely does it mean to speak of elastic blockage storage?

在Lambda的上下文中,弹性块存储具体指什么?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac0d | 官方: 否 | 付费: 否

答案:

The term "virtual storage area network" (VSAN) refers to a logical subnetwork that is contained within a larger "physical storage area network" (SAN). Because of the capabilities of isolation provided by virtual storage area networks, when a problem occurs in one logical partition of a storage area network, it is possible to address it with minimal impact on the remainder of the network. This is because of the fact that a storage area network is composed of multiple logical partitions (VSANs).

“虚拟存储区域网络”(VSAN)指的是一包含在更大“物理存储区域网络”(SAN)中的逻辑子网络。由于虚拟存储区域网络提供的隔离能力,当存储区域网络的一个逻辑分区出现问题时,可以在对网络其余部分影响最小的情况下解决它。这是因为存储区域网络由多个逻辑分区(VSAN)组成。

It is very much like a VSAN, which stands for virtual storage area network, with the exception that it is utilized to kick off activities. Users of a RAID system do not need to be concerned about the loss of their data in the event that a disc in the RAID fails because the system is able to handle failures in a gracious manner. The provisioning and allocation of storage space is also something that can be done using Elastic Block Storage. Another method is to link it up to the application programming interface (API).

它非常类似于VSAN(即虚拟存储区域网络),不同之处在于它用于启动活动。RAID系统的用户无需担心RAID中某个磁盘故障时数据丢失,因为系统能够优雅地处理故障。存储空间的提供和分配也可以使用Elastic Block Storage完成。另一种方法是将它连接到应用程序编程接口(API)。

904. What are the best practices for maximizing Lambda's security?

最大化Lambda安全性的最佳实践是什么?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac10 | 官方: 否 | 付费: 否

答案:

Lambda provides access to some of the most cutting-edge security options that are currently available. Utilize a system that manages identity access. This would be beneficial in terms of managing access to the resources that are available. In addition to this, privilege can be utilized to increase one's access privileges. There is the option to refuse access to hosts that are not trusted or authorized to use the system. To ensure that everyone is able to keep up with the hectic pace, the security team has established regulations that can be modified over time.

Lambda提供对当前可用的一些最先进安全选项的访问。利用一个管理身份访问的系统。这在管理对可用资源的访问方面将是有益的。此外,可以利用特权来增加访问权限。可以选择拒绝访问不被信任或未经授权使用系统的主机。为确保每个人都能跟上繁忙的节奏,安全团队已制定了可以随时间修改的规则。

905. In your perspective, is there a link between Instance and AMI?

在你看来,Instance和AMI之间有关联吗?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac13 | 官方: 否 | 付费: 否

答案:

It is correct to say that they are connected. In terms of the different arguments that can be sent to the query API, Lambda scores highly. Even the most complicated requests, such as HTTP, can be readily controlled and processed.

正确地说,它们是相互关联的。就可以传给查询API的不同参数而言,Lambda得分很高。即使是最复杂的请求(如HTTP)也能轻松控制和处

906. What kinds of storage options does Amazon provide its customers with?

亚马逊为其客户提供了哪些类型的存储选项?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac16 | 官方: 否 | 付费: 否

答案:

For instance, Amazon provides customers with a diverse range of storage options, all of which rank among the very best in terms of dependability and effectiveness. You are free to combine them if you so like. It is also possible to acquire access to one's own volition. The first kind of storage is called EBS, and it uses a format that is block-level. When you require encrypted storage in addition to segregated storage, this is an excellent option to take into consideration.

例如,亚马逊为客户提供多样化的存储选项,所有这些选项在可靠性和有效性方面都名列前茅。如果您愿意,可以自由地将它们组合使用。也可以自主选择获取访问权限。第一种存储类型称为EBS,它采用块级格式。当您需要加密存储以及隔离存储时,这是一个值得考虑的优秀选择。

The EC2 Instance store is the next type, and it is similar to a hard disc in that it is tied directly to the host PC. It is a terrific option that should be explored for your needs in the short term. It is only when the instance is operational that the data stored on this storage will be reliable. If the same is deleted, then the data would be gone. When we talk about "Adding Storage," we're referring to a distinct category of storage. When the root storage device is initially created, an instance is started up automatically. Data relating to boot instances are frequently included in it.

接下来是EC2实例存储,它类似于硬盘,直接连接到主机上。对于短期需求,这是一个值得探索的绝佳选项。只有当实例运行时,存储在此存储上的数据才是可靠的。如果实例被删除,那么数据也会随之消失。当我们谈论“添加存储”时,指的是一个不同的存储类别。在初始创建根存储设备时,实例会自动启动。其中通常包含与启动实例相关的数据。

Amazon Simple Storage Service (S3) is yet another storage option, and it is well-known for being an affordable alternative that can store any quantity of data. This feature is one of its most appealing selling points.

亚马逊简单存储服务(S3)是另一个存储选项,它以经济实惠且能存储任意数量数据而闻名。这一特性是其最具吸引力的卖点之一。

907. Serverless computing is something you might be able to explain if you're familiar with Amazon Web Services.

如果您熟悉亚马逊网络服务,也许能够解释无服务器计算。
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac19 | 官方: 否 | 付费: 否

答案:

The client just needs to pay for the actual amount of processing time they make use of, as the cloud service provider is responsible for managing the server. There is no requirement for any upfront costs or minimum contract lengths. In the paradigm of cloud computing that is most prevalent today, the customer is responsible for paying for a set amount of server time regardless of whether or not they actually make use of that time.

客户只需为其实际使用的处理时间付费,因为云服务提供商负责管理服务器。无需任何前期成本或最低合同期限。在当前最流行的云计算范式中,客户无论是否实际使用服务器时间,都需要为固定数量的服务器时间付费。

908. What advantages does AWS Lambda have over its rival technologies, such as Google Cloud Functions and Microsoft Azure Functions?

AWS Lambda相比其竞争对手技术(如Google Cloud Functions和Microsoft Azure Functions)有哪些优势?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac1c | 官方: 否 | 付费: 否

答案:

It is easy to integrate AWS Lambda with other AWS services, Lambda functions can be triggered by a wide range of events, and it can be used for a wide range of purposes, including back-end tasks, data processing, and real-time stream processing, to name a few. These are just a few of the many reasons why AWS Lambda is superior to the solutions offered by competing cloud providers. There are several downsides associated with Lambda, including its high cost, fuzziness in debugging, and complexity in management.

轻松与其他AWS服务集成、Lambda函数可由多种事件触发,以及可用于广泛目的(包括后端任务、数据处理和实时流处理等),这些只是AWS Lambda优于竞争云提供商提供的解决方案的众多原因中的一部分。Lambda也存在一些缺点,包括成本高、调试模糊和管理复杂。

909. How could you possibly manage exceedingly intricate querying capabilities if you did not have a warehouse? Which database would you check first given the circumstances of the situation?

如果没有数据仓库,您如何管理极其复杂的查询功能?在这种情况下,您会首先检查哪个数据库?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac1f | 官方: 否 | 付费: 否

答案:

In light of the shortcomings of other options, such as ElasticCache, the Amazon Relational Database Service is an option that makes sense to go with. RDS makes the configuration and administration of every operation easier to perform. In addition to this, it is compatible with all modern electronic devices.

鉴于其他选项(如ElasticCache)的不足,亚马逊关系数据库服务是一个明智的选择。RDS使所有操作的配置和管理变得更加容易。此外,它与所有现代电子设备兼容。

910. Tell me more about the zero-downtime deployment.

请详细说明零停机部署。
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac22 | 官方: 否 | 付费: 否

答案:

When considering deployments, functions are the typical unit of analysis that is used. When a task is very challenging, AWS Lambda will break it down into a series of simpler steps. In this scenario, the app will continue to operate in its offline mode over this entire period of time. Despite the fact that this might be the case, the results are typically adequate.

在考虑部署时,函数是通常使用的分析单元。当任务非常具有挑战性时,AWS Lambda会将其分解为一系列更简单的步骤。在这种情况下,应用在整个这段时间内将继续在离线模式下运行。尽管情况可能如此,但结果通常是令人满意的。

911. How long may a Lambda function be allowed to run before it is considered a successful distributed denial of service attack?

Lambda函数在被视为成功的分布式拒绝服务攻击之前可以运行多长时间?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac25 | 官方: 否 | 付费: 否

答案:

There is a 5-minute time limit.

有5分钟的时间限制。

912. Is there a particular explanation for why utilizing Lambda results in greater levels of efficiency?

是否有特定原因解释为何使用Lambda会带来更高的效率?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac28 | 官方: 否 | 付费: 否

答案:

This is the case for a number of different reasons. In one scenario, it is possible to save everything in the local memory of the server. One further advantage is that there is no negative impact on performance as a result of putting the data directly in the database. In addition, there is not much complexity involved in testing. Integration testing can simply be made more effective by utilizing a variety of different providers.

这种情况由多种原因导致。一种场景下,可以将所有内容保存在服务器的本地内存中。另一个优势是,将数据直接放入数据库不会对性能产生负面影响。此外,测试中涉及的复杂性也不高。通过利用不同的提供商,集成测试可以简单地变得更加高效。

913. Is there any other potential downside to using the serverless method? Do you have any ideas or suggestions?

使用无服务器方法还有其他潜在的缺点吗?你有什么想法或建议吗?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac2b | 官方: 否 | 付费: 否

答案:

When we use any particular tool, the advantages and disadvantages that we encounter are, of course, dependent on the specific circumstances. In the case of the serverless technique, this is likewise the case. It should come as no surprise that the vendor will incur additional downtime and financial losses as a consequence of instances in which their control over the serverless solution is constrained.

当我们使用任何特定工具时,所遇到的优缺点当然取决于具体情况。对于无服务器技术也是如此。不言而喻,当供应商对无服务器解决方案的控制受限时,他们将因此承担额外的停机时间和财务损失。

The restrictions of the system and the reduction in functionality are two more issues that need to be addressed. In addition, there is no access to specialized hardware while using the serverless method. As a consequence of this, there are multiple moments where performance and security become impediments to one another. When clients make mistakes, it's possible that they'll produce problems for the business. When transitioning to Google Cloud Functions, you will need to use the newly released deployment and monitoring tools.

系统的限制和功能的减少是另外两个需要解决的问题。此外,使用无服务器方法时无法访问专用硬件。因此,在许多情况下,性能和安全性会相互阻碍。当客户犯错时,可能会给企业带来问题。在迁移到 Google Cloud Functions 时,你需要使用新发布的部署和监控工具。

914. If a microservice or a small service fails, is it possible to debug and repair it?

如果微服务或小型服务发生故障,是否可能进行调试和修复?
  • 知识点: 后端 / DevOps/云 (主题: aws, lambda, serverless;标签: interviewbit, aws-lambda, topic-specific, aws, lambda, serverless)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b3795b58d557c902b9ac2e | 官方: 否 | 付费: 否

答案:

It's not impossible by any stretch of the imagination. You are able to complete the task even when the corresponding function is being carried out and the appropriate actions are being performed.

这绝对不是不可能的。即使在相应函数正在执行且适当操作正在进行的时刻,你也能够完成该任务。

915. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在Baidu Search中有哪些应用场景(Use Cases)?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: baidu, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: 百度
  • id: 69b3796958d557c902b9b79d | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

916. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在Square POS中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: block, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: Block(原 Square)
  • id: 69b3798758d557c902b9cd1e | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

917. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在Booking.com中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: booking, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: Booking.com
  • id: 69b3798f58d557c902b9d33f | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

918. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在TikTok中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: bytedance, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: 字节跳动
  • id: 69b379b358d557c902b9ee57 | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

919. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在CDN中有哪些应用场景?

  • 知识点: 后端 / DevOps/云 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: cloudflare, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: Cloudflare
  • id: 69b37a1458d557c902ba2e86 | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

920. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在Coinbase Exchange中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: coinbase, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: Coinbase
  • id: 69b37a3958d557c902ba44e0 | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

921. 什么是事件驱动架构(Event-Driven Architecture,EDA)?在DiDi Ride-hailing中有哪些应用场景?

  • 知识点: 后端 / 系统设计/架构 / UI/UX 设计 (主题: system-design, microservices;标签: didi, generated)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • 公司: 滴滴出行
  • id: 69b37a7858d557c902ba7014 | 官方: 是 | 付费: 是

答案:

思路分析从事件生产者(Event Producer)、消费者(Consumer)、事件总线(Event Bus)/消息中间件(Message Broker)的角度解释架构。
参考答案核心概念:事件(Event)作为一等公民,松耦合(Loosely Coupled)的生产者-消费者模型(Producer-Consumer Model)。常见模式:事件通知(Event Notification)、事件溯源(Event Sourcing)、CQRS(Command Query Responsibility Segregation)。消息中间件(Message Broker):Kafka、RabbitMQ。
评分要点- EDA(Event-Driven Architecture)架构模式理解

  • 事件溯源和 CQRS
  • 实际应用经验
    常见追问- 如何处理事件的幂等性(Idempotency)?
  • 事件 schema 如何演进?

922. Why is permanent redirection not a good option?

为什么永久重定向不是好的选择?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72ea | 官方: 否 | 付费: 否

答案:

Permanent redirection is used only when you don’t want to lead visitors to the old URLs. The response of the permanent redirections is cached by the browser so when you try to redirect to something else it will cause issues. Since this is a browser-side operation if your user wants to move to a new page it will load the same page.

永久重定向仅在您不希望将访客引导至旧URL时使用。永久重定向的响应会被浏览器缓存,因此当您尝试重定向到其他内容时会导致问题。由于这是浏览器端的操作,如果您的用户想移动到新页面,它会加载同一个页面。

923. How to use file-based sessions?

如何使用基于文件的会话?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72ed | 官方: 否 | 付费: 否

答案:

To use the same, you need to set the SESSION_ENGINE settings to "django.contrib.sessions.backends.file"

要使用相同功能,你需要将 SESSION_ENGINE 设置改为 "django.contrib.sessions.backends.file"

924. What is mixin?

什么是 mixin?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72f0 | 官方: 否 | 付费: 否

答案:

Mixin is a type of multiple inheritances wherein you can combine behaviors and attributes of more than one parent class. It provides us with an excellent way to reuse code from multiple classes. One drawback of using these mixins is that it becomes difficult to analyze what a class is doing and which methods to override in case of its code being too scattered between multiple classes.

Mixin 是一种多重继承类型,其中你可以组合多个父类的行为和属性。它为我们提供了一种绝佳的方式,可以从多个类中重用代码。使用这些 mixin 的一个缺点是,当代码过于分散在多个类之间时,分析一个类在做什么以及哪些方法需要覆盖会变得困难。

925. What is Django Field Class?

什么是 Django 字段类?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72f3 | 官方: 否 | 付费: 否

答案:

'Field' refers to an abstract class that represents a column in the database table. The Field class is just a subclass of RegisterLookupMixin. In Django, these fields are used to create database tables (db_types()) which are used to map Python types to the database using get_prep_value() and the other way round using from_db_value() method. Therefore, fields are fundamental pieces in different Django APIs such as models and querysets.

'Field' 指的是一个抽象类,代表数据库表中的一列。Field 类只是 RegisterLookupMixin 的子类。在 Django 中,这些字段用于创建数据库表(db_types()),这些表使用 get_prep_value() 将 Python 类型映射到数据库,并使用 from_db_value() 方法进行反向映射。因此,字段是 Django 各种 API(如模型和查询集)中的基础组成部分。

926. Difference between Django OneToOneField and ForeignKey Field?

Django OneToOneField 和 ForeignKey 字段有什么区别?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72f6 | 官方: 否 | 付费: 否

答案:

Both of them are of the most common types of fields used in Django. The only difference between these two is that ForeignKey field consists of on_delete option along with a model’s class because it’s used for many-to-one relationships while on the other hand, the OneToOneField, only carries out a one-to-one relationship and requires only the model’s class.

它们都是 Django 中最常见的字段类型。两者之间的唯一区别是,ForeignKey 字段包含 on_delete 选项以及模型类,因为它用于多对一关系;而另一方面,OneToOneField 只执行一对一关系,并且只需要模型类。

927. How can you combine multiple QuerySets in a View?

如何在一个视图中组合多个查询集?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72f9 | 官方: 否 | 付费: 否

答案:

Initially, Concatenating QuerySets into lists is believed to be the easiest approach. Here’s an example of how to do that: from itertools import chain result_list = list(chain(model1_list, model2_list, model3_list))

最初,将查询集拼接成列表被认为是最简单的方法。以下是如何操作的示例:from itertools import chain result_list = list(chain(model1_list, model2_list, model3_list))

928. How to get a particular item in the Model?

如何在模型中获取特定项?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72fc | 官方: 否 | 付费: 否

答案:

ModelName.objects.get(id=”term”) Note: If there are no results that match the query, get() will raise a DoesNotExist exception. If more than one item matches the given get() query. In this case, it’ll raise MultipleObjectsReturned , which is also an attribute of the model class itself.

ModelName.objects.get(id="term") 注意:如果没有匹配查询的结果,get() 将引发 DoesNotExist 异常。如果多个项匹配给定的 get() 查询,在这种情况下,它会引发 MultipleObjectsReturned,这也是模型类本身的属性。

929. How to obtain the SQL query from the queryset?

如何从查询集中获取 SQL 查询?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: concept
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba72ff | 官方: 否 | 付费: 否

答案:

print(queryset.query)

print(queryset.query)

930. What are the ways to customize the functionality of the Django admin interface?

有哪些方法可以自定义 Django 管理界面的功能?
  • 知识点: 后端 / 编程语言基础 (主题: django, python, backend;标签: interviewbit, django, topic-specific, python, backend)
  • 类型: technical | 难度: hard | 子类型: coding
  • 分类: fullstack
  • id: 69b37a7d58d557c902ba7302 | 官方: 否 | 付费: 否

答案:

There are multiple ways to customize the functionality of the Django admin interface. You can piggyback on top of an add/change form that’s automatically generated by Django, you can add JavaScript modules using the js parameter. This parameter is basically a list of URLs that point to the JavaScript modules that are to be included in your project within a tag. You can also write views for the admin if you want.

有多种方法可以自定义 Django 管理界面的功能。你可以利用 Django 自动生成的添加/更改表单,还可以使用 js 参数添加 JavaScript 模块。此参数本质上是一个 URL 列表,指向要在项目中的