Spring开发memo
解密Jasypt密文
开发中遇到一些配置的密文,有解密的需要
AES256TextEncryptor encryptor = new AES256TextEncryptor();
encryptor.setPassword("some_salt");
String plainText = encryptor.decrypt(myEncryptedText);
System.out.println("Decrypted: "+plainText);
winmerge 除外特定文件或文件夹
进入 Tools | Filters… | Filefilters选项,编辑Exclude Source Control
(也可以新建,但是编辑这个更方便,内置filter可以除外掉版本管理文件)
## Ignore Java class and jar files
f: \.class$
f: \.jar$
## Ignore target directories
d: \\target$
maven运行时出现警告: An illegal reflective access operation has occurred
wget https://www.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp
sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt
sudo update-alternatives --install /usr/bin/mvn mvn /opt/apache-maven-3.6.3/bin/mvn 363
sudo update-alternatives --config mvn
手动调用spring组数据校验
// 定义SmartValidator
@Bean
@Primary
public Validator myValidator() {
return new LocalValidatorFactoryBean();
}
// 使用的时候注入SmartValidator, validationHints可以指定group
smartValidator.validate(target, errors, validationHints);
// 默认校验只能单层, 如果自定义对象成员变量时, 就需要给成员变量加@Valid, 才能校验自定义对象里的内容
并发控制
// 1. 定义HttpSessionEventPublisher
@Bean
public HttpSessionEventPublisher httpSessionEventPublisher() {
return new HttpSessionEventPublisher();
}
// 2. 设置maximumSessions
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) {
http
.sessionManagement(session -> session
.maximumSessions(1)
);
return http.build();
}
导出svn patch
Show Log -> Show differences as unified diff -> copy + save to file
reference
- Decrypt using Jasypt
- How to ignore SVN folders in WinMerge
- maven: An illegal reflective access operation has occurred
- Grouping Javax Validation Constraints | Baeldung
- Multiple ‘org.springframework.validation.Validator’ beans are exposed as of Spring Boot 1.5 · Issue #8495 · spring-projects/spring-boot
- java - Validation of a list of objects in Spring - Stack Overflow
- java - How to manually trigger Spring validation? - Stack Overflow
- java - What type of exception to throw in Spring RestController when validation fails? - Stack Overflow
- Spring Security Session管理 - 黄建东 - 博客园
- Session Management - Spring Security Reference
- Spring: Expiring all sessions of a user | Mert Yürtbilir
- diff - SVN create patch from committed code? - Stack Overflow
- svn - How to use TortoiseSVN via command line? - Stack Overflow
Updated: 2023-09-03 13:31
Created: 2022-11-15 20:00