IDEA和后台创建

473 阅读1分钟

idea 下载:IntelliJ IDEA

启动:bin/idea.sh (启动过程可以设置添加桌面启动图标)

添加桌面启动方式

首先从/usr/share/applications/目录下随便拷贝一个文档到桌面 用vim打开拷贝来的文件,对内容修改如下

----------

#!/usr/bin/env xdg-open

[Desktop Entry]

Name=IDEA

GenericName=IDEA

Comment=java ide

Exec=/home/cc/idea/bin/idea.sh

Icon=/home/cc/idea/bin/idea.png

Terminal=false

Type=Application

Categories=System;Settings;

----------

创建spring-boot项目

File->create->project->spring Initializr

注意:如果没有,settings -> Plugins搜索安装spring boot 或 Spring Assistant,可参看博客

关闭 IntelliJ IDEA 项目参考w3c

关闭唯一打开的项目时,将显示 "欢迎" 屏幕。在多个项目的情况下,每个项目都被关闭。 在主菜单上选择文件| 关闭项目(File | Close Project)。

运行项目(三种编译方法): 方法一博客

点击LoginApplication,点击run菜单下的run,再点击图中框出的选项,启动项目

刷新依赖:

maven-update

---点击工程(右键)----选择刷新(refresh)----就会自动下载相应的jar包(这种情况一定要联网)或者直接加载进去本地库中的jar包。

结合mybatis

1.配置依赖

<dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>1.0.0</version>
    </dependency>

2.springboot启动类,增加Mybatis扫描注解

连接mysql方法二:www.jb51.net/article/127…

vue.js打log报错,在根目录创建.eslintrc.js文件,加入

module.exports = {
  extends: ['plugin:vue/essential', 'airbnb-base'],
  rules: {
    'no-console': 'off',
    "allowNamedFunctions": true,
    "allowUnboundThis": false
  },
};

后两个是发ajax请求报的错,参考

解决跨域:

this.$ajax.get('http://172.20.48.93:8080/hello/hello', {
        params: data,
        headers: {
          'X-Requested-With': 'XMLHttpRequest',
          'Content-Type': 'application/json; charset=UTF-8',
          'Access-Control-Allow-Origin': '*',
        },
      }).then(result => {
        console.log(result.data);
        this.tableData = result.data;
      });

后台加@CrossOrigin

@CrossOrigin
@RestController
@RequestMapping("/hello")
public class HelloController {

解决乱码问题:

application.properties配置:
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/xxx?useUnicode=true&characterEncoding=UTF-8 
spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=utf-8

多数据源配置: www.cnblogs.com/zhuxiaojie/…