pagehelper

Spring Boot 2.0 常见问题总结(二)

匿名 (未验证) 提交于 2019-12-02 23:55:01
使用 IDEA 生成 POJO 实体类 a. 使用 idea 连接上需要操作的数据库。 b. 选中要生成实体类的数据库表:右键 ---> Scripted Extensions ---> Generate POJOs.groovy。 c. 在弹出的窗口选择生成的位置即可。 application.properties 属性自动映射实体类配置 a. 在 application.properties 文件中定义的属性如下 wxpay.appid=wx5beac15ca207cdd40c wxpay.appsecret=5548012f33417fdsdsdd6f96b382fe548215e9 b.使用 @PropertySource(value = "classpath:application.properties") 即可。 @Getter @Setter @Configuration @PropertySource(value = "classpath:application.properties") public class WeChatConfig { @Value("${wxpay.appid}") private String appId; // 公众号 appid @Value("${wxpay.appsecret}") private String appsecret

分页助手PageHelper

匿名 (未验证) 提交于 2019-12-02 23:49:02
1、pageHelper环境搭建 <!--PageHelper依赖引入--> <dependency> <groupId> com.github.pagehelper </groupId> <artifactId> pagehelper </artifactId> <version> 5.1.2 </version> </dependency> 2、配置文件:配置的是mybatis的pageHelper插件,mybatis插件已集成spring配置文件中  第一种:直接在spring配置文件中进行书写 <bean id = "sqlSessionFactory" class = "org.mybatis.spring.SqlSessionFactoryBean" > <property name = "dataSource" ref = "dataSource" ></property> <!--mybatis 其它配置--> <property name = "plugins" > <array> <bean class = "com.github.pagehelper.PageInterceptor" > <property name = "properties" > <props> <!-- 分页的相关配置参数 用哪个数据库--> <prop key =

Missing artifact com.github.pagehelper:pagehelper:jar:3.4.2-fix的解决方法

匿名 (未验证) 提交于 2019-12-02 23:47:01
使用pagehelper.3.4.2.jar时报错,应该是无法从网络上下载该jar。 我的解决方案是: 从网络上下载一个pagehelper.3.4.2.jar包,然后复制到.m2目录中 如我的目录是C:\Users\xx\.m2\repository\com\github\pagehelper\pagehelper\3.4.2-fix,然后重启eclipse就可以了。 下载地址: 链接: https://pan.baidu.com/s/1Pgw3h80VPhKJUbEMkq-VIA 提取码: 9vx6 。 转载:https://www.cnblogs.com/liaoxiaolao/p/10121022.html

Spring Boot 集成 PageHelper

匿名 (未验证) 提交于 2019-12-02 23:40:02
配置一:在 【pom.xml】 文件中引入依赖 <!-- mybatis的分页插件 --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.10</version> </dependency> 配置二:在 【application.properties】 文件中配置 pagehelper pagehelper.helperDialect=mysql pagehelper.reasonable=true pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql 使用示例: package com.huang.pims.family.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.huang.pims.family.model.FamilyMember; import com.huang.pims.family.service

基于SSM框架的在线考试系统

匿名 (未验证) 提交于 2019-12-02 23:38:02
因为这是一个个人项目,由于我对于js数据处理不了解,所以没有像之前开发项目那样采用前后台分离模式,使用ajax进行数据交互,而是采用了传统的jsp方式,后台将数据传给jsp,jsp中使用jstl标签和el表达式将数据进行呈现。 开发工具为Intellij Idea2018,使用的SSM(Spring,SpringMVC,Mybatis)的框架来搭建项目的服务器后台环境,前台技术主要为css,jsp,简单js。 因为我平时主要是以web后端开发为主,所以本篇博客主要是讲解后台功能实现以及遇到的一些问题。 我将从以下几个角度介绍这篇博客: 1. 功能演示 2. 后台代码分析 github源码地址; https://github.com/LeonP3ng/-onlineExam 这是项目上线访问地址: https://rammsteinlp.cn/onlineExam/index.jsp 这是项目包的分层截图,采用的是mvc形式,后台主要有control,service,entity,dao这四个主要的包,以及filter,util其他一些包, resources主要放资源文件,包括mybatis的xml的文件和spring容器的配置文件,还有jdbc配置文件。 功能主要有用户登录注册,学生参与考试并统计分数,老师对于试题库内容进行增删改查这三大功能。 用户登录模块,

记一次SSM项目小结(一)

匿名 (未验证) 提交于 2019-12-02 23:03:14
记一次SSM项目小结(一) ssm框架 环境配置 服务器配置 解决方法 拦截器重定向到localhost nginx和tomcat中session失效 mybatis的xml文件不生效 数据库用户创建、权限、及远程连接 pagehelper配置报错 百度情感倾向分析接口使用 拦截器重定向的问题,拦截器重定向到到了localhost 当把代码上传到服务器后,登录拦截器进行重定向,然后重定向到了localhost 解决办法:将重定向为绝对网址 1544881869038 1544881921624 这样的话,拦截器进行重定向就不会重定向到localhost nginx和tomcat之间session的问题 不进行session的nginx的文件配置,可以参考以前 博客 ,如果仅仅进行这样配置,session会失效 server { listen 80; server_name 域名; // 文件地址 root /usr/tomcat/apache-tomcat-8.5.35/webapps/xxx; charset utf-8; location / { // 转发地址 proxy_pass http://127.0.0.1:8080/xxx/; } } 关于session的配置,我是参考这篇博主的 博客 server { listen 80; server_name hole

spring boot多数据源整合mybatis通用mapper

六月ゝ 毕业季﹏ 提交于 2019-12-02 22:10:04
本文将介绍spring boot下如何配置多数据源,持久层框架使用mybatis。附源码(开发工具idea,数据库连接池使用druid,项目管理工具maven) 目录 1、首先搭建项目double_db 2、再按照以下结构配置项目目录结构 3、配置application.properties 4、整合mybatis的通用mapper 4.1配置数据库连接池druid 4.2 配置mybatis的分页插件PageHelper 4.3 新建通用的基础mapper来继承mybatis的通用mapper 5、配置mvc 6、配置多数据源 6.1 配置主数据源 6.2 配置副数据源 7、创建不同数据源的实体类 7.1创建数据库 7.2新建对应的实体类 8、编写不同数据源的mapper 10、编写service 11、编写controller 12、启动项目 13、项目源码下载路径 手编不易,转载或参考请注明链接,谢谢! 1、首先搭建项目double_db 下面是pom文件 <?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

java前后端开发某些版本问题

匿名 (未验证) 提交于 2019-12-02 21:42:56
这两天工作中出现了一些版本冲突的问题,我也是醉了,前后端都是这个类型的问题。可能是由于我是用自己的烂电脑开发的原因,再有,就是两个月没工作了,技术更新换代的快 1.springboot版本和mybatis分页插件版本冲突 这个问题的解决花了我很长时间,原因是我换和springboot版本相匹配的pagehelper包时,我的idea没反应过来,导致导包一直不能成功,我就认为maven抽风了。 出现如下bug: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration] from ClassLoader [sun.misc.Launcher

mybatis入门使用

对着背影说爱祢 提交于 2019-12-02 21:30:00
1.编写mybatis.xml文件 <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration><!-- 配置 mybatis 的环境 --><environments default="mysql"><!-- 配置 mysql 的环境 --><environment id="mysql"><!-- 配置事务的类型 --><transactionManager type="JDBC"></transactionManager><!-- 配置连接数据库的信息:用的是数据源(连接池) --><dataSource type="POOLED"><property name="driver" value="com.mysql.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/ee50"/><property name="username" value="root"/><property name="password" value="1234"/></dataSource></environment><

分页插件PageHelper的使用

匿名 (未验证) 提交于 2019-12-02 20:37:20
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.6</version> </dependency> 2. 在Mybatis配置文件中添加pagehelper插件配置: <plugins> <plugin interceptor="com.github.pagehelper.PageHelper"> <property name="dialect" value="oracle"/> <!-- 该参数默认为false --> <!-- 设置为true时,会将RowBounds第一个参数offset当成pageNum页码使用 --> <!-- 和startPage中的pageNum效果一样--> <property name="offsetAsPageNum" value="true"/> <!-- 该参数默认为false --> <!-- 设置为true时,使用RowBounds分页会进行count查询 --> <property name="rowBoundsWithCount" value="true"/> <!-- 设置为true时,如果pageSize=0或者RowBounds.limit = 0就会查询出全部的结果 --