Gradle for android profile

preface Create a new project directly under Android Studio and you can use it! I. Gradle settings file settings.gradle is used to indicate which modules Gradle should include when building an application. Only app module is included here include ':app' II. Top level construction documents Look at build.gradle of the project under ...

Posted by flash gordon on Wed, 18 Dec 2019 11:01:47 -0800

Lucene note 01 introduction to Lucene and preliminary index creation

I. significance of Lucene's existence Our usual database search, such as content search, we need to use the like method, which is very inefficient. This is about Lucene. When Lucene searches, it uses an index. This index is similar to the front index table when we look up a dictionary. Compared with looking up a dictionary, we ...

Posted by pwicks on Sat, 14 Dec 2019 11:15:00 -0800

Everything is a map: the essence of code

Dynamic execution of a simple code, using the generation of java files, call javac compilation, reflection of the way of execution. Use the I / O stream (or what you might say is to use reflection to get the program results to parse) to parse *. Java files. You can then use runtime to call the java compile command under Dos to comp ...

Posted by olko on Thu, 12 Dec 2019 10:17:19 -0800

A simple introduction to Java reflection

1. A brief introduction to class A Class of Class represents a Class and interface in a running Java application. Enumeration is a kind, an annotation is an interface, and each array also belongs to a Class reflected as a Class object, which is shared by all arrays with the same element type and dimension. Primitive Java types (boolean, byte, c ...

Posted by jasonman1 on Sat, 07 Dec 2019 08:22:15 -0800

Spring AOP development of AOP based on AspectJ

Realize AOP development mode based on AspectJ: Annotation mode XML mode AspectJ is an AOP framework based on Java language; support for AspectJ pointcut expressions has been added since spring 2.0 @AspectJ is a new function of AspectJ 1.5. With JDK 1.5 annotation technology, you can directly define facets in Bean classes @Aspe ...

Posted by winsonlee on Thu, 05 Dec 2019 14:26:33 -0800

How do you assert that an exception was thrown in JUnit 4 tests?

How to use JUnit 4 to test some code to throw exceptions? Although I can certainly do such things: @Test public void testFooThrowsIndexOutOfBoundsException() { boolean thrown = false; try { foo.doStuff(); } catch (IndexOutOfBoundsException e) { thrown = true; } assertTrue(thrown); } I remember in this case, having a ...

Posted by ivki on Thu, 05 Dec 2019 07:17:29 -0800

Java non blocking NIO case (realize multi person chat function)

I. three cores of using Java NIO to complete network communication 1. Channel: responsible for connection java.nio.channels.Channel interface:              |--SelectableChannel                  |--SocketChannel                  |--ServerSocketChannel                  |--DatagramChannel                    |--Pipe.SinkChannel                  |-- ...

Posted by gergy008 on Tue, 03 Dec 2019 06:06:53 -0800

Deep understanding of lambda expression and functional programming functional interface source code analysis

package com.java.design.java8; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.Arrays; import java.util.Compar ...

Posted by jordz on Tue, 03 Dec 2019 01:56:08 -0800

Simulate HTTP request to call controller

Please refer to my brief book: Simulate HTTP request to call controller Written in front MockMvc realizes the simulation of Http request, and can directly use the form of network to convert to Controller call, which makes the test faster and does not depend on the network environment. It also provides a set of verification tools. The single tes ...

Posted by Stoned Gecko on Tue, 03 Dec 2019 01:17:34 -0800

Simple use of VirtualAPK

Steps to introduce VirtualApk: I. Introduction of virtual APK to host application 1. Add dependency in the build.gradle file of the project: dependencies { classpath 'com.didi.virtualapk:gradle:0.9.8.6' } The complete gradle file is as follows: // Top-level build file where you can add configuration options common to all sub-projects/module ...

Posted by darksniperx on Sun, 01 Dec 2019 14:38:17 -0800