Design Patterns Singleton Pattern and Factory Pattern

1. Singleton mode Eight ways of singleton mode: hungry (static constant), hungry (static code block), lazy (thread unsafe), lazy (thread safe, synchronized method), lazy (thread unsafe, synchronized code blocks), double checking, static inner classes, enums 1): Hungry Chinese style (static constant) ​ The constructor is privatized, the object i ...

Posted by Baseball on Thu, 26 May 2022 00:14:01 +0300

Home stay management system based on javaweb+mysql (java+SSM+JSP+bootstrap+jQuery+mysql)

Front and back end of ssm home stay management system web page Project introduction Tourist functions: user registration, login, login permission interception, search rooms by name, payment process, view order information and status, comment on reserved rooms, automatically modify order status, view and count the number of remaining rooms. When ...

Posted by TronB24 on Wed, 25 May 2022 23:43:22 +0300

ClassCastException: java. lang.String cannot be cast to com. alibaba. fastjson. Solution of jsonobject

Problem overview About this problem, it is the problem encountered when cooperating with a third-party company to remotely call the service interface (which is equivalent to calling the remote service provider), "java.lang.ClassCastException: java.lang.String cannot be cast to com.alibaba.fastjson.JSONObject" means that the JSON str ...

Posted by deezzer on Wed, 25 May 2022 23:33:56 +0300

spring boot: use redis+lua to limit the frequency of sending SMS verification codes (spring boot 2.3.2)

1. Why limit the sending frequency of SMS verification codes? 1, SMS verification code Each SMS has cost constraints, Certainly can not be brushed the random hair of the interface And the interface is brushed will affect the user's experience, Affect the normal access of the server, So even with the protection of graphic verification codes, etc ...

Posted by shashiku on Wed, 25 May 2022 21:42:39 +0300

SpringBoot 02 notes - SpringBoot configuration yml

Learn about bootstrapping to quickly create applications Reference code: E:\Javawinner\fastspringboot 1. Select spring initializr - > next - > set group and java version – > next to add dependency Various annotations @RestController Equivalent to@Controller @ResponseBody @RequestMapping("/hello") @RequestMapping(value="/hello ...

Posted by chetan1 on Wed, 25 May 2022 20:10:47 +0300

Implement the method of making the program wait for a period of time

JAVA background time waiting JAVA implements the method of making the program wait for a period of time. If you want the code to wait for a period of time before continuing to execute in JAVA, you can sleep the current thread for a period of time. 1. sleep method through thread try { Thread.currentThread().sleep(1000);//Wait 1 second } catc ...

Posted by XTTX on Wed, 25 May 2022 19:32:54 +0300

JDBC operation data and DAO design pattern in actual combat

Using JDBC to manipulate data 1. Using JDBC to write large text data to the database Purpose: to java and other text files are written to the corresponding fields of the corresponding table by connecting the database with JDBC. 1. Table structure 2. Documents 3. Implementation code for inserting text package LoadFileTest; import driver.JDB ...

Posted by schoi on Wed, 25 May 2022 18:54:45 +0300

HI group purchase system development (system development)

HashMap is stored using Hash table. In order to solve the conflict of Hash table, open address method and chain address method can be used to solve the problem. HashMap in Java adopts chain address method. Chain address method, in short, is the combination of array and linked list. There is a linked list structure on each array element. When th ...

Posted by Jonob on Wed, 25 May 2022 18:02:25 +0300

Basic concepts of thread

What is a process? What is a thread Process: simple explanation, an application on the computer hard disk, such as QQ Exe, when it runs, is called a process. Thread: the smallest execution unit in a process is called a thread. Several ways of creating process 1. Inherit the Thread class and override the run() method 2. Implement the Runnable in ...

Posted by lill77 on Wed, 25 May 2022 15:54:58 +0300

In depth understanding of ArrayList and LinkedList, source code analysis and performance testing

Spoiler: ArrayList's insertion and query operations are much faster than LinkedList ArrayList characteristic The bottom layer is realized by array, with fast query speed and slow addition, deletion and modification speed (in theory) Thread unsafe Common methods of ArrayList import java.util.ArrayList; import java.util.Iterator; import jav ...

Posted by cyrixware on Wed, 25 May 2022 15:49:26 +0300