当前位置:网站首页>Learning Record V
Learning Record V
2022-07-25 02:52:00 【young_ man2】
One 、 Punch in

When I first saw this topic , I think everyone should have an idea , That is violent solution !
But in addition to violent solutions , We have other ways : Double finger needling
How does double finger needling work ?
First , We put a pointer at the end , At this time, the maximum capacity is min(x,y)∗t=x∗t(t Represents the distance )
Then ask for one , We can move the smaller of the two pointers
Why the small one ?
Because if you move the big one , There can be no bigger situation than before !
So finally, we can get the code as follows :
public class Solution {
public int maxArea(int[] height) {
int l = 0, r = height.length - 1;
int ans = 0;
while (l < r) {
int area = Math.min(height[l], height[r]) * (r - l);
ans = Math.max(ans, area);
if (height[l] <= height[r]) {
++l;
}
else {
--r;
}
}
return ans;
}
}Two 、Spring Of Aop Learning from
1. Aop The advantages and functions of
AOP( Section oriented programming )
effect : During program operation , Enhance the function of the method without modifying the source code
advantage : Reduce duplicate code , Improve development efficiency , Easy to maintain
2. AOP The underlying implementation of
AOP The bottom layer is through Spring Provided by the dynamic proxy technology . During operation ,Spring Dynamically generated proxy objects through dynamic proxy technology , When the proxy object method is executed, enhance the function , Then adjust the method of the target object , In order to complete the function enhancement .
3. AOP Dynamic proxy technique
JDK agent : Dynamic proxy technology based on interface
cglib agent : Dynamic proxy technology based on parent class


4. JDK Dynamic proxy technique

The two problems to be solved in implementing dynamic proxy are :
① How to dynamically create proxy objects and classes according to the proxy objects loaded into memory
② How to call the method with the same name of the proxied class when calling the method through the object of the proxy class

5. cglib Dynamic proxy for
Import cglib Of jar package


6.AOP Related concepts of
Taget( Target audience ): The target object of the proxy
Proxy( agent ): A class is AOP After weaving in reinforcement , To produce a result proxy class
Joinpoint( Connection point ): The so-called connection points refer to the points that are intercepted . stay spring in , These points refer to methods , because spring Only method type connection points are supported .
Pointcut( The breakthrough point ): The so-called entry point refers to what we want to do Joinpoint Definition of interception
【 The connection point is the method that can be enhanced , The entry point is the enhanced method 】
Advice( notice / enhance ): The so-called notification refers to intercepting Joinpoint The next thing to do is to inform
Accept( section ): It is the combination of entry point and notification
Weaving ( Weaving ): The process of applying enhancements to a target object to create a new proxy object .spring Weaving with dynamic agent , and AspectJ Compiler weaving and class loading weaving
7.AOP Develop clear objects
① What needs to be written
Business core code ( The target method of the target class )
Write cut class , There are notifications in the aspect class ( Enhancement methods )
In the configuration file , Configure weaving relationships , Which notifications will be combined with which connection points
②AOP Content of technical implementation
Spring The framework monitors the execution of pointcut methods . One - Once the pointcut method is monitored to be run , Use the proxy mechanism , Create the proxy object of the target object dynamically , According to notification category , In the corresponding position of the proxy object , Weave the function corresponding to the notification into , Complete the logic operation of the code .
③AOP Which proxy method is used at the bottom
It will decide which dynamic proxy method to use according to whether there is an interface

8. be based on XML Of AOP Development
① Fast import AOP coordinate
② Create target interfaces and target classes ( There's a tangent point inside )
③ Create the section class ( There are enhancement methods inside )
④ Give the object creation right of target class and section class to spring
⑤ stay applicationContext.xml In the configuration weaving relationship
⑥ Test code


3. Extraction of pointcut expressions

9. Annotation based AOP Development






Daily picture sharing , I didn't have time to study yesterday's school year design defense !

边栏推荐
- Do you know about real-time 3D rendering? Real time rendering software and application scenarios are coming
- MySQL common function summary, very practical, often encountered in interviews
- "Introduction to interface testing" punch in day06: interface testing platform: are tools and frameworks incompatible?
- R language one page and many pictures
- How to communicate with aliens
- Jenkins plug-in development -- plug-in expansion
- If there is a segment in the encryption field, are you "bronze" or "King"?
- QT realizes calendar beautification
- Tp5.1 include include files (reference public files)
- Matlab draws radar chart (four lines of code)
猜你喜欢

JS foundation -- object static method

If there is a segment in the encryption field, are you "bronze" or "King"?

Picgo configuring Alibaba cloud OSS

UDP message structure and precautions

Study notes of filebeat
![[jailhouse article] scheduling policies and system software architectures for mixed criticality](/img/cc/874f8436991fdeb3a0e87e526c1753.png)
[jailhouse article] scheduling policies and system software architectures for mixed criticality

Visualization of correlation coefficient matrix

My creation anniversary (3rd Anniversary)

Redux best practices "Redux toolkit"

C: wechat chat software instance (wpf+websocket+webapi+entityframework)
随机推荐
Arduino IDE for raspberry PI Pico development firmware localization installation tutorial
Several dpdk control frameworks
[circular array] JS method collection of circular array
Strategy mode, just read one article
MySQL common function summary, very practical, often encountered in interviews
Wechat sports field reservation of the finished works of the applet graduation project (6) opening defense ppt
Learning record Xi
Hyperchain hyperblockchain Shi Xingguo was interviewed by 36 krypton: the amount of customer cooperation consulting is doubling
JS foundation -- hijacking of this keyword
Mid year summary and personal feelings
Custom types in C language
Keil compile download error: no algorithm found for: 08000000h - 08001233h solution
JS foundation -- JSON
Read and upgrade st-link chip information and SWD burning media through STM32 stlink utility tool
How to take the mold for the picture of 1.54 inch TFT st7789 LCD screen
The latest interview questions and analysis of software testing in 2022
My creation anniversary (3rd Anniversary)
Mark down learning
【C】 Advanced knowledge of file operation
"Introduction to interface testing" punch in to learn day07: websocket interface: how to test a completely unfamiliar protocol interface?