Yuanchuang Call for Papers|Java development tools, from environment to development, one article is enough!


1. Background of the article

Excellent development tools and project management tools can facilitate the orderly development process and alleviate problems such as conflicts caused by multi-person collaborative development encountered during the development process. It can also allow young partners who have just joined the job to quickly build a Java environment, without having to look for tutorials one by one.

2. Environment/Development Tools

(1) Install Docker

1. Enter docker official website to download docker,
insert image description here
find the corresponding system download version and click download

2. After the download is complete, double-click the installation package to install it
insert image description here

(2) Configure Docker Ali image accelerator

Alibaba Mirror Accelerator
Docker Toolbox
1. Open docker
2.Settings
3.Docker Engine
4. Add the following columns in the json text (to comply with the json specification)

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "registry-mirrors": [
    "https://p9yals3y.mirror.aliyuncs.com"
  ]
}

(3) Use docker to run Mysql 8

mkdir -p /data/docker/mysql/{
    
    data,logs,conf}
# 复制配置文件到 conf 下,并修改所有者或者权限
docker run --name=mysql_dev_8 --restart=always  \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=mysql_dev  \
-e TZ=Asia/Shanghai \
-v mysql_dev_data_8:/var/lib/mysql \
-v mysql_dev_logs_8:/logs \
-v mysql_dev_conf_8:/etc/mysql/conf.d  \
-d -p3306:3306 mysql:8 \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci

Note: It needs to be formatted into a code

(4) Run Redis with Docker

docker run --name redis_dev --restart=always -d -p6379:6379 redis:latest redis-server --requirepass redis_dev

Modify the configuration file

  • Remote connection redis
    comment bind 127.0.0.1
    modify protected-mode yes to protected-mode no

  • Set password
    Add requirepass yourpassword

  • start command

 mkdir -p /data/docker/redis/{
    
    data,conf}
 #复制配置文件到 conf 下,并修改所有者或者权限

docker run -d --name redis --restart=always --privileged=true \
-p 6379:6379 \
-v /data/docker/redis/conf/redis.conf:/etc/redis/redis.conf \
-v /data/docker/redis/data:/data \
redis:5.0.7 \
redis-server /etc/redis/redis.conf \
--appendonly yes

Note: It is more convenient to download Windows Powershell

(5) Database management tools

1. Navicat can connect to a variety of databases, such as: mysql, sqlServer, oracle, etc.
insert image description here
Disadvantages:
This tool needs to be purchased, and the trial period is 14 days

Advantages:
It can synchronize the database data and structure of the development environment and the test or production environment,
can do data model design and directly generate table structure

IDEA's own database tool
insert image description here
visualization is not as good as the former, and it is not so friendly to beginners.

2. Another Redis Desktop Manager and RedisDesktopManager both manage the redis database, and the former has a more beautiful ui interface.

insert image description hereinsert image description here

(6) Interface testing tool

1. Swagger (interface document)
is the most popular API framework at present. The interface document is generated online to avoid the trouble of synchronization and can support online testing of the interface.
insert image description here

1. Introduce the jar package in the pom.xml file (the specific version depends on your own project, I use swagger2x)

 <!--  swagger-ui  -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>swagger-annotations</artifactId>
                    <groupId>io.swagger</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>swagger-models</artifactId>
                    <groupId>io.swagger</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.5.22</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-models</artifactId>
            <version>1.5.22</version>
        </dependency>

2. Create a configuration

@Configuration
@EnableSwagger2
@ConditionalOnProperty(prefix = "swagger2",value = {
    
    "enable"},havingValue = "true")
public class Swagger2 implements WebMvcConfigurer {
    
    

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    
    
        registry.addResourceHandler("**/swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars*")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }

    @Bean
    public Docket platformApi() {
    
    
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).forCodeGeneration(true)
                .select().apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                //扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.example.demo.controller"))
                //扫描所有包
//				.apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                .securitySchemes(securitySchemes())
                .securityContexts(securityContexts());
    }


    private List<ApiKey> securitySchemes() {
    
    
        List<ApiKey> apiKeyList = new ArrayList<>();
        apiKeyList.add(new ApiKey("token", "token", "header"));
        return apiKeyList;
    }

    private List<SecurityContext> securityContexts() {
    
    
        List<SecurityContext> securityContexts = new ArrayList<>();
        securityContexts.add(
                SecurityContext.builder()
                        .securityReferences(defaultAuth())
                        .forPaths(PathSelectors.any())
                        .build());
        return securityContexts;
    }

    private List<SecurityReference> defaultAuth() {
    
    
        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
        authorizationScopes[0] = authorizationScope;
        List<SecurityReference> securityReferences = new ArrayList<>();
        securityReferences.add(new SecurityReference("token", authorizationScopes));
        return securityReferences;
    }

    //构建 api文档的详细信息函数,注意这里的注解引用的是哪个
    private ApiInfo apiInfo() {
    
    
        return new ApiInfoBuilder()
                //页面标题
                .title("JAVA-API")
                //描述
                .description("JAVA-API接口文档")
                //创建人
                .contact(new Contact("xxx", "https://www.baidu.com/", "[email protected]"))
                //版本号
                .version("1.0")
                .build();
    }

}

3. Write the corresponding annotation in the corresponding controller
insert image description here

2. Postman
insert image description here
postman is a software, test engineers will be more useful

3. Apipost
insert image description here
ApiPost is a very powerful tool that supports the simulation of common HTTP requests such as POST, GET, and PUT, supports team collaboration, and can directly generate and export interface documents for API documentation, debugging, mocking, and testing. Simply put:
ApiPost = Postman + Swagger + Mock
The original intention of ApiPost is to improve the efficiency of each role of the R&D team! The audience of the product is the entire R&D technical team composed of front-end development, back-end development and testers, and technical managers. ApiPost integrates each role of the R&D team through the collaboration function.

(7) Code version management tool

It supports GitHub, Gitee and other warehouse management
ideas, integrates git, and has rich operations such as branch, commint, add, pull, push, etc.
insert image description here
insert image description here
insert image description here
2. SVN is the abbreviation of subversion, which is an open source version control system. The efficient management of the system, in short, is used for multiple people to jointly develop the same project, share resources, and finally achieve centralized management.
insert image description here

(8) Remote connection tool

FinalShell, MobaXterm, XShell, secureCRT, Putty
insert image description hereinsert image description here
1.FinalShell can see the usage of cpu, memory, switch
insert image description here
2.MobaXterm
is very powerful, supporting SSH, FTP, serial port, VNC, X server and other functions. Support tags, switching is also very convenient

3. XShell
Xshell is a powerful security terminal simulation software with simple interface design and easy to use. It supports SSH1, SSH2, and TELNET protocol of Microsoft Windows platform.

4.secureCRT
SecureCRT supports SSH, as well as Telnet and rlogin protocols. SecureCRT is an ideal tool for connecting and running Windows, UNIX and VMS, and supports sending multiple sessions at the same time.

5.Putty
PuTTY is a Telnet/SSH/rlogin/pure TCP and serial connection software. Earlier versions only supported the Windows platform.

Guess you like

Origin blog.csdn.net/wml_JavaKill/article/details/127610006