java recursive exercise
File class recursive exercise
Receive a folder path from the keyboard and count the size of the folder
Solution:
Create keyboard entry objectDefine infinite loopStore and encapsulate the result of keyboard entry into File objectJudge the File objectReturn the folder path objectDefine a summation variableGet all files and folders under t ...
Added by MattDunbar on Fri, 11 Feb 2022 02:33:54 +0200
Spring code tips that you can't put down
I happen to have some research on spring source code. Combined with my practical work experience in recent years, I summarize the knowledge points I think are good in spring. I hope it will be helpful to you.
Seek attention Welcome to pay attention to my B station accountStation B account number If the content can help you, you are welcome to ...
Added by RockRunner on Fri, 11 Feb 2022 02:24:16 +0200
Record on the loss of Feign remote call request header in learning and encouraging mall micro services
Loss of request header in Feign remote call in single thread
Code case
Order service:
Controller:
/**
* When the goods are selected in the shopping cart service and click "go to settlement", the order service is triggered.
* This controller is mainly used to return order settlement details and other information
* ...
Added by Teaky on Fri, 11 Feb 2022 01:34:44 +0200
springbootCache and Redis caching mechanism
brief introduction
I want to develop a social networking site. Storing friends list on social networking sites has become a big problem in the development process.
If I want to save every user's friend information, how should I save it?
The user's id corresponds to the friend's id. such a message is a friend relationship map. This relati ...
Added by Magena Cadmar on Thu, 10 Feb 2022 23:32:20 +0200
Sorting algorithm and binary search algorithm
1. Bubble sorting
Bubble sorting principle:
1) Compare two adjacent elements. If the preceding element is larger than the following element, exchange the two numbers. After the first traversal, the maximum number will be placed at the last position of the array, that is, array[length - 1]. 2) The last element is skipped during the second trav ...
Added by blindtoad on Thu, 10 Feb 2022 22:27:00 +0200
Deep and shallow cloning of Java 8
References:
What is the difference between deep cloning and shallow cloning? How are they realized
catalogue
1, Introduction to deep cloning and shallow cloning
1. Overview
2. Implementation of copy function
2, Implementation of deep cloning
1. Clone all objects
2. Deep cloning is realized by construction method
3. Deep cloning throu ...
Added by TheCase on Thu, 10 Feb 2022 21:52:47 +0200
Singleton mode (hungry singleton, lazy singleton, DCL mode, static internal class implementation, enumeration Implementation) this article is enough!
1. Single case mode elements
Ensure that there is only one instance in a class and provide a global access point
a.Private construction method
b.Private static references point to their own instances
c.Public static method with its own instance as return value
2. Hungry Han style single example
public class Hungry {
//Priv ...
Added by ziesje on Thu, 10 Feb 2022 21:47:14 +0200
Chapter 15 Java se special topic object-oriented advanced II - code block details
1. Code block overview
Code block: also known as initialization block, it is a member of a class, similar to a method. It encapsulates logical statements in the method body and is surrounded by {};And methods:
1. No method name, no return value, no parameter, only method body;2. It is not called explicitly through an object or class, but im ...
Added by geo__ on Thu, 10 Feb 2022 21:11:29 +0200
spring annotation development
Environment construction
In addition to the xml in the previous document, a context:component constraint should be added
1. xml configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www. ...
Added by svivian on Thu, 10 Feb 2022 21:04:00 +0200
Basic use of Spring framework
1, Foreword
The basic part of the Spring framework is too long. It is divided into several articles to consolidate the learning record.
1. What is Spring
The spring framework was created due to the complexity of software development. Spring uses basic JavaBean s to accomplish things that could only be done by EJB s before. However, the use o ...
Added by Dillinger on Thu, 10 Feb 2022 21:03:58 +0200