自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 springboot利用AbstractRoutingDataSource实现动态切换数据源

需求:编写一个代码生成器,前端下拉选择需要自动生成代码的数据库名。后端切换数据库并且生成对应的代码。动态切换数据源:springboot提供了一个AbstractRoutingDataSource类。我们可以实现一个类继承AbstractRoutingDataSource并且determineCurrentLookUpKey()方法。具体步骤:数据源配置spring: datasource: type: com.alibaba.druid.pool.DruidDataSource

2021-05-29 15:20:09 350

原创 springboo+shiro+redis实现登录demo

项目结构:User实体类:package com.shirodemo.bean;import java.io.Serializable;public class User implements Serializable { private int id; private String username; private String password; ...

2020-04-28 21:15:27 336

原创 == 和 equals 的区别

总是忘记,记录一下。==对于基本类型和引用类型==作用的效果不同1:对于基本类型比较的是值2:对于引用类型比较的是引用地址 String a = "hello"; String b = "hello"; String c = new String("hello"); System.out.println(a == b); //true...

2020-04-27 16:33:35 117

原创 int,Integer和new Integer()的比较

数字比较1:int与Integer只要值相等就为trueint c = 128;Integer d = 128;System.out.println(c == d);2:int与new Integer()同样也是值相等就为true int a = 128; Integer b = new Integer(128); System.out.println(a == b);3...

2020-04-27 15:20:26 296 1

转载 面试题思考:Cookie 和 Session的区别

原地址:原地址面试回答:1、cookie数据存放在客户的浏览器上,session数据放在服务器上。2、cookie不是很安全,别人可以分析存放在本地的cookie并进行cookie欺骗,考虑到安全应当使用session。3、session会在一定时间内保存在服务器上。当访问增多,会比较占用你服务器的性能,考虑到减轻服务器性能方面,应当使用cookie。4、单个cookie保存的数据不能超...

2020-04-27 15:07:01 287

原创 springboot+Vue+ElementUI+PageHelper实现分页

1. springboot整合PageHelper(1)加入依赖<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> ...

2020-04-19 07:52:28 2162

原创 使用mybatis-plus出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

原配置mybatis: mapperLocations: classpath:mapper/*.xml type-aliases-package: springboot.shiro.entity修改后mybatis-plus: mapper-locations: classpath:mapper/*.xml type-aliases-package: springboot....

2020-04-15 08:12:12 1044

原创 vue使用axios提示We're sorry but vms doesn't work properly without JavaScript enabled.

原代码 service({ method:'get', path:'/user', data:{} }) .then((res) =>{ ...

2020-04-14 16:59:02 2417

原创 vue配置路由提示"path" is required in a route configuration.

学习vue的时候出现了"path" is required in a route configuration这样的错误,找了挺久才发现的错误。{ //重定向 path:'/main', redirect: to => { return { name:'Home' } } }, { //这里多加了个花括号 ...

2020-04-12 15:57:45 26025 1

原创 前缀树相关

关于前缀树可以参考这篇非常不错的博文剑指Offer——Trie树(字典树)下面是利用前缀树的一道题:单词搜索 IIclass Solution { //构建前缀树 + dfs 深度遍历字符数组,然后和前缀树比较 //定义节点 static class TireNode{ //使用map 还是 数组 ...

2020-02-26 10:40:51 89

原创 211. 添加与搜索单词 - 数据结构设计

class WordDictionary { //使用什么来存储单词 ------>字典树?? //字典树 // 1 新建节点 static class TireNode{ boolean flag ; //记录该单词是否出现 Map<Character, TireNode> childNode; ...

2020-02-25 21:57:01 102

原创 和为S的连续正数序列

public ArrayList<ArrayList<Integer> > FindContinuousSequence(int target) { ArrayList<ArrayList<Integer> > ans = new ArrayList<>(); int l = 1; int h = l+1; ...

2019-12-18 22:38:09 62

原创 leetcode62,63路径问题

62: public int uniquePaths(int m, int n) { int[][] dp = new int[m][n];//dp代表能走到当前点路径数 //初始化第0行边界值 for(int i = 0 ; i < n; i++) { dp[0][i] = 1; } ...

2019-12-16 21:31:37 84

原创 LeetCode61.旋转链表

public ListNode rotateRight(ListNode head, int k) { if(head == null||head.next == null) return head; int count = 0; ListNode l = head; int length =...

2019-12-16 19:20:46 65

原创 leetcode56合并区间

public int[][] merge(int[][] arr) { //根据第一个元素排序,快速排序 if(arr.length == 0) return new int[0][0]; if(arr.length == 1) return arr; boolean[] isvrist...

2019-12-16 09:31:08 64

原创 Leetcode45 跳跃游戏2

贪心算法,每次选能跳最远的 public int jump(int[] nums) { int ans = 0; for(int i = 0 ; i < nums.length ; i = maxjump(i,nums) ) { if(i == nums.length-1) break; ans++; } return a...

2019-12-13 12:42:52 66

原创 LeetCode42:接雨水问题

1,先寻找最高点2,左右两边分别向最高点遍历3,两值相加public int trap(int[] height) { if(height.length == 0)return 0; if(height.length == 1) return 0; int max = height[0]; int maxindex = 0;...

2019-12-13 09:58:21 141

原创 46. 全排列

动态规划class Solution { public List<List<Integer>> permute(int[] nums) { List<List<Integer>> result = new ArrayList<>(); permute(nums , 0 , num...

2019-06-28 21:39:18 90

原创 129. 求根到叶子节点数字之和

class Solution { int result; public int sumNumbers(TreeNode root) { if(root == null)return 0; sumNumber(root, 0); return result; } public void sumNumbe...

2019-06-27 22:53:27 80

原创 验证等差数列

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.*;public class Main{ public static void main(String[] args) throws IOException...

2019-06-24 23:55:48 412

原创 112. 路径总和

//递归 public boolean hasPathSum(TreeNode root, int sum) { if(root == null)return false; if(root.left == null && root.right ==null)return sum == root.val; return has...

2019-06-23 10:19:19 66

原创 leetcode 306. 累加数

class Solution { /** *先确认第一个数和第二个数,其中第三个数必须必第一个数的长度和第二个数的长度要长 *确认第一和第二个数之后,再用递归来验证是否是递增序列 */ public boolean isAdditiveNumber(String num) { //先要确认前两个数 in...

2019-06-22 10:28:38 154

原创 word-break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens =“leetcode”,dict =[“leet”, “code...

2019-06-16 20:43:37 179

原创 leetcode(4)

ZigZag ConversionThe string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H...

2019-01-14 11:40:08 318

原创 leetcode练习(3)

Letter Combinations of a Phone Numberinput&quot;23&quot;output:[“ad”, “ae”, “af”, “bd”, “be”, “bf”, “cd”, “ce”, “cf”]根据题意2代表&quot;abc&quot;,3代表&quot;edf&quot;backtracking(回溯算法)的题目代码:public List&amp;lt;String&am

2019-01-14 11:22:49 107

原创 leetcode练习(2)

Container With Most Water题意:在二维坐标系中,(i, ai) 表示 从 (i, 0) 到 (i, ai) 的一条线段,任意两条这样的线段和 x 轴组成一个木桶,找出能够盛水最多的木桶,返回其容积。代码: int l = 0 ; int r = height.length-1; int max = 0; int h = 0; ...

2019-01-13 22:38:06 99

原创 leetcode练习(1)

题目3. Longest Substring Without Repeating CharactersMedium4543225FavoriteShareGiven a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”...

2019-01-13 15:26:06 91

原创 @快速排序算法(JAVA)(个人复习)

@快速排序算法(JAVA)一趟快速排序过程一趟快速排序代码static int[] arr;public static int quickSort(int l , int h)//一趟快速排序{ int temp = arr[l];//每次去第一个作为支点 while(l &lt; h) { while(l&lt; h &amp;&amp; arr[h] &gt;= temp...

2018-12-01 11:11:03 186

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除