TODO.

TODO LIST

  1. spring cloud config git
  2. spring cache
  3. integrate spring boot admin
  4. spring security

JPA annotation

@Where:统一添加条件,主要用于逻辑删除的Table,查询相关
@SQLDelete: 用于删除实体/集合的自定义SQL语句。

SpringMVC

@PutMapping:

OAuth2Server

AbstractAuthenticationProcessingFilter->ClientCredentialsTokenEndpointFilter(check client_id) 根据请求参数生成Authentication对象(可能为空,或者Anonymous)
->
FilterSecurityInterceptor (根据Authentication对象是否存在或者Anonymous)决定抛异常还是放行
->
```
# OAuth2Client

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter -> 预验证过滤器,主要从request中提取出token

-> AuthenticationManager#authenticate 验证管理器

-> OAuth2AuthenticationManager#authenticate OAuth2验证管理器

-> ResourceServerTokenServices#loadAuthentication
-> UserInfoTokenServices#loadAuthentication req->userInfoEndpointUrl

http://192.168.2.101:8080/eservice/uac/oauth/token -> TokenEndpoint -> JpaUserDetailService

/oauth/authorize -> AuthorizationEndpoint

https://cloud.tencent.com/developer/article/1461835

# Cloud 18628187947
Eureka management UI: http://localhost:8010/

# JPA Query

`CriteriaQuery` 条件查询

`Tuple` 提取查询结果

`Root<Entity>` 查询根对象,from从句后面的...
0<变压器容量≤501KVA+500<变压器容量≤2001KVA+2000KVA<变压器容量≤2501KVA+2500KVA<变压器容量≤5001KVA


# Transaction

TransactionAutoConfiguration、

# Configuration配置类的问题
ConfigurationPropertiesBindingPostProcessor

`1.x`: `PropertiesConfigurationFactory`

`2.x`: `ConfigurationPropertiesBinder`

## BeanDefinitionRegistryPostProcessor

如果配置类实现了`BeanDefinitionRegistryPostProcessor`接口,或者配置内中`@Bean`标注的方法且其返回类型为`BeanDefinitionRegistryPostProcessor`时,会有BUG.

`ConfigurationPropertiesBinder`

`ImportBeanDefinitionRegistrar`

# Thymeleaf windows下以jar包运行乱码问题

1. TemplateRepository#getTemplate
ITemplateResolver 没有指定编码时会使用系统默认编码,windows平台编码为GBK,假如模板文件编码为Utf8或者非GBK编码,渲染后的视图内容就会乱码

final Set templateResolvers = configuration.getTemplateResolvers();
for (final ITemplateResolver templateResolver : templateResolvers) {

            templateResolution = templateResolver.resolveTemplate(templateProcessingParameters);
            
            if (templateResolution != null) {
            }
  }

final String characterEncoding = templateResolution.getCharacterEncoding();
Reader reader = null;
if (!StringUtils.isEmptyOrWhitespace(characterEncoding)) {
try {
reader = new InputStreamReader(templateInputStream, characterEncoding);
} catch (final UnsupportedEncodingException e) {
throw new TemplateInputException(“Exception parsing document”, e);
}
} else {
//default is GBK
reader = new InputStreamReader(templateInputStream);
}


# DOCKER

查看指定服务名的日志(只有一个服务实列)
`docker service ps t_mserv_espare|grep Running|awk '{print $1}'|xargs docker service logs -f`

构建镜像

`docker build -t <TAG_NAME> <Dockerfile_PATH>`

运行镜像

`docker run -d -p 3000:3000/tcp -v /d:\\test:/home/test gettingg-started`

`-d(etach)` 后台模式运行 `-p(ublish) <hostPort>:<containerPort>/<protocol[tpc,udp...]>` 端口映射

`-v(olume)` 磁盘映射 `hostPath`:`containerPath`

查看镜像列表

`docker images`

查看容器实例列表

`docker ps` 或者 `docker container ls`

查看实例中运行的程序的`STD_OUT`(标准输出)(eg:c语言中的`print/printf`,node:`console.log`,java:`System.out`...)

`docker logs <containerId>`

运行当前运行中容器中的命令

` docker exec [OPTIONS] CONTAINER COMMAND [ARG...]`

Options:
-d, –detach Detached mode: run command in the background
–detach-keys string Override the key sequence for detaching a
container
-e, –env list Set environment variables
-i, –interactive Keep STDIN open even if not attached
–privileged Give extended privileges to the command
-t, –tty Allocate a pseudo-TTY
-u, –user string Username or UID (format:
<name|uid>[:<group|gid>])
-w, –workdir string Working directory inside the container

```

eg: docker exec -it 12e /bin/sh

执行上述命令后会会自动连接到目标容易的终端

删除容器

`docker rm -f

创建服务

docker service create [OPTIONS] IMAGE [COMMAND] [ARG...]

DockerFile

COPY SRC DEST

复制src文件到dest

ADD SRC DEST

复制src文件到dest,如果src为压缩文件,怎复制和自动解压

CMD cmd args…

docker run 时运行

RUN cmd args…

docker build时运行,可能

HEX(NUM) -> DECIMAL
int r= (int)(NUM / 10)*16 + NUM%10