preface

Small make up recommend a few to chop for everyone today hand plug-in, is really practical, installation is a step in the right, at work, we may often because the coding efficiency, and the worry, may sometimes not our coding efficiency is not high, just we use the method of no use to good tools, can save our development time, this is the small make up in development using some of the plugin. So I recommend it to you.


Lombok plug-ins

The Lombok project is a Java library that automatically plugs into your editor and build tools to make your Java more interesting. Never write another get, set, or equals method. An annotation will help your class have a full-fledged generator that automatically generates your GET, set, and so on.

1, install,

2, use,

2.1 Common annotation @data

@Data
public class Employee {

    /** * Employee id */
    private Integer id;

    /** * Employee name */
    private String name;

    /** * Employee gender */
    private Integer age;

    /** * Employee gender */
    private Integer sex;
}
Copy the code

Use @data annotation to generate Get, Set, ToString and other methods by default.

2.1 Used separately for methods

Of course, you can also use the method alone, as follows:

@Setter
@Getter
@ToString
Copy the code

2.3 Structures with and without parameters

@AllArgsConstructor
@NoArgsConstructor(force = true)
Copy the code

Here’s how to use @noargsconstructor with no arguments:

@noargsconstructor (force = true) @noargsconstructor (force = true) Lombok then sets default values 0 / false/NULL for uninitialized final fields, so the compiler does not report an error

For example, if we have a field that is final and there is no default value set, we want to assign it to the field using the set method:

@Data
@AllArgsConstructor
@NoArgsConstructor(force = true)
public class Employee {

    final Integer userId;

    /** * Employee id */
    private Integer id;

    /** * Employee name */
    private String name;

    /** * Employee gender */
    private Integer age;

    /** * Employee gender */
    private Integer sex;
}
Copy the code
final Integer userId;
Copy the code

UserId final = userId final = userId final = IDEA

And then using the set method to assign the value is also perfectly OK.

public static void main(String[] args) {
    Employee employee = new Employee(1.1.null.18.1);
    System.out.println(employee);
}
Copy the code

Print result:

Second, the Vuesion Theme

2.1 installation

2.2 Application Effect

This theme is my favorite, not fancy, very good for the eyes, also not particularly dazzling kind, in short, strongly recommend !!!! With her, the development of happiness ah !!!!!!!!!!!

Third, MybatisX

3.1 installation

3.2 the use of

For example, we want to see the SQL code of mapper. Xml, just click on this little penguin can jump to the past, especially convenient, mainly because this little penguin is cute !!!!

3.3 use

A lot of times, we’re going to have to write SQL because the entity class fields are right, so how do I quickly generate SQL with MybatisX?

Step 1: Connect to the database

The following error may be reported:

Here’s a quick fix: Just add the time zone parameter to the end of the connection.

? ServerTimezone = GMT % 2 b8 or? serverTimezone=GMTCopy the code

Step 2: Write the SQL statement

After selecting the language and setting it, let’s test the shortcut to generate fields:

Let’s enter the first field, id, and then you will be prompted, click on the entity you want to generate all the fields.

In addition, JOIN, LEFT JOIN and so on, as follows:

Four, json view

4.1 installation

4.2 the use of

The front and back ends are separated. We back-end programmers interact with the data in JSON format. For example, we query the employee information of the whole company and return JSON.

public static void main(String[] args) {
        // Simulation query employee data
        List<Employee> list = new ArrayList<>();
        list.add(new Employee(1."Zhang".18.1));
        list.add(new Employee(2."Bill".19.1));
        list.add(new Employee(3."Fifty".20.2));
        list.add(new Employee(4."DT".21.2));
        // Convert to JSON output
        System.out.println(JSON.toJSONString(list));
    }
Copy the code
[{"age":18."id":1."name":"Zhang"."sex":1}, {"age":19."id":2."name":"Bill"."sex":1}, {"age":20."id":3."name":"Fifty"."sex":2}, {"age":21."id":4."name":"DT"."sex":2}]
Copy the code

If there is a large amount of data and it is difficult for us to view some values, then we need to find some online tools to format them. We want to quickly view the json view arrangement:

POJO TO JSON

5.1 installation

5.2 the use of

Json view, can improve the development of testing efficiency, the following small editor also feel very good, is also to improve our testing efficiency, or before and after the separation, such as we need to according to the employee name, age, gender, department, and so on a lot of fields for matching retrieval, We generally back-end friends will use PostMan TO test our own interface, that this field is too much, paste are a waste of time, you have TO a field are self test, the manager will let you, do not want TO paste so slow, quick paste method, POJO TO JSON go you.

Cool, I think this is particularly applicable, for example, you have to add employees, modify employee methods, etc., a whole bunch of parameters, it is not much faster.

Alibaba Java Coding Guidelines

6.1 installation

6.2 the use of

Of course, as a programmer, your code can not be too personality, right, everyone can read the code is good code, so for personal code specification is very important, xiaobian company will have code approval every week, uncomfortable ah, so have to show a good hand.

We can open the real-time scanning of code, real-time monitoring of the code we write, whether no and specification, can also do code scanning, see where our code is not standard.

conclusion

Things do not need too much, enough, good enough, today xiaobian recommended these several plug-ins, in the daily work development is particularly applicable, so share to everyone. The next article will continue to share some advanced use of common Java tool libraries, such as Hutool. Another small make up a Java stack technology ac group, like friends can enter below group no. Add group, later the source of the resources for this group, small make up trend of technology such as using the micro service set up a project, do a lot of knowledge, as well as front end the VUE technology, etc., the subsequent version online, will also push the new trend of the technology in the group of Shared with everybody.

JAVA Full-stack technology: Group Number 176251012 “CSDN blog :blog.csdn.net/qq_41107231