方式1(简易):
pom依赖
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency>
//text 表示需要写入到二维码中的信息
public static String getQR(String text){
QRCodeWriter wr = new QRCodeWriter();
BitMatrix matrix = null;
try {
matrix = wr.encode(text, BarcodeFormat.QR_CODE, 150, 150);
ByteArrayOutputStream out = new ByteArrayOutputStream();
MatrixToImageWriter.writeToStream(matrix, "png", out);
//转base64编码输出
byte[] str