Lock screen interview questions 100 days, adhere to update the interview questions every working day. Lock screen interview questions APP and mini program are now online, official website address:https://www.demosoftware.cc/#…. It has included all the contents of the interview questions updated daily, as well as features such as unlocking screen review interview questions, daily programming questions email push, etc. This will give you a head start in the interview and give the interviewer a leg up! Here are today’s interview questions:
How do I inject a Java collection in Spring? Spring provides configuration elements for the following collections: 1. The
type is used to inject a list of values, allowing identical values.
</value> </value> </value> </value> </property> <! > <property name="empList"> <list> <ref bean="emp1" /> <ref bean="emp2"/> </list> </property>
2. The
type is used to inject a set of values. The same values are not allowed.
<property name="empSets">
<set>
<ref bean="emp1" />
<ref bean="emp2"/>
</set>
</property>
3. The <map> type is used to inject a set of key-value pairs, both of which can be of any type.
<! > <property name="empMap"> <map> <entry key="1" value-ref="emp1" /> <entry key="2" value-ref="emp2" /> </map> </property>
4. The
<property name="pp">
<props>
<prop key="pp1">hello</prop>
<prop key="pp2">world</prop>
</props>
</property>
2. What is bean autowiring? ~ There is no need to describe dependencies between JavaBeans in Spring configuration files (e.g., configuration
<property name="name" value="zj"/>
3) ByType: : With parameter type autowire, the Spring container finds in the configuration file that the bean’s autowire property is set to ByType, and then the container tries to match and assemble beans of the same type as the bean’s properties. If more than one bean qualifies, an error is thrown.
<property name="name" value="zj"/>
</bean>
An exception is thrown if there is no defined constructor parameter type for the constructor parameter type.
5) Autodetect: first try using Constructor to auto-assemble, and if it does not work, use ByType mode.
4. Similarities and differences between @Autowired and @Resource?
~@Autowired and @Resource are the same:
Both are used for autowiring and can be placed on property fields and set methods
~@Autowired and @Resource:
2.@Autowired for Spring and @Resource for Java
3.@Autowired is implemented by default byType. If there are multiple objects, it will be searched by byName. If none can be found, an error will be reported. You can specify a unique bean object with @Qualifier at this point
4.@Resource is implemented by default byName, or byType if no name can be found! If neither is found, an error will be reported
5. What is a Java-based Spring annotation configuration? Give some examples of annotations
Java-based configuration allows you to do most of your Spring configuration with the help of a few Java annotations rather than through XML files. The @Configuration annotation, for example, is used to mark that the class can be used as a bean definition by the Spring IOC container. Another example is the @Bean annotation, which indicates that this method will return an object to be registered in the Spring application context as a Bean.
6. A brief explanation of Spring AOP
AOP (Aspect Oriented Programming), that is, Aspect Oriented Programming, can be said to be the supplement and perfection of OOP (Object Oriented Programming). OOP introduces the concepts of encapsulation, inheritance, polymorphism, etc., to establish an object hierarchy that simulates a set of common behaviors. While OOP allows developers to define vertical relationships, it is not appropriate to define horizontal relationships, such as logging. Log code tends to be distributed horizontally across all object hierarchies, regardless of the core functionality of the corresponding object. This is also true for other types of code, such as security, exception handling, and transparent persistence. In OOP design, It leads to a lot of code duplication, which is not conducive to the reuse of various modules.
AOP techniques, on the other hand, use a technique called crosscutting to slice open enclosed objects and encapsulate common behaviors that affect multiple classes into a reusable module named “Aspect”, or Aspect. The so-called “slice” is simply the encapsulation of logic or responsibility that has nothing to do with the business, but is jointly called by the business modules, so as to reduce the duplicated code of the system, reduce the coupling degree between modules, and facilitate future operability and maintainability.
Using the “crosscutting” technique, AOP divides a software system into two parts: core concerns and crosscutting concerns. The main process of business processing is the core concern, and the less relevant part is the crosscutting concern. One characteristic of crosscutting concerns is that they often occur in multiple locations of the core concern, and are generally similar everywhere, such as authentication of permissions, logs, and transactions. AOP’s role is to separate the various concerns in the system, separating the core concerns from the crosscutting concerns.
The core of AOP is facets, which encapsulate the common behavior of multiple classes into a reusable module that contains a set of APIs to provide crosscutting capabilities. For example, a logging module can be called an AOP facet of logging. An application can have several facets, depending on the requirements. In Spring AOP, facets are implemented through classes with the @Aspect annotation.
7. What is the difference between concerns and crosscutting concerns in Spring AOP?
A concern is the behavior of a module in an application, and a concern may be defined as a function that we want to implement. A crosscutting concern is a concern that is used by the entire application and affects the entire application, such as logging, security and data transfer, functions that are required by almost every module of the application. So these are crosscutting concerns.
8. What is a connection point?
Intercepted points. Since Spring only supports join points of method types, a join point in Spring refers to the method being intercepted. In fact, join points can also be fields or constructors.
9. What is Spring’s notification? What types are there?
A notification is an action to be taken before or after the execution of a method and is actually a snippet of code that is triggered by the SpringAOP framework when the program is executed.
Spring facets can apply five types of advice:
1) Before: Pre-notification, called before a method is executed.
2) After: Notification that is invoked after method execution, whether or not the method execution was successful.
3) after-returning: Notification executed only after the method has successfully completed.
4) After-throwing: The notification that is performed when a method throws an exception exit.
5) Around: Notifications called before and after method execution.
10. What is the tangent point?
A pointcut is a point or set of join points where advice is executed. Pointcuts can be specified either as expressions or as matches.
11. What is the target target?
The object that is notified by one or more facets. It is usually a proxy object. Also refers to an advised object.
What is an agency?
A proxy is an object that is created after the target object is notified. From the client’s perspective, the proxy object is the same as the target object.
13. What is weaving in? What are the differences in weaving applications?
Weaving is the process of connecting facets to other application types or objects or creating an object to be notified. Weaving can be done at compile time, load time, or run time.
13. Some common terms and explanations in AOP?
Advice: Enhanced processing in the AOP framework. The advice describes when and how the facets are executed.
Join point: A point in the execution of an application where a facet can be inserted. This point can be a method call or an exception thrown. In Spring AOP, the join point is always a method call.
Pointcuts: Join points where enhanced processing can be inserted.
Aspect: Aspect is a combination of advice and pointcuts.
Introduction: Introduction allows us to add new methods or properties to existing classes.
Weaving: Weaving is the process of adding an enhancement process to the target object and creating an enhanced object.
More interview questions can be paid attention to the official account of “Demo Lock Screen Interview Questions”. Interview questions and learning resources can be obtained through the mini program or APP