spring boot + Vue + iView前后端分离架构(Mac版) -- (四)后端工程构建_ivew boot-程序员宅基地

技术标签: spring boot  vue  spring boot + vue + iView  

spring boot + Vue + iView前后端分离架构(Mac版) – (四)后端工程构建

小景哥哥博客

一、创建spring boot工程

在我们的hep-admin-web同级下创建后端工程,idea-->file-->new-->module,选中Spring Initializr点击next,安装后续图片步骤操作即可。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、配置pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.huerpu.admin</groupId>
    <artifactId>hep-admin-web-core</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>hep-admin-web-core</name>
    <description>This is Huerpu's admin project.</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!--通用 Mapper-->
        <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-spring-boot-starter</artifactId>
            <version>2.0.4</version>
        </dependency>

        <!--连接池-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.9</version>
        </dependency>
        <!--数据库驱动-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!--分页插件-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.4</version>
        </dependency>

        <!-- swagger插件 -->
        <dependency>
            <groupId>com.didispace</groupId>
            <artifactId>spring-boot-starter-swagger</artifactId>
            <version>1.2.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <!--<version>3.5.1</version>-->
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${org.mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.6</version>
                <configuration>
                    <configurationFile>
                        ${basedir}/src/main/resources/generator/generatorConfig.xml
                    </configurationFile>
                    <overwrite>true</overwrite>
                    <verbose>true</verbose>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>8.0.19</version>
                    </dependency>
                    <dependency>
                        <groupId>tk.mybatis</groupId>
                        <artifactId>mapper</artifactId>
                        <version>4.0.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

三、执行数据库脚本

创建数据库cs,之后执行数据库脚本。包括四门计算机课程表、用户表、权限表、菜单表、学校信息表。
在这里插入图片描述

/*
 Navicat Premium Data Transfer

 Source Server         : Localhost
 Source Server Type    : MySQL
 Source Server Version : 80011
 Source Host           : localhost:3306
 Source Schema         : cs

 Target Server Type    : MySQL
 Target Server Version : 80011
 File Encoding         : 65001

 Date: 02/04/2020 23:55:31
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for hep_cn
-- ----------------------------
DROP TABLE IF EXISTS `hep_cn`;
CREATE TABLE `hep_cn` (
  `cn_id` int(11) NOT NULL,
  PRIMARY KEY (`cn_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='计算机网络(computer networking)课程';

-- ----------------------------
-- Table structure for hep_co
-- ----------------------------
DROP TABLE IF EXISTS `hep_co`;
CREATE TABLE `hep_co` (
  `co_id` int(11) NOT NULL,
  PRIMARY KEY (`co_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='计算机组成原理(Computer Organization and Design)课程';

-- ----------------------------
-- Table structure for hep_ds
-- ----------------------------
DROP TABLE IF EXISTS `hep_ds`;
CREATE TABLE `hep_ds` (
  `ds_id` int(11) NOT NULL,
  PRIMARY KEY (`ds_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='数据结构(data structure)课程';

-- ----------------------------
-- Table structure for hep_menu
-- ----------------------------
DROP TABLE IF EXISTS `hep_menu`;
CREATE TABLE `hep_menu` (
  `menu_id` int(11) NOT NULL,
  `menu_name` varchar(255) DEFAULT NULL,
  `menu_url` varchar(255) DEFAULT NULL,
  `menu_order` varchar(255) DEFAULT NULL,
  `menu_role` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`menu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='菜单表';

-- ----------------------------
-- Table structure for hep_os
-- ----------------------------
DROP TABLE IF EXISTS `hep_os`;
CREATE TABLE `hep_os` (
  `os_id` int(11) NOT NULL,
  PRIMARY KEY (`os_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='操作系统(operating system)课程';

-- ----------------------------
-- Table structure for hep_role
-- ----------------------------
DROP TABLE IF EXISTS `hep_role`;
CREATE TABLE `hep_role` (
  `role_id` int(11) NOT NULL,
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户权限表';

-- ----------------------------
-- Table structure for hep_university
-- ----------------------------
DROP TABLE IF EXISTS `hep_university`;
CREATE TABLE `hep_university` (
  `university_id` int(11) NOT NULL COMMENT '主键',
  `university_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学校名称',
  `university_college` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学院名称',
  `university_exam_basic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '计算机考研公共基础课',
  `university_exam_cs` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '计算机考研专业课',
  `university_exam_interview` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '计算机考研复试内容',
  `university_major_direction` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '计算机主修研究方向',
  `university_coefficient_difficulty` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '考研难度系数',
  `university_academic_professional` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '学硕还是专硕',
  `university_study_period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '研究生学习年限(2年、3年还是2.5年)',
  PRIMARY KEY (`university_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学校信息';

-- ----------------------------
-- Table structure for hep_user
-- ----------------------------
DROP TABLE IF EXISTS `hep_user`;
CREATE TABLE `hep_user` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用户名',
  `user_nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用户昵称',
  `user_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '邮箱',
  `user_mobile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '手机号',
  `user_password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '密码',
  `user_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '地址',
  `user_assign_date` datetime DEFAULT NULL COMMENT '注册时间',
  PRIMARY KEY (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';

SET FOREIGN_KEY_CHECKS = 1;

四、使用mybatis插件快速生成代码

src-->main-->java创建包com.huerpu.admin.web.core,在该目录下创建controllerdaoentityserviceutil工程结构目录。在src-->main-->resources-->generator下创建配置文件generatorConfig.xml,其内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
        <property name="beginningDelimiter" value="`"/>
        <property name="endingDelimiter" value="`"/>
        <plugin type="tk.mybatis.mapper.generator.MapperPlugin">
            <property name="mappers" value="tk.mybatis.mapper.common.Mapper"/>
            <!-- 是否区分大小写,默认值 false -->
            <property name="caseSensitive" value="true"/>
            <!-- 是否强制生成注解,默认 false,如果设置为 true,不管数据库名和字段名是否一致,都会生成注解(包含 @Table 和 @Column) -->
            <property name="forceAnnotation" value="true"/>
        </plugin>
        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/cs?characterEncoding=utf-8"
                        userId="root"
                        password="123456">
        </jdbcConnection>
        <javaModelGenerator targetPackage="com.huerpu.admin.web.core.entity" targetProject="src/main/java">
        </javaModelGenerator>
        <sqlMapGenerator targetPackage="mybatis/mapper" targetProject="src/main/resources" />
        <javaClientGenerator targetPackage="com.huerpu.admin.web.core.dao" targetProject="src/main/java"  type="XMLMAPPER"/>
        <table tableName="hep_cn" domainObjectName="Cn" mapperName="UserDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="cnId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_co" domainObjectName="Co" mapperName="CoDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="coId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_ds" domainObjectName="Ds" mapperName="DsDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="dsId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_menu" domainObjectName="Menu" mapperName="MenuDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="menuId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_os" domainObjectName="Os" mapperName="OsDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="osId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_role" domainObjectName="Role" mapperName="RoleDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="roleId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_university" domainObjectName="University" mapperName="UniversityDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="universityId" sqlStatement="JDBC"/>
        </table>
        <table tableName="hep_user" domainObjectName="User" mapperName="UserDao">
            <!-- 字段属性是否驼峰展示,true为驼峰展示 -->
            <property name="useActualColumnNames" value="true"></property>
            <generatedKey column="userId" sqlStatement="JDBC"/>
        </table>
    </context>
</generatorConfiguration>

打开idea右侧的maven,找到mybatis-generator,双击运行。就会看到我们的entity、dao、mapper底下会生成文件,则说明插件已经帮助生成了我们想要的代码了。
在这里插入图片描述

五、配置mybatis

修改工程入口程序HepAdminWebCoreApplication如下:

package com.huerpu.admin.web.core;
import com.didispace.swagger.EnableSwagger2Doc;
import tk.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableSwagger2Doc
@MapperScan("com.huerpu.admin.web.core.dao")
public class HepAdminWebCoreApplication {
    
    public static void main(String[] args) {
    
        SpringApplication.run(HepAdminWebCoreApplication.class, args);
    }
}

src-->main-->resources下创建文件application.yml、application-dev.yml,二者内容分别如下:

application.yml

spring:
  profiles:
    active: dev

mybatis:
  mapper-locations: classpath:mybatis/mapper/*.xml

pagehelper:
  helperDialect: mysql
  reasonable: true

application-dev.yml

server:
  port: 80

# 配置日志信息
logging:
  level:
    root: INFO
    com.huerpu.admin.web.core: DEBUG

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/cs?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      filters: stat
      maxActive: 20
      initialSize: 1
      maxWait: 60000
      minIdle: 1
      timeBetweenEvictionRunsMillis: 60000
      minEvictableIdleTimeMillis: 300000
      validationQuery: select 'x'
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      maxOpenPreparedStatements: 20

swagger:
  title: 上海沪尔浦考研股份有限公司
  description: 沪尔浦拥有最终解释权
  base-package: com.huerpu.admin.web.core.controller
  contact:
    name: 小景哥哥
    email: [email protected]

六、User保存逻辑

接下来我们写一个保存User类的验证逻辑,包括UserController、UserService。

UserService:

package com.huerpu.admin.web.core.service;

import com.huerpu.admin.web.core.dao.UserDao;
import com.huerpu.admin.web.core.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    

    @Autowired
    private UserDao userDao;

    public void save(User user){
    
        userDao.insert(user);
    }

}

UserController:

package com.huerpu.admin.web.core.controller;

import com.huerpu.admin.web.core.entity.User;
import com.huerpu.admin.web.core.service.UserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    

    @Autowired
    private UserService userService;

    @ApiOperation(value = "Find Hep user lists")
    @PostMapping("save")
    public void getUserLists(User user){
    
        userService.save(user);
    }
}

启动项目:
在这里插入图片描述
在这里插入图片描述

访问http://127.0.0.1/swagger-ui.html#!/user45controller/getUserListsUsingPOST地址,输入保存的参数,点击try it out,返回结果为200证明保存成功,成功之后去数据库核实数据即可。如果有数据,则说明我们的工程构建成功。
在这里插入图片描述
在这里插入图片描述

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/JingLisen/article/details/105308775

智能推荐

Vue Router-配置路由文件_van-tabbar keep-alive-程序员宅基地

文章浏览阅读5.1k次,点赞2次,收藏7次。Vue RouterNPM安装:npm install vue-router在一个工程化的项目中,我们通常在src文件下单独创建一个router文件夹,来保存各类路由的相关配置。如在router文件夹下,创建一个index.js文件,管理项目的各类路由配置。import Vue from "vue"import Router from "vue-router"Vue.use(Router);//引入一级路由import DashBoard from "./../views/dashboar_van-tabbar keep-alive

Eclipse上安装CDT插件_org.eclipse.cdt-程序员宅基地

文章浏览阅读993次。之前一直将Eclipse作为Java的集成开发环境来使用,最近在学习C++,发现Eclipse可通过安装CDT(C/C++ Development Tooling)插件支持C++的开发,于是昨天按照网上的教程在eclipse上安装CDT插件和MinGW(Minimalist GNU on Windows),安装过程中遇到了几个问题。1、_org.eclipse.cdt

FLEX表单验证带重置功能<WEB用户体验>_web验证重置按钮是否清楚另一form-程序员宅基地

文章浏览阅读1.4k次。有用的校验方法必须最低限度的也要支持富因特网应用程序的用户界面设计原则。1.防患于未然,而不是事后责备。校验错误的表单不应该被用户提交。防止,不责骂原则的意思是,能够准确无误的放置用户犯错误,那么就应该那么做,而不是允许他们犯错误,而事后责备他们。当做客户端校验时,明显的违反这一原则的情况是,当用户已经提交完整个表单以后,校验用户的输入数据。在Flex应用程序中,你可以创建一个行为,触_web验证重置按钮是否清楚另一form

用Linux Shell实现FTP上传文件并确认是否成功功能-程序员宅基地

文章浏览阅读894次。############################################ ## Date:2013/05/10 ## Author:Andy_Leung ## Funct..._if [ -s ${runlog} ]

目标跟踪配置(三)-评价指标-benchmark(更新中,关注请收藏。。。)_vot-tir15标注-程序员宅基地

文章浏览阅读3.5k次,点赞2次,收藏23次。开端介绍VOTVOT13、VOT14、VOT15、VOT16,每一次都有很大变化,VOT13只有16组序列,而当时OTB-50刚刚出来,所以VOT13没多大影响力,VOT14比VOT13增加样本集至25组,并且重新标注了样本,选取多边形区域进行标注,能反映出OTB反映不了的问题,这才收到大家的关注,不过大家当时还是看OTB多一些。VOT15扩充样本集至60组,并开设了tir热成像跟踪子系列,其评价方法也有改变,VOT15开始火起来了。到VOT16,没有对样本集做修改,只是使用了自动标注样本的方法对样本重_vot-tir15标注

builder模式 c++_c++ builder模式-程序员宅基地

文章浏览阅读1.6k次。builder模式:对象创建型模式意图:将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。适用性:1 当创建复杂对象的算法应该独立于该对象的组成部分以及它们的装配方式时。2 当构造过程必须允许被构造的对象有不同的表示时参与者:Builder: 为创建一个Product对象的各个部件指定抽象接口ConcreteBuilder:实现Builder 的_c++ builder模式

随便推点

vscode运行helloworld.java程序_vscode java helloworld-程序员宅基地

文章浏览阅读3.1k次,点赞5次,收藏13次。摘要:常见的开发java程序的IDE有很多种,本文推荐vscode来运行一些简单的java程序,例如helloworld。只需要简单的几步,就可以使vscode运行helloworld.java。老生常谈,但是本文尽量带给您一些不一样的知识。版本Version: 1.45.1 OS: Windows_7 x64 。_vscode java helloworld

ubuntu14.04 nginx-rtmp-module 配置_./configure --with-http_ssl_module --add-module=/p-程序员宅基地

文章浏览阅读368次。http://blog.csdn.net/longji/article/details/5486535800 ubuntu14.04 ecs 配置nginx-rtmp-module参考:http://www.cnblogs.com/cocoajin/p/4353767.html01 安装 nginx 和 nginx-rtmp 编译依赖工具sudo_./configure --with-http_ssl_module --add-module=/path/to/nginx-rtmp-module找

Cesium相关3D数据简介_b3dm和3dtiles区别-程序员宅基地

文章浏览阅读8k次,点赞6次,收藏28次。Cesium的数据格式主要是3DTiles,3DTiles由tileset.json和tile组成,其中tale可以是.b3dm、.i3dm、.pnts、.vctr和.cmpt中的任一种格式文件。此外Cesium还支持其它3D格式,包括glTF、glb、Quantized-mesh(.terrain)等,支持其它数据向3DTiles格式的转换后加载,包括obj、BIM等。3DTiles3DT..._b3dm和3dtiles区别

(4.0.23.11)Viewpager与FragmentStatePagerAdapter重刷数据引发的源码分析和原生缺陷解决方案_fragmentstatepageradapter +recycleview-程序员宅基地

文章浏览阅读296次。文章目录一、问题二、源码分析2.1ViewPager#dataSetChanged2.1.1 ArrayList.ViewPager.ItemInfo. mItems2.1.2 Adapter.getItemPosition(ii.object)2.3 什么时候触发PagerAdapter#instantiateItem2.3.1 populate()2.4 FragmentStatePagerAdapter解决方案方案一:不可行方案二:可行方案三:可行参考文献一、问题public class Feed_fragmentstatepageradapter +recycleview

一周极客热文:3月,献给程序员们的技术书_计算机大师dijkstra谈haskell和java | 外刊it评论-程序员宅基地

文章浏览阅读585次。6一周极客热文:3月,献给程序员们的技术书文章由钱曙光于19小时前分享 评论(14)一周极客热文程序员  北京的雾霾刚刚过去,小编便开始埋头做三月书讯了。《算法谜题》 经典算法谜题的合集 Google、Facebook等一流IT公司算法面试必备《Hadoop实战手册》 快速解决诸多Hadoop相关技术问题的实用技术手册《趣学Python编程》_计算机大师dijkstra谈haskell和java | 外刊it评论

使用gson报错:com.google.gson.stream.MalformedJsonException: Expected value at line 1 column 9 path $-程序员宅基地

文章浏览阅读4.7k次。gson 转换中的错误:1.转换Map对象时,值为空时,报错 com.google.gson.stream.MalformedJsonException: Expected value at line 1 column 9 path $ Gson gson=GsonBuilder().serializeSpecialFloatingPointValues().setLenient().setD..._com.google.gson.stream.malformedjsonexception: expected value at line 1 colu