Ray's Blog

别来无恙啊,


  • Home

  • About

  • Tags

  • Categories

  • Archives

  • Search

Idea常用插件

Posted on 2018-12-01 | In IDEA | | Visitors:

插件安装

Mac 安装

打开IDEA:IntelliJ IDEA - Preferences… - Plugins

Windows 安装

打开IDEA:File - Settings… - Plugins

1、搜索选择自己想要安装的插件,下载安装并重启idea客户端即可。
2、已经安装的插件默认是启用(☑️)状态,如果要禁用某个插件,只用去除勾选,点击应用并保存,同样也需要重启生效。

Read more »

java中带下划线命名和驼峰命名互相转换

Posted on 2018-11-16 | In Java | | Visitors:

Java中带下划线命名和驼峰命名互相转换

  项目开发过程中经常会遇到页面上传回来的参数或者请求接口返回的参数是带下划线的,所以需要对参数进行转换以方便我们的使用,在这里记录下下划线命名和驼峰名相互转换。

驼峰转换为下划线

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

public static String underscoreName(String camelCaseName) {
StringBuilder result = new StringBuilder();
if (camelCaseName != null && camelCaseName.length() > 0) {
result.append(camelCaseName.substring(0, 1).toLowerCase());
for (int i = 1; i < camelCaseName.length(); i++) {
char ch = camelCaseName.charAt(i);
if (Character.isUpperCase(ch)) {
result.append("_");
result.append(Character.toLowerCase(ch));
} else {
result.append(ch);
}
}
}
return result.toString();
}
Read more »

SpringBoot 整合 Redis 使用详解

Posted on 2018-11-14 | In Java , SpringBoot | | Visitors:

SpringBoot 整合 Redis 使用详解(StringRedisTemplate 和 RedisTemplate 对比分析)

SpringBoot整合redis的详细过程,以及部分源码分析

前期准备

首先保证安装好redis,并开启远程访问权限(最好配置密码)

pom.xml添加依赖:

1
2
3
4
5

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
Read more »

Vue监听路由变化

Posted on 2018-11-08 | In Vue | | Visitors:

Vue 监听页面路由变化

  最近使用Vue页面开发,遇到了两个路由同时共用一个页面,发现页面路由发生改变时页面不会跟着刷新,经过一番资料查阅发现可以利用Vue中 watch 来监听路由,记录下来当作记笔记了。

监听路由上一个页面和跳转页面

1
2
3
4
5
6
7

watch:{
$route(to,from){
console.log(from.path);//上一个页面
console.log(to.path);//跳转页面
}
}
Read more »

Idea下lombok安装和使用

Posted on 2018-11-07 | In IDEA | | Visitors:

IDEA下lombok安装和使用

  项目中经常会有Bean或者Entity,需要构造get、set、toString、equals等方法, 使用lombok注解的方式,就不需要手动编写或使用其他工具生成get/set等方法,很大程度上减少了代码量,而且减少了代码维护的负担。
常用的注解有@Setter,@Getter,@ToString,@NotNull,@EqualsAndHashCode,@Data等。

lombok 的安装

打开idea的设置Preferences,选择Plugins在Browse Repositories中搜索lombok

Read more »

Java注解之@Target、@Retention、@Documented介绍

Posted on 2018-11-02 | In Java | | Visitors:

Java注解之@Target、@Retention、@Documented介绍

如下Spring中的一个常用注解@Controller代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

package org.springframework.stereotype;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Indicates that an annotated class is a "Controller" (e.g. a web controller).
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @since 2.5
* @see Component
* @see org.springframework.web.bind.annotation.RequestMapping
* @see org.springframework.context.annotation.ClassPathBeanDefinitionScanner
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Controller {

/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
String value() default "";

}

Read more »
123
Ray Zhang

Ray Zhang

14 posts
9 categories
13 tags
GitHub WeiBo ZhiHu
Other websites
  • Rayboo
© 2019 Ray Zhang
0%