JAVA

JAVA这两年

JAVA 这两年最重要的项目就是GRAAL的正式版发布。 GRAAL能做什么? 让解释性程序例如JAVA, JS 运行的更快: AOT编译为宿主二进制可执行文件, 启动时间小于100ms, 像C, GO, ERLANG一样的执行速度 更低的内存占用:只占用传统的JVM应用20%的内存 听起来是不是该项目为函数计算做准备的? 是,但不完全是。 GRAAL的官方目标是提供一个统一的虚拟机执行平台,支持如下运行环境: JavaScrip Python Ruby R JVM 语言(Java, Scala, Groovy, Kotlin, Clojure) LLVM语言 (C , C++) 而且不同语言之间零成本互相调用 安装 wget https://github.com/oracle/graal/releases/download/vm-19.2.1/graalvm-ce-linux-amd64-19.2.1.tar.gz tar zxvf graalvm-ce-linux-amd64-19.2.1.tar.gz export PATH=$PATH:$GRAAL_HOME/bin 检查 js --version GraalVM JavaScript (GraalVM CE Native 19.2.1) 安装native-image gu install native-image gu available Downloading: Component catalog from www.

Dockering Java 8

Improve docker container detection and resource configuration usage https://blog.softwaremill.com/docker-support-in-new-java-8-finally-fd595df0ca54 https://www.oracle.com/technetwork/java/javase/8u191-relnotes-5032181.html

Groovy Notes

Allow more ways of creating objects using literals Introduce new datatypes together with their operators and expressions. Closure simple abbreviated syntax of closures: after a method call, put code in braces with parameters delimited from the closure body by an arrow. log = '' (1..10).each{ log += it } assert log == '12345678910' log = '' (1..10).each{ counter -> log += counter } assert log == '12345678910' A second way of declaring a closure is to directly assign it to a variable:

Lang Java Spring Cloud

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

Lang Java Spring Boot V2

JVM bind with IPv4 Disable IPv6 address lookups when -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true 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.springframework.boot:spring-boot-starter-aop:jar:2.1.4.RELEASE:compile [INFO] | | +- org.springframework:spring-aop:jar:5.1.6.RELEASE:compile [INFO] | | \- org.

Effective Coding Java

JAVA 基础 JAVA 基础

Java编码规范

JAVA 开发规范 目标: 容易维护 健壮 可复用 分类 指导 编码 UTF-8 注释 支持Swagger git模式 PR(pull-request) / merge request 代码静态检查 遵守风格规范 代码提交 必须通过review 测试 所有代码都有单元测试 集成测试 所有代码必须通过集成测试才能提交到分支或主干 编码风格

Maven Mirror

settings.xml <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> <!-- 中央仓库在中国的镜像 --> <mirror> <id>maven.net.cn</id> <name>oneof the central mirrors in china</name> <url>http://maven.net.cn/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror>

Java Notes

JVM MEMORY MODEL javax.net.ssl.SSLException: 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 是 否 否 否 方法签名 方法签名包括