1. 程式人生 > >springboot:引入分頁外掛PageHelper後啟動報錯,主要版本衝突

springboot:引入分頁外掛PageHelper後啟動報錯,主要版本衝突

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.2.RELEASE)

2018-05-30 14:16:41.879  INFO 4688 --- [  restartedMain] com.example.demo.DemoApplication         : Starting DemoApplication on DESKTOP-4DMRNLS with PID 4688 (D:\eclipse-workspace\demo\target\classes started by 你好 in D:\eclipse-workspace\demo)
2018-05-30 14:16:41.879  INFO 4688 --- [  restartedMain] com.example.demo.DemoApplication         : The following profiles are active: dev
2018-05-30 14:16:41.928  INFO 4688 --- [  restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.ser
[email protected]
50a81019: startup date [Wed May 30 14:16:41 CST 2018]; root of context hierarchy 2018-05-30 14:16:42.782 INFO 4688 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2018-05-30 14:16:43.219 INFO 4688 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d03c05d6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-05-30 14:16:43.514 INFO 4688 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8880 (http) 2018-05-30 14:16:43.535 INFO 4688 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-05-30 14:16:43.535 INFO 4688 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.31 2018-05-30 14:16:43.540 INFO 4688 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\JAVA\JDK\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:/JAVA/JDK/bin/../jre/bin/server;D:/JAVA/JDK/bin/../jre/bin;D:/JAVA/JDK/bin/../jre/lib/amd64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Python27;D:\JAVA\JDK\bin;D:\JAVA\JDK\jre\bin;D:\Git\cmd;D:\apache-maven\apache-maven-3.5.3\bin;C:\Program Files\TortoiseGit\bin;C:\Users\你好\AppData\Local\Microsoft\WindowsApps;C:\Python27;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;;D:\eclipse-jee-oxygen-3a-win32-x86_64\eclipse;;.] 2018-05-30 14:16:43.792 INFO 4688 --- [ost-startStop-1] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 2018-05-30 14:16:43.798 INFO 4688 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-05-30 14:16:43.798 INFO 4688 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1874 ms 2018-05-30 14:16:43.983 INFO 4688 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-05-30 14:16:43.987 INFO 4688 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2018-05-30 14:16:43.988 INFO 4688 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2018-05-30 14:16:43.988 INFO 4688 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2018-05-30 14:16:43.988 INFO 4688 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-05-30 14:16:44.330 INFO 4688 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-05-30 14:16:44.684 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.ser
[email protected]
50a81019: startup date [Wed May 30 14:16:41 CST 2018]; root of context hierarchy 2018-05-30 14:16:44.746 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user/queryById]}" onto public org.springframework.web.servlet.ModelAndView com.example.demo.controller.HmwxUserInfoController.queryById(java.lang.Integer) 2018-05-30 14:16:44.747 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user/list],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.example.demo.controller.HmwxUserInfoController.queryAll(java.util.Map,java.lang.Integer,java.lang.Integer) 2018-05-30 14:16:44.747 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/welcome]}" onto public org.springframework.web.servlet.ModelAndView com.example.demo.TestApplication.hello() 2018-05-30 14:16:44.747 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/again]}" onto public java.lang.String com.example.demo.TestApplication.againtest() 2018-05-30 14:16:44.749 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2018-05-30 14:16:44.750 INFO 4688 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2018-05-30 14:16:44.775 INFO 4688 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-05-30 14:16:44.776 INFO 4688 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-05-30 14:16:44.842 INFO 4688 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index 2018-05-30 14:16:44.872 WARN 4688 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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 [
[email protected]
] 2018-05-30 14:16:44.875 INFO 4688 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2018-05-30 14:16:44.899 INFO 4688 --- [ restartedMain] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-05-30 14:16:44.919 ERROR 4688 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed 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 [[email protected]] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE] at com.example.demo.DemoApplication.main(DemoApplication.java:15) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.2.RELEASE.jar:2.0.2.RELEASE] Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration] from ClassLoader [[email protected]] at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:758) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:690) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:355) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:339) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:298) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1020) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE] ... 20 common frames omitted Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/boot/bind/RelaxedPropertyResolver; at java.lang.Class.getDeclaredFields0(Native Method) ~[na:1.8.0_144] at java.lang.Class.privateGetDeclaredFields(Class.java:2583) ~[na:1.8.0_144] at java.lang.Class.getDeclaredFields(Class.java:1916) ~[na:1.8.0_144] at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:753) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] ... 26 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedPropertyResolver at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144] ... 30 common frames omitted
<dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>1.2.0</version>
        </dependency>
 		<!-- springboot分頁外掛 -->
		<dependency>
		    <groupId>com.github.pagehelper</groupId>
		    <artifactId>pagehelper-spring-boot-starter</artifactId>
		    <version>1.2.2</version>
		</dependency>

修改後

<version>1.2.3</version>
<dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>1.2.0</version>
        </dependency>
 		<!-- springboot分頁外掛 -->
		<dependency>
		    <groupId>com.github.pagehelper</groupId>
		    <artifactId>pagehelper-spring-boot-starter</artifactId>
		    <version>1.2.3</version>
		</dependency>

報錯解決

