注意:能夠用免費版本的,就是下面沒有 被紅框圈中的 Free Mybatis Pluginmybatis
安裝上之後須要破解,先找到下面的文件app
打開文件,設置其中的key 和 value :ide
這裏面的key 和 value 哪兒來呢?ui
使用下面的代碼運行一下便可獲得:idea
public class App { 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("EamonSec".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(); } }
通過幾天的使用,發現上面的插件用起來不是很爽,每次啓動idea都要從新生成一次註冊碼,後面發現有替代方法,使用免費版本的插件(free mybatis plugin)。spa