Home>

Environment setup

Introduction to spring boot

In the past, we always used Spring to avoid tedious configuration when developing.For example we want to configure a database connection,The following steps may be required:

1. Write jdbc.properties configuration file;

2. Create a spring configuration file.Add spring configuration file prefix, configuration database connection information, sqlsessionfactory, etc .;

3. Also add spring listener to the web.xml file.

The emergence of springboot greatly simplified the process of building the project (spring configuration and maven configuration), let us focus on the development of application functions,Rather than wasting time on configuration files or troubleshooting them,Greatly improve development efficiency.

Springboot creates a stand-alone spring application, uses the embedded tomcat, and runs it in a jar file format after packaging.And you can specify some parameters at runtime,This will be mentioned in a later note.

mybatis

Mybatis will not elaborate here.Friends who want to know can search their tutorials by themselves

vue.js

vue.js (pronounced/vjuː/, similar to view) is a progressive framework for building user interfaces.Unlike other heavyweight frameworks,vue uses a bottom-up incremental development design.vue's core library only focuses on the view layer,And very easy to learn,Very easy to integrate with other libraries or existing projects.on the other hand,vue is fully capable of driving complex single-page applications developed with single-file components and libraries supported by the vue ecosystem.

The goal of vue.js is to implement responsive data binding and combined view components through APIs that are as simple as possible.

The above is taken fromvue official website

elementui

This is a set of front-end UI provided by Hungry, with rich components.Details

Next, introduce new idea of ​​springboot project and build development environment.

Select new project

Fill in the basic information

Select the required module

Finish creating

Configure application.yml, delete the properties file generated during initialization, and create a new application.yml file. Properties files are not recommended for configuration here

Add the following configuration:

spring:
 profiles:
 active:develop
 datasource:
 driver-class-name:com.mysql.jdbc.driver
 url:jdbc:mysql://localhost:3306/dh
 username:root
 password:123456

Create a new controller class:

@restcontroller
public class usercontroller {
 @getmapping (value="getusername")
 public string getusername (string callback) {
 return "admin";
 }
}

Then we start the springboot project, that is, run demoapplication.java, the default port is 8080, we open the browser to access:

Recommended topics for reading:

  • Previous How to use trim tags in MyBatis dynamic SQL
  • Next Script sharing for network testing using Python