Java connection to MongoDB: two fully annotated classes are all completed

Java connection to MongoDB Environment: JDK 13, MongoDB 4.2 Don't talk much, just do it Create environment Create Java Maven project, and then import the following dependency shelf package. MongoDB driver is a shelf package <dependency> <groupId>org.mongodb</groupId> &l ...

Posted on Wed, 22 Jan 2020 09:57:17 -0500 by pspeakman

On unit test

Unit tests or the best project documentation. When I was learning to use Java for testing a long time ago, I got the help of a mysterious big man and talked about unit testing together. The basic conclusion is that unit testing is probably useless. As we all know, an obvious feature of automated testing compared with manual testing is that it ...

Posted on Wed, 22 Jan 2020 00:05:36 -0500 by marcusb

spring aop use, spring aop annotation, spring aspect programming

================================ Copyright 2020-01-21 https://www.cnblogs.com/fanshuyao/   1, The first step is to reference the dependency class and add dependency in Pom.xml <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifact ...

Posted on Tue, 21 Jan 2020 11:17:31 -0500 by astaroth

How to understand the difference between byte stream and character stream in java

How to understand the difference between byte stream and character stream in java     package com.cn; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.InputStreamReader; import java ...

Posted on Sun, 19 Jan 2020 04:34:27 -0500 by buddymoore

Spring cloud Eureka infrastructure

1 Introduction Eureka is developed by Netflix, a REST service based component for service registration and discovery It mainly includes two components: Eureka Server and Eureka Client Eureka Client: a Java client used to simplify the interaction with Eureka Server (usually the client and server in mic ...

Posted on Wed, 15 Jan 2020 08:41:38 -0500 by kevinkhan

Unit test with JUnit4 in Intellij IDEA

Article directory 1, Environmental preparation 1. Install JUnitGenerator 2. Add JUnit.jar package to the project 2, Write test code 1. Write test class in src directory 2. Write a test class in the test directory (if not, create a new test and set it to Test Resources Root) 3. Create a new Test ru ...

Posted on Sun, 12 Jan 2020 01:37:11 -0500 by abhinic

Spring AOP based on AspectJ

brief introduction AspectJ is an AOP framework based on Java language. Spring 2.0 added support for AspectJ pointcut expressions. Because AspectJ did not appear in spring 1.0; Support for annotations has been added in AspectJ 1.5, allowing you to define facets directly in the Bean class. New version of Spring framework We all use AspectJ to dev ...

Posted on Sat, 11 Jan 2020 07:29:42 -0500 by -Karl-

spring common notes - Scope

@The role of Scope package common.config; import common.bean.Person; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @Configuration public class MainConfig2 { /* * @see ConfigurableBeanFactory#SCOPE_PROTO ...

Posted on Fri, 10 Jan 2020 11:37:38 -0500 by VFRoland

Notes for Android to print Jar package

1. Create a new independent module POS service The information of Jar package defined in gradle of POS service apply plugin: 'com.android.library' android { compileSdkVersion 27 defaultConfig { minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrum ...

Posted on Mon, 06 Jan 2020 18:21:44 -0500 by alexu'

@Profile annotation and @ Conditional annotation

@Profile annotation: spring provides us with the ability to dynamically activate and switch a series of components according to the current environment. @Conditional: judge according to certain conditions, and inject bean s into the container if the conditions are met @Profile code example: package common.config; import com.alibaba.druid. ...

Posted on Mon, 06 Jan 2020 14:24:08 -0500 by rohithmr