分頁程式碼

@Override
	public List<HmwxUserInfo> queryByPage(Map map, Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		List<HmwxUserInfo> infos = infoMapper.queryAll();
		PageInfo<HmwxUserInfo> pageInfo = new PageInfo<HmwxUserInfo>(infos);
		return pageInfo.getList();
	}
	
參考:https://blog.csdn.net/qq_32198005/article/details/78435648

相關推薦

springboot:引入外掛PageHelper啟動主要版本衝突

. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)

SpringBoot外掛PageHelper的使用

在springboot中使用PageHelper外掛有兩種較為相似的方式,接下來我就將這兩種方式進行總結。方式一:使用原生的PageHelper1.在pom.xml中引入依賴 <dependency> <groupId&

springboot外掛pageHelper的使用

優點:無需你自己去封裝以及關心sql分頁等問題,使用很方便,前端取資料也很方便。 1.包的依賴 <!--pagehelper --> <depe

Spring,SpringBoot 整合 MyBatis 的外掛 PageHelper

SPRING BOOT, Spring整合 MyBatis 的分頁外掛 PageHelper 原創   2018-04-03  宗野   Spring Boot    昨天給各位總結了

SpringBoot整合MyBatis外掛PageHelper

原創作品,可以轉載,但是請標註出處地址:https://www.cnblogs.com/V1haoge/p/9971043.html SpringBoot整合MyBatis分頁外掛PageHelper 步驟 第一步:首先整合MyBatis 參照之前SpringBoot整合MyBatis.md 第二步

springboot2.0整合外掛pagehelper-spring-boot-starter無法啟動問題

這裡先介紹如何使用springboot2.0整合pagehelper-spring-boot-starter, 新增pom依賴 <dependency> <groupId>com.github.pagehe

springboot+Mybatis的外掛pageHelper

1、在pom.xml加入pageHelper依賴包 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>page

SpringBoot學習-(七)SpringBoot外掛PageHelper

訪問資料庫採用mybatis框架 1.新增pom檔案依賴 <!-- spring mvc支援 --> <dependency> <groupId>

Gradle構建SpringBoot+Mybatis整合外掛PageHelper

使用Gradle構建SpringBoot專案,使用Mybatis來持久化,嘗試整合PageHelper分頁外掛,依然順利都令到我吃驚,so easy! 首先,build.gradle中配置依賴 dependencies { compile gro

SpringBoot整合Mybatis及外掛pageHelper和事務

spring事務分類: 1.宣告事務 2.程式設計事務 spring事務原理:AOP技術 環繞通知進行攔截 使用spring事務的注意事項:不要Try。因為要將異常丟擲給外層 Springboot預設整合事務,只要在方法上加上@Transactional註解 pom.xml

SpringBoot整合MyBatis的外掛PageHelper

來源:http://www.cnblogs.com/1315925303zxz/p/7364552.html 昨天給各位總結了本人學習springboot整合mybatis第一階段的一些學習心得和原始碼,主要就算是敲了一下SpringBoot的門兒,希望能給各位的入門

mybatis的外掛pagehelper的使用

第一步,新增maven依賴。  第二步,在mybatis外掛中配置pagehelper外掛。這裡以使用mysql資料庫為例。 pagehelper5.0以上版本。 <?xml version="1.0" encoding="UTF-8" ?> <!DOCT

springboot 物理外掛

<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter<

mybatis引入外掛

1、pom引入jar <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId&

動態代理使用外掛PageHelper

本來只是研究一下Total的值,後面越陷越深!   資料查詢到html發現沒有總數!!!一開始想著Total應該是查的資料總數,但是測試幾遍發現,返回的是當前分頁的總條數,這顯然不是我想要的,然後發現了PageInfo的繼承類PageSerializable下的初始化方法:

Mybatis的外掛PageHelper

  外掛官方文件地址:https://github.com/pagehelper/Mybatis-PageHelper/blob/master/README_zh.md 使用方法:https://github.com/pagehelper/Mybatis-PageHelper/bl

Spring Boot實踐——Mybatis外掛PageHelper的使用

出自:https://blog.csdn.net/csdn_huzeliang/article/details/79350425 在springboot中使用PageHelper外掛有兩種較為相似的方式,接下來我就將這兩種方式進行總結。 方式一:使用原生的PageHelper 1.在

外掛PageHelper

一、PageHelper說明 如果你也在用Mybatis,建議嘗試該分頁外掛,這個一定是最方便使用的分頁外掛。 該外掛目前支援Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六種資料庫分頁。 二、使用方法 第一步:把PageHelper依賴的jar包新增到工程

【防坑指南】使用Mybatis外掛PageHelper為什麼PageInfo物件出現null的原因

在mybatis中,先匯入pagehelper.jar所需的jar包,然後在sqlMapConfig,xml中配置外掛 <plugins> <!-- com.github.pagehelper為PageHelper類所在包名 --> <plug

mybatis 外掛PageHelper的簡單使用

分頁方式的分類: 邏輯分頁 物理分頁 MyBatis-PageHelper 的使用: 首先在pom.xml配置檔案中增加相關的外掛。 外掛地址:https://github.com/pagehelper/Mybatis-PageHelper <depende