#{} how to prevent SQL injection? What is its underlying principle?

1, The difference between ${} and #{} in MyBatis1.1 ${} and #{} presentationsDatabase data:dao interface:List<User> findByUsername(String username); List<User> findByUsername2(String username); Mapper.xml: <!-- use#{} --> <select id="findByUsername" parameterType="java.lang.String" resultType="com.lscl.entity.User">     ...

Added by seikan on Tue, 15 Feb 2022 04:09:18 +0200

[dark horse programmer Java notes] method

catalogue 1. Method overview 2. Definition and invocation of simple methods 3. Definition and invocation of methods with parameters 4. Definition and call of method with return value 5. Method overloading 6. Parameter passing of method 1. Method overview The method is to organize the code blocks with independent functions into a whole ...

Added by khf79 on Tue, 15 Feb 2022 04:04:03 +0200

Usage of Java foreach statement

Usage of Java foreach statement foreach loop statement is one of the new features of Java 1.5. foreach provides great convenience for developers in traversing arrays and collections. foreach loop statement is a special simplified version of for statement, which is mainly used to execute the loop of traversal function. The syntax format of for ...

Added by Spud_Nic on Tue, 15 Feb 2022 03:51:44 +0200

[daily practice of Android spring moves] LeetCode Hot 5 questions

overview LeetCode Hot: longest continuous sequence, numbers that appear only once, word splitting, circular linked list, circular linked list II LeetCode Hot 2.46 longest continuous sequence Given an unordered integer array nums, find the length of the longest sequence of consecutive numbers (sequence elements are not required to be con ...

Added by kml2katz on Tue, 15 Feb 2022 03:42:59 +0200

Kotlin grammar manual

Kotlin grammar manual (III) When using kotlin, because the mastery is not reliable enough, it is still a habit of Java programming, which wastes the language features, convenience and indirectness provided by kotlin. When reading some Android open source libraries, it is difficult to read because many of them are written by kotlin syntax, and ...

Added by alsaffar on Tue, 15 Feb 2022 03:36:42 +0200

Concurrent class programming - countdownlatch

1. Overview CountDownLatch is a synchronizer tool class, which is used to coordinate the synchronization between multiple threads. It can make a thread continue to execute after waiting for other threads to complete their work. It cannot be reset. 2. Realize A counter is used for implementation. The initial value of the counter is the number ...

Added by PW on Tue, 15 Feb 2022 02:12:43 +0200

Talk about unit testing

Author|DustSource|Ali Technical Public NumberWrite beforeUnit testing is certainly familiar to our developers, but it can be overlooked for a variety of reasons, especially in projects I come across where a wide variety of issues are found during the quiz phase, and I feel it is necessary to talk about unit testing.Unit tests written for writin ...

Added by BZero on Mon, 14 Feb 2022 19:51:11 +0200

Asynchronous artifact: implementation principle and usage scenario of completable future

1. GeneralCompletable future is jdk1 8 introduced implementation classes. Future and CompletionStage are extended. It is a future that can trigger some operations in the task completion stage. In short, asynchronous callback can be implemented.2. Why is completable future introducedFor jdk1 The Future of 5 provides the ability to process tasks ...

Added by trent2800 on Mon, 14 Feb 2022 17:43:05 +0200

[java] source code analysis of SynchronousQueue

1. General Reprint: jdk11 source code - Analysis of SynchronousQueue source code Synchronous queue is a synchronous blocking queue. Each put operation must wait for a take operation. Each take operation must also wait for a put operation. SynchronousQueue has no capacity and cannot store element node information. It cannot obtain elements ...

Added by tmswenson on Mon, 14 Feb 2022 17:04:16 +0200

Java Memory Model for Java Concurrent Programming

1. Java Memory Model JMM is the Java Memory Model, which defines the abstract concepts of main memory and working memory from the Java level. The bottom layer corresponds to CPU register, cache, hardware memory, CPU instruction optimization, etc. JMM is reflected in the following aspects: Atomicity - ensures that instructions are not affe ...

Added by Alkimuz on Mon, 14 Feb 2022 16:59:16 +0200