mybatis plus插件激活多少钱
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis plus插件激活多少钱相关的知识,希望对你有一定的参考价值。
参考技术A public static synchronized boolean refValid()if (!validated)
validated = true;
try
String key = MybatisSetting.getInstance().getKey(); //KEY
String result = MybatisSetting.getInstance().getResult(); //RESULT
if ((StringUtils.isBlank(key)) || (StringUtils.isBlank(result)))
valid = false;
else
Key publicKey = Codec.loadKey(key);
Codec.decrypt(publicKey, Hexs.toBytes(result));
valid = true;
catch (Exception e)
valid = false;
return valid;
这里说明KEY和RESULT其实是C:\Users\ilanyu\.IntelliJIdea2016.2\config\options\mybatis.xml这个文件中获取到的
下面的
Key publicKey = Codec.loadKey(key);
Codec.decrypt(publicKey, Hexs.toBytes(result));
这两句是校验KEY和RESULT的
具体代码如下
public static Key loadKey(String key)
Preconditions.checkNotNull(key, "key must not be null");
try
KeyFactory factory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec spec = new X509EncodedKeySpec(Hexs.toBytes(key));
return factory.generatePublic(spec);
catch (Exception e)
throw new RuntimeException(e);
public static byte[] decrypt(Key key, byte[] raw)
Preconditions.checkNotNull(key, "key must not be null");
Preconditions.checkNotNull(raw, "raw must not be null");
try
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(2, key);
return cipher.doFinal(raw);
catch (Exception e)
throw new RuntimeException(e);
首先对KEY检查,看是否含有公钥,有就通过,没有就失败
然后用KEY里的公钥检测能不能用来解密RESULT
针对性的注册机:
package com.lanyus;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
public class Main
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA");
keygen.initialize(512);
KeyPair kp = keygen.generateKeyPair();
RSAPrivateKey privateKey = (RSAPrivateKey)kp.getPrivate();
RSAPublicKey publicKey = (RSAPublicKey)kp.getPublic();
System.out.println("KEY:\n" + bytesToHexString(publicKey.getEncoded()) + "\n");
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE,privateKey);
System.out.println("RESULT:\n" + bytesToHexString(cipher.doFinal("ilanyu".getBytes())) + "\n");
private static String bytesToHexString(byte[] src)
StringBuilder stringBuilder = new StringBuilder("");
if (src == null || src.length <= 0)
return null;
for (byte aSrc : src)
int v = aSrc & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2)
stringBuilder.append(0);
stringBuilder.append(hv);
return stringBuilder.toString();
计算出来的KEY和RESULT:
KEY:
305c300d06092a864886f70d0101010500034b003048024100878e6bea07d7052499419efe4ed4382f426dc5ca2d01140f896a6d0566526c6757ff591347d888bd032f94ce92609ce0cc349de0ba9043dc3163f9667438a14d0203010001
RESULT:
414834456369b9329793f0b42c6c0af67d00516c7ceb136ad221fa0355dc2cd611ed1bcd36b61d00ba7e587d253c1de145831cd0d65b891c9dc34430f9e69c59
说下KEY和RESULT的使用方法:
1、安装官方版mybatis plus插件,然后关闭IDEA
2、hosts中添加127.0.0.1 www.codesmagic.com
3、记事本打开C:\Users\USER\.IntelliJIdeaVERSION\config\options\mybatis.xml,
对应的字段中,打开idea,mybatis插件已经激活
写入到127.0.0.1 www.codesmagic.com 参考技术B $69.99=¥460.4292
Mybatis Plus 3.4.0分页拦截器的用法,解说mybatis plus 3.4.0的新内置插件
Mybatis Plus 3.4.0
新增了如下地内置插件:
主体插件: MybatisPlusInterceptor
该插件内部插件集:
- 分页插件: PaginationInnerInterceptor
- 多租户插件: TenantLineInnerInterceptor
- 动态表名插件: DynamicTableNameInnerInterceptor
- 乐观锁插件: OptimisticLockerInnerInterceptor
- sql性能规范插件: IllegalSQLInnerInterceptor
- 防止全表更新与删除插件: BlockAttackInnerInterceptor
spring cloud alibaba配置分页插件
@Configuration
@MapperScan("scan.your.mapper.package")
public class MybatisPlusConfig
/**
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor()
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
return interceptor;
@Bean
public ConfigurationCustomizer configurationCustomizer()
return configuration -> configuration.setUseDeprecatedExecutor(false);
更多详细的教程,请参见官方地址:https://mybatis.plus/guide/interceptor.html#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F-%E4%BB%A5%E5%88%86%E9%A1%B5%E6%8F%92%E4%BB%B6%E4%B8%BE%E4%BE%8B
应用案例
Matecloud就是采用了Mybatis plus 3.4.0的版本作为应用场景,具体参见:
https://github.com/matevip/matecloud
以上是关于mybatis plus插件激活多少钱的主要内容,如果未能解决你的问题,请参考以下文章
Mybatis Plus 3.4.0分页拦截器的用法,解说mybatis plus 3.4.0的新内置插件
Spring Boot(十一):MyBatis插件之MyBatis-Plus