Lang Go Dep Manage

glide To upgrade dependencies, please make the necessary modifications in glide.yaml and run glide update.

Lang Java Spring Cloud

spring-cloud-greenwich-release To get started with Maven with a BOM (dependency management only): <dependencyManagement> <dependencies> <dependency> <groupId></groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Greenwich.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId></groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> </dependencies>

Lang Java Spring Boot V2

JVM bind with IPv4 Disable IPv6 address lookups when Spring构造注入不需要加@Autowired spring在4.x版本后就推荐使用构造器的方式的来注入fileld 官方推荐理由 单一职责: 当使用构造函数注入的时候,你会很容易发现参数是否过多,这个时候需要考虑你这个类的职责是否过大,考虑拆分的问题;而当使用@Autowired注入field的时候,不容易发现问题 依赖不可变: 只有使用构造函数注入才能注入final 依赖隐藏:使用依赖注入容器意味着类不再对依赖对象负责,获取依赖对象的职责就从类抽离出来,IOC容器会帮你自动装备。这意味着它应该使用更明确清晰的公用接口方法或者构造器,这种方式就能很清晰的知道类需要什么和到底是使用setter还是构造器 降低容器耦合度: 依赖注入框架的核心思想之一是托管类不应依赖于所使用的DI容器。换句话说,它应该只是一个普通的POJO,只要您将其传递给所有必需的依赖项,就可以独立地实例化。这样,您可以在单元测试中实例化它,而无需启动IOC容器并单独进行测试(使用一个可以进行集成测试的容器)。如果没有容器耦合,则可以将该类用作托管或非托管类,甚至可以切换到新的DI框架。 Spring Boot Actuator <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> Actuator comes with most endpoints disabled. Thus, the only two available by default are /health and /info. management.endpoints.web.exposure.include=* by default, all Actuator endpoints are now placed under the /actuator path mvn dependency:tree [INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.4.RELEASE:compile [INFO] | +- org.


go模块代理 $go version go version go1.13.12 linux/amd64 go env -w GO111MODULE=on go env -w GOPROXY=,direct 重置goproxy go env -w GOPROXY go doc proxy 从 Github 的代码库 clone go get -u mv $GOPATH/src/ $GOPATH/src/ go get -u mv $GOPATH/src/ $GOPATH/src/ 设置 GOPROXY 环境变量配置代理 例如:GOPROXY= 配置代理 系统代理 GIT代理

Effective Coding


Go Module

模块 A module is a collection of related Go packages that are versioned together as a single unit. Modules record precise dependency requirements and create reproducible builds. go.mod A module is defined by a tree of Go source files with a go.mod file in the tree’s root directory. Module source code may be located outside of GOPATH. There are four directives: module, require, replace, exclude. 显示当前的模块和依赖 go list -m all 显示特定模块的所有版本标签 go list -m -versions github.


虚拟包版本 Untagged revisions can be referred to using a “pseudo-version” like v0.0.0-yyyymmddhhmmss-abcdefabcdef, where the time is the commit time in UTC and the final suffix is the prefix of the commit has go get go get: upgraded v0.0.1 => v0.0.2-0.20211216162907-40b41ba86c5c 类型转换操作 For every type T, there is a corresponding conversion operation T(x) that converts the value x to >type T. A conversion from one type to another is allowed if both have the same underlying type, or >if both are unnamed pointer types that point to variables of the same underlying type; these >conversions change the type but not the representation of the value.

Effective Coding Java


Java Notes

Java诊断利器Arthas curl -O java -jar arthas-boot.jar [arthas@9208]$ thread 1 "main" Id=1 TIMED_WAITING at [email protected]/java.lang.Thread.sleep(Native Method) at [email protected]/java.lang.Thread.sleep( at [email protected]/java.util.concurrent.TimeUnit.sleep( JVM MEMORY MODEL Received fatal alert: protocol_version On Java 1.8 default TLS protocol is v1.2. On Java 1.6 and 1.7 default is obsoleted TLS1.0. I get this error on Java 1.8, because url use old TLS1.0 echo 'export JAVA_TOOL_OPTIONS="-Dhttps.protocols=TLSv1.2"' >> ~/.bashrc source ~/.bashrc 访问可见性 修饰符 类 包 子类 所有人 public 是 是 是 是 protected 是 是 是 否 没有修饰符 是 是 否 否 private 是 否 否 否 方法签名 方法签名包括