diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..3498aef --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306 + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/log/blog-pro.log b/log/blog-pro.log index 3a694ab..b1a7cc9 100644 --- a/log/blog-pro.log +++ b/log/blog-pro.log @@ -1550,3 +1550,858 @@ Caused by: javax.persistence.NonUniqueResultException: query did not return a un 2021-02-14 12:01:23.400 INFO 96995 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2021-02-14 12:01:23.400 INFO 96995 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-6 - Shutdown initiated... 2021-02-14 12:01:23.402 INFO 96995 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-6 - Shutdown completed. +2021-02-14 14:35:48.468 INFO 6331 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 6331 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 14:35:48.469 DEBUG 6331 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 14:35:48.469 INFO 6331 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 14:35:48.491 INFO 6331 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 14:35:48.492 INFO 6331 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 14:35:48.826 INFO 6331 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 14:35:48.849 INFO 6331 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 19 ms. Found 2 JPA repository interfaces. +2021-02-14 14:35:49.146 INFO 6331 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 14:35:49.150 INFO 6331 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 14:35:49.151 INFO 6331 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 14:35:49.193 INFO 6331 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 14:35:49.193 INFO 6331 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 701 ms +2021-02-14 14:35:49.300 INFO 6331 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 14:35:49.321 INFO 6331 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 14:35:49.377 INFO 6331 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 14:35:49.424 INFO 6331 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 14:35:49.425 WARN 6331 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 14:35:49.633 INFO 6331 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 14:35:49.640 INFO 6331 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 14:35:49.992 INFO 6331 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 14:35:49.996 INFO 6331 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 14:35:50.024 INFO 6331 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 14:35:50.322 WARN 6331 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 14:35:50.519 INFO 6331 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 14:35:50.581 INFO 6331 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 14:35:50.751 INFO 6331 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 14:35:50.756 INFO 6331 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.514 seconds (JVM running for 2.825) +2021-02-14 15:33:02.383 INFO 6331 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 15:33:02.385 INFO 6331 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 15:33:02.389 INFO 6331 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 15:33:02.392 INFO 6331 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2021-02-14 15:55:36.980 INFO 10914 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 10914 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 15:55:36.982 DEBUG 10914 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 15:55:36.985 INFO 10914 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 15:55:37.004 INFO 10914 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 15:55:37.004 INFO 10914 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 15:55:37.282 INFO 10914 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 15:55:37.306 INFO 10914 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 20 ms. Found 3 JPA repository interfaces. +2021-02-14 15:55:37.606 INFO 10914 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 15:55:37.611 INFO 10914 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 15:55:37.611 INFO 10914 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 15:55:37.665 INFO 10914 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 15:55:37.665 INFO 10914 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 660 ms +2021-02-14 15:55:37.731 INFO 10914 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 15:55:37.745 INFO 10914 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 15:55:37.792 INFO 10914 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 15:55:37.824 INFO 10914 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 15:55:37.825 WARN 10914 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 15:55:38.004 INFO 10914 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 15:55:38.010 INFO 10914 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 15:55:38.378 INFO 10914 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 15:55:38.383 INFO 10914 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 15:55:38.423 INFO 10914 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 15:55:38.769 WARN 10914 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 15:55:38.954 INFO 10914 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 15:55:39.004 INFO 10914 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 15:55:39.143 INFO 10914 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 15:55:39.149 INFO 10914 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.363 seconds (JVM running for 2.798) +2021-02-14 15:55:43.072 INFO 10914 --- [http-nio-8080-exec-1] o.apache.tomcat.util.http.parser.Cookie : A cookie header was received [1610766931,1610805598,1610884631; CNZZDATA1279096621=1786622301-1610242524-%7C1611149783; Webstorm-a04307b7=98e54c31-b574-4032-ba13-42e4af915773; Idea-e55ac3f0=010dca81-f0ca-4056-bbe4-1e521e2f9f2e; JSESSIONID=11AB11B4189E8D8AAA5B0A4AAF3E9B70] that contained an invalid cookie. That cookie will be ignored. + Note: further occurrences of this error will be logged at DEBUG level. +2021-02-14 15:55:43.075 INFO 10914 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2021-02-14 15:55:43.075 INFO 10914 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2021-02-14 15:55:43.076 INFO 10914 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms +2021-02-14 15:55:53.212 ERROR 10914 --- [http-nio-8080-exec-8] c.h.b.h.ControllerExceptionHandler : Request URL:/admin/blogs,Exception :{} + +java.lang.NullPointerException: null + at com.hailin.beizhai.service.BlogServiceImpl$1.toPredicate(BlogServiceImpl.java:54) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:765) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:696) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:654) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:444) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) + at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:524) + at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) + at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:531) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:156) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) + at com.sun.proxy.$Proxy106.findAll(Unknown Source) + at com.hailin.beizhai.service.BlogServiceImpl.listBlog(BlogServiceImpl.java:45) + at com.hailin.beizhai.service.BlogServiceImpl$$FastClassBySpringCGLIB$$97921ea8.invoke() + at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) + at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) + at com.hailin.beizhai.service.BlogServiceImpl$$EnhancerBySpringCGLIB$$a1489718.listBlog() + at com.hailin.beizhai.web.admin.BlogController.blogs(BlogController.java:32) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) + at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) + at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) + at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) + +2021-02-14 15:55:53.214 WARN 10914 --- [http-nio-8080-exec-8] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.NullPointerException] +2021-02-14 15:56:17.004 ERROR 10914 --- [http-nio-8080-exec-5] c.h.b.h.ControllerExceptionHandler : Request URL:/admin/blogs,Exception :{} + +java.lang.NullPointerException: null + at com.hailin.beizhai.service.BlogServiceImpl$1.toPredicate(BlogServiceImpl.java:54) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:765) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:696) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:654) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:444) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) + at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:524) + at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) + at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:531) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:156) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) + at com.sun.proxy.$Proxy106.findAll(Unknown Source) + at com.hailin.beizhai.service.BlogServiceImpl.listBlog(BlogServiceImpl.java:45) + at com.hailin.beizhai.service.BlogServiceImpl$$FastClassBySpringCGLIB$$97921ea8.invoke() + at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) + at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) + at com.hailin.beizhai.service.BlogServiceImpl$$EnhancerBySpringCGLIB$$a1489718.listBlog() + at com.hailin.beizhai.web.admin.BlogController.blogs(BlogController.java:32) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) + at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) + at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) + at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) + +2021-02-14 15:56:17.006 WARN 10914 --- [http-nio-8080-exec-5] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.NullPointerException] +2021-02-14 15:56:34.406 ERROR 10914 --- [http-nio-8080-exec-1] c.h.b.h.ControllerExceptionHandler : Request URL:/admin/blogs,Exception :{} + +java.lang.NullPointerException: null + at com.hailin.beizhai.service.BlogServiceImpl$1.toPredicate(BlogServiceImpl.java:54) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:765) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:696) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:654) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:444) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) + at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:524) + at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) + at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:531) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:156) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) + at com.sun.proxy.$Proxy106.findAll(Unknown Source) + at com.hailin.beizhai.service.BlogServiceImpl.listBlog(BlogServiceImpl.java:45) + at com.hailin.beizhai.service.BlogServiceImpl$$FastClassBySpringCGLIB$$97921ea8.invoke() + at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) + at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) + at com.hailin.beizhai.service.BlogServiceImpl$$EnhancerBySpringCGLIB$$a1489718.listBlog() + at com.hailin.beizhai.web.admin.BlogController.blogs(BlogController.java:32) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) + at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) + at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) + at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) + +2021-02-14 15:56:34.407 WARN 10914 --- [http-nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.NullPointerException] +2021-02-14 16:10:27.499 INFO 10914 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 16:10:27.500 INFO 10914 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:10:27.502 INFO 10914 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 16:10:27.505 INFO 10914 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2021-02-14 16:10:29.939 INFO 11790 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 11790 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 16:10:29.940 DEBUG 11790 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 16:10:29.940 INFO 11790 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 16:10:29.958 INFO 11790 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 16:10:29.958 INFO 11790 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 16:10:30.222 INFO 11790 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 16:10:30.248 INFO 11790 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 22 ms. Found 3 JPA repository interfaces. +2021-02-14 16:10:30.567 INFO 11790 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 16:10:30.571 INFO 11790 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 16:10:30.571 INFO 11790 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 16:10:30.633 INFO 11790 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 16:10:30.633 INFO 11790 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 674 ms +2021-02-14 16:10:30.717 INFO 11790 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 16:10:30.734 INFO 11790 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 16:10:30.782 INFO 11790 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 16:10:30.820 INFO 11790 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 16:10:30.821 WARN 11790 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 16:10:30.987 INFO 11790 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 16:10:30.994 INFO 11790 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 16:10:31.323 INFO 11790 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 16:10:31.327 INFO 11790 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:10:31.354 INFO 11790 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 16:10:31.629 WARN 11790 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 16:10:31.808 INFO 11790 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 16:10:31.860 INFO 11790 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 16:10:31.998 INFO 11790 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 16:10:32.004 INFO 11790 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.248 seconds (JVM running for 2.728) +2021-02-14 16:10:39.837 INFO 11790 --- [http-nio-8080-exec-1] o.apache.tomcat.util.http.parser.Cookie : A cookie header was received [1610766931,1610805598,1610884631; CNZZDATA1279096621=1786622301-1610242524-%7C1611149783; Webstorm-a04307b7=98e54c31-b574-4032-ba13-42e4af915773; Idea-e55ac3f0=010dca81-f0ca-4056-bbe4-1e521e2f9f2e; JSESSIONID=180547B94CCA8FBBFAE2682D55D13974] that contained an invalid cookie. That cookie will be ignored. + Note: further occurrences of this error will be logged at DEBUG level. +2021-02-14 16:10:39.841 INFO 11790 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2021-02-14 16:10:39.841 INFO 11790 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2021-02-14 16:10:39.843 INFO 11790 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms +2021-02-14 16:10:56.467 ERROR 11790 --- [http-nio-8080-exec-9] c.h.b.h.ControllerExceptionHandler : Request URL:/admin/blogs,Exception :{} + +java.lang.NullPointerException: null + at com.hailin.beizhai.service.BlogServiceImpl$1.toPredicate(BlogServiceImpl.java:55) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:765) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:696) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:654) + at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:444) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) + at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) + at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:524) + at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) + at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:531) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:156) + at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) + at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) + at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) + at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) + at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) + at com.sun.proxy.$Proxy106.findAll(Unknown Source) + at com.hailin.beizhai.service.BlogServiceImpl.listBlog(BlogServiceImpl.java:46) + at com.hailin.beizhai.service.BlogServiceImpl$$FastClassBySpringCGLIB$$97921ea8.invoke() + at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) + at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) + at com.hailin.beizhai.service.BlogServiceImpl$$EnhancerBySpringCGLIB$$41d20d90.listBlog() + at com.hailin.beizhai.web.admin.BlogController.blogs(BlogController.java:37) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) + at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) + at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) + at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) + at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) + +2021-02-14 16:10:56.468 WARN 11790 --- [http-nio-8080-exec-9] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.NullPointerException] +2021-02-14 16:17:03.119 INFO 11790 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 16:17:03.120 INFO 11790 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:17:03.122 INFO 11790 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 16:17:03.124 INFO 11790 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2021-02-14 16:17:05.453 INFO 12203 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 12203 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 16:17:05.454 DEBUG 12203 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 16:17:05.454 INFO 12203 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 16:17:05.471 INFO 12203 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 16:17:05.472 INFO 12203 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 16:17:05.733 INFO 12203 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 16:17:05.755 INFO 12203 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 19 ms. Found 3 JPA repository interfaces. +2021-02-14 16:17:06.031 INFO 12203 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 16:17:06.035 INFO 12203 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 16:17:06.035 INFO 12203 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 16:17:06.063 INFO 12203 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 16:17:06.064 INFO 12203 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 592 ms +2021-02-14 16:17:06.156 INFO 12203 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 16:17:06.171 INFO 12203 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 16:17:06.210 INFO 12203 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 16:17:06.243 INFO 12203 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 16:17:06.244 WARN 12203 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 16:17:06.407 INFO 12203 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 16:17:06.414 INFO 12203 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 16:17:06.702 INFO 12203 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 16:17:06.706 INFO 12203 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:17:06.733 INFO 12203 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 16:17:07.007 WARN 12203 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 16:17:07.174 INFO 12203 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 16:17:07.220 INFO 12203 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 16:17:07.355 INFO 12203 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 16:17:07.361 INFO 12203 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.088 seconds (JVM running for 2.486) +2021-02-14 16:17:14.047 INFO 12203 --- [http-nio-8080-exec-1] o.apache.tomcat.util.http.parser.Cookie : A cookie header was received [1610766931,1610805598,1610884631; CNZZDATA1279096621=1786622301-1610242524-%7C1611149783; Webstorm-a04307b7=98e54c31-b574-4032-ba13-42e4af915773; Idea-e55ac3f0=010dca81-f0ca-4056-bbe4-1e521e2f9f2e; JSESSIONID=180547B94CCA8FBBFAE2682D55D13974] that contained an invalid cookie. That cookie will be ignored. + Note: further occurrences of this error will be logged at DEBUG level. +2021-02-14 16:17:14.050 INFO 12203 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2021-02-14 16:17:14.050 INFO 12203 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2021-02-14 16:17:14.051 INFO 12203 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms +2021-02-14 16:17:19.910 ERROR 12203 --- [http-nio-8080-exec-7] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-7] Exception processing template "admin/blogs": An error happened during template parsing (template: "class path resource [templates/admin/blogs.html]") + +org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/admin/blogs.html]") + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) + at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666) + at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) + at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) + at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) + at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) + at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1393) + at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1138) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1077) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) +Caused by: org.attoparser.ParseException: An error happened during template parsing (template: "class path resource [templates/admin/blogs.html]" - line 45, col 5) + at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) + at org.attoparser.MarkupParser.parse(MarkupParser.java:257) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) + ... 48 common frames omitted +Caused by: org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/admin/blogs.html]" - line 45, col 5) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:239) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) + at org.thymeleaf.engine.TemplateManager.parseStandalone(TemplateManager.java:302) + at org.thymeleaf.standard.expression.FragmentExpression.resolveExecutedFragmentExpression(FragmentExpression.java:588) + at org.thymeleaf.standard.expression.FragmentExpression.executeFragmentExpression(FragmentExpression.java:391) + at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:89) + at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) + at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138) + at org.thymeleaf.standard.expression.FragmentExpression.createExecutedFragmentExpressionParameters(FragmentExpression.java:529) + at org.thymeleaf.standard.expression.FragmentExpression.doCreateExecutedFragmentExpression(FragmentExpression.java:471) + at org.thymeleaf.standard.expression.FragmentExpression.createExecutedFragmentExpression(FragmentExpression.java:426) + at org.thymeleaf.standard.processor.AbstractStandardFragmentInsertionTagProcessor.computeFragment(AbstractStandardFragmentInsertionTagProcessor.java:359) + at org.thymeleaf.standard.processor.AbstractStandardFragmentInsertionTagProcessor.doProcess(AbstractStandardFragmentInsertionTagProcessor.java:110) + at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) + at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) + at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) + at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314) + at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleOpenElementEnd(TemplateHandlerAdapterMarkupHandler.java:304) + at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler$InlineMarkupAdapterPreProcessorHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:278) + at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.handleOpenElementEnd(OutputExpressionInlinePreProcessorHandler.java:186) + at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:124) + at org.attoparser.HtmlElement.handleOpenElementEnd(HtmlElement.java:109) + at org.attoparser.HtmlMarkupHandler.handleOpenElementEnd(HtmlMarkupHandler.java:297) + at org.attoparser.MarkupEventProcessorHandler.handleOpenElementEnd(MarkupEventProcessorHandler.java:402) + at org.attoparser.ParsingElementMarkupUtil.parseOpenElement(ParsingElementMarkupUtil.java:159) + at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:710) + at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301) + ... 50 common frames omitted +Caused by: org.attoparser.ParseException: (Line = 45, Column = 5) Could not parse as a well-formed close element: "" + at org.attoparser.ParsingElementMarkupUtil.parseCloseElement(ParsingElementMarkupUtil.java:176) + at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:725) + at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301) + at org.attoparser.MarkupParser.parse(MarkupParser.java:257) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) + ... 76 common frames omitted + +2021-02-14 16:17:19.912 ERROR 12203 --- [http-nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/admin/blogs.html]")] with root cause + +org.attoparser.ParseException: (Line = 45, Column = 5) Could not parse as a well-formed close element: "" + at org.attoparser.ParsingElementMarkupUtil.parseCloseElement(ParsingElementMarkupUtil.java:176) + at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:725) + at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301) + at org.attoparser.MarkupParser.parse(MarkupParser.java:257) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) + at org.thymeleaf.engine.TemplateManager.parseStandalone(TemplateManager.java:302) + at org.thymeleaf.standard.expression.FragmentExpression.resolveExecutedFragmentExpression(FragmentExpression.java:588) + at org.thymeleaf.standard.expression.FragmentExpression.executeFragmentExpression(FragmentExpression.java:391) + at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:89) + at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) + at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138) + at org.thymeleaf.standard.expression.FragmentExpression.createExecutedFragmentExpressionParameters(FragmentExpression.java:529) + at org.thymeleaf.standard.expression.FragmentExpression.doCreateExecutedFragmentExpression(FragmentExpression.java:471) + at org.thymeleaf.standard.expression.FragmentExpression.createExecutedFragmentExpression(FragmentExpression.java:426) + at org.thymeleaf.standard.processor.AbstractStandardFragmentInsertionTagProcessor.computeFragment(AbstractStandardFragmentInsertionTagProcessor.java:359) + at org.thymeleaf.standard.processor.AbstractStandardFragmentInsertionTagProcessor.doProcess(AbstractStandardFragmentInsertionTagProcessor.java:110) + at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) + at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) + at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) + at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314) + at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleOpenElementEnd(TemplateHandlerAdapterMarkupHandler.java:304) + at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler$InlineMarkupAdapterPreProcessorHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:278) + at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.handleOpenElementEnd(OutputExpressionInlinePreProcessorHandler.java:186) + at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler.handleOpenElementEnd(InlinedOutputExpressionMarkupHandler.java:124) + at org.attoparser.HtmlElement.handleOpenElementEnd(HtmlElement.java:109) + at org.attoparser.HtmlMarkupHandler.handleOpenElementEnd(HtmlMarkupHandler.java:297) + at org.attoparser.MarkupEventProcessorHandler.handleOpenElementEnd(MarkupEventProcessorHandler.java:402) + at org.attoparser.ParsingElementMarkupUtil.parseOpenElement(ParsingElementMarkupUtil.java:159) + at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:710) + at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301) + at org.attoparser.MarkupParser.parse(MarkupParser.java:257) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) + at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) + at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666) + at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) + at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) + at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) + at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) + at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1393) + at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1138) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1077) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) + +2021-02-14 16:18:50.485 INFO 12203 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 16:18:50.486 INFO 12203 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:18:50.488 INFO 12203 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 16:18:50.490 INFO 12203 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2021-02-14 16:18:52.153 INFO 12309 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 12309 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 16:18:52.154 DEBUG 12309 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 16:18:52.154 INFO 12309 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 16:18:52.172 INFO 12309 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 16:18:52.173 INFO 12309 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 16:18:52.484 INFO 12309 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 16:18:52.511 INFO 12309 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 24 ms. Found 3 JPA repository interfaces. +2021-02-14 16:18:52.802 INFO 12309 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 16:18:52.806 INFO 12309 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 16:18:52.806 INFO 12309 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 16:18:52.864 INFO 12309 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 16:18:52.864 INFO 12309 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 691 ms +2021-02-14 16:18:52.929 INFO 12309 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 16:18:52.943 INFO 12309 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 16:18:52.977 INFO 12309 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 16:18:53.008 INFO 12309 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 16:18:53.008 WARN 12309 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 16:18:53.168 INFO 12309 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 16:18:53.175 INFO 12309 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 16:18:53.474 INFO 12309 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 16:18:53.478 INFO 12309 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:18:53.506 INFO 12309 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 16:18:53.806 WARN 12309 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 16:18:54.004 INFO 12309 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 16:18:54.061 INFO 12309 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 16:18:54.195 INFO 12309 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 16:18:54.200 INFO 12309 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.283 seconds (JVM running for 2.562) +2021-02-14 16:19:01.164 INFO 12309 --- [http-nio-8080-exec-1] o.apache.tomcat.util.http.parser.Cookie : A cookie header was received [1610766931,1610805598,1610884631; CNZZDATA1279096621=1786622301-1610242524-%7C1611149783; Webstorm-a04307b7=98e54c31-b574-4032-ba13-42e4af915773; Idea-e55ac3f0=010dca81-f0ca-4056-bbe4-1e521e2f9f2e; JSESSIONID=180547B94CCA8FBBFAE2682D55D13974] that contained an invalid cookie. That cookie will be ignored. + Note: further occurrences of this error will be logged at DEBUG level. +2021-02-14 16:19:01.168 INFO 12309 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2021-02-14 16:19:01.168 INFO 12309 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2021-02-14 16:19:01.169 INFO 12309 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms +2021-02-14 16:19:10.969 ERROR 12309 --- [http-nio-8080-exec-6] c.h.b.h.ControllerExceptionHandler : Request URL:/admin/blogs/search,Exception :{} + +org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported + at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:250) + at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:417) + at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:364) + at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.getHandlerInternal(RequestMappingInfoHandlerMapping.java:123) + at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.getHandlerInternal(RequestMappingInfoHandlerMapping.java:66) + at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:491) + at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1254) + at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1036) + at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) + at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) + at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) + at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) + at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) + at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) + at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) + at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) + at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) + at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) + at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) + at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) + at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) + at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) + at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) + at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) + at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) + at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) + at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) + at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) + at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) + at java.lang.Thread.run(Thread.java:748) + +2021-02-14 16:19:10.972 WARN 12309 --- [http-nio-8080-exec-6] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] +2021-02-14 16:20:53.942 INFO 12309 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 16:20:53.944 INFO 12309 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:20:53.946 INFO 12309 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 16:20:53.969 INFO 12309 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2021-02-14 16:20:56.056 INFO 12430 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 12430 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 16:20:56.056 DEBUG 12430 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 16:20:56.057 INFO 12430 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 16:20:56.074 INFO 12430 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 16:20:56.074 INFO 12430 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 16:20:56.348 INFO 12430 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 16:20:56.373 INFO 12430 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 21 ms. Found 3 JPA repository interfaces. +2021-02-14 16:20:56.663 INFO 12430 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 16:20:56.667 INFO 12430 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 16:20:56.667 INFO 12430 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 16:20:56.697 INFO 12430 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 16:20:56.697 INFO 12430 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 622 ms +2021-02-14 16:20:56.793 INFO 12430 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 16:20:56.809 INFO 12430 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 16:20:56.852 INFO 12430 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 16:20:56.887 INFO 12430 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 16:20:56.887 WARN 12430 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 16:20:57.053 INFO 12430 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 16:20:57.059 INFO 12430 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 16:20:57.357 INFO 12430 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 16:20:57.361 INFO 12430 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:20:57.388 INFO 12430 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 16:20:57.669 WARN 12430 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 16:20:57.844 INFO 12430 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 16:20:57.892 INFO 12430 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 16:20:58.028 INFO 12430 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 16:20:58.033 INFO 12430 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.161 seconds (JVM running for 2.572) +2021-02-14 16:21:07.972 INFO 12430 --- [http-nio-8080-exec-1] o.apache.tomcat.util.http.parser.Cookie : A cookie header was received [1610766931,1610805598,1610884631; CNZZDATA1279096621=1786622301-1610242524-%7C1611149783; Webstorm-a04307b7=98e54c31-b574-4032-ba13-42e4af915773; Idea-e55ac3f0=010dca81-f0ca-4056-bbe4-1e521e2f9f2e; JSESSIONID=180547B94CCA8FBBFAE2682D55D13974] that contained an invalid cookie. That cookie will be ignored. + Note: further occurrences of this error will be logged at DEBUG level. +2021-02-14 16:21:07.977 INFO 12430 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2021-02-14 16:21:07.977 INFO 12430 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2021-02-14 16:21:07.978 INFO 12430 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms +2021-02-14 16:23:08.154 INFO 12430 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 16:23:08.155 INFO 12430 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:23:08.157 INFO 12430 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 16:23:08.159 INFO 12430 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2021-02-14 16:23:11.923 INFO 12566 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Starting BeizhaiApplication using Java 1.8.0_275 on zhouhailindeMacBook-Air.local with PID 12566 (/Users/zhouhailin/idea-code/beizhai/target/classes started by zhouhailin in /Users/zhouhailin/idea-code/beizhai) +2021-02-14 16:23:11.924 DEBUG 12566 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Running with Spring Boot v2.4.2, Spring v5.3.3 +2021-02-14 16:23:11.924 INFO 12566 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : The following profiles are active: dev +2021-02-14 16:23:11.943 INFO 12566 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable +2021-02-14 16:23:11.943 INFO 12566 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' +2021-02-14 16:23:12.250 INFO 12566 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. +2021-02-14 16:23:12.281 INFO 12566 --- [restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 26 ms. Found 3 JPA repository interfaces. +2021-02-14 16:23:12.656 INFO 12566 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) +2021-02-14 16:23:12.662 INFO 12566 --- [restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2021-02-14 16:23:12.662 INFO 12566 --- [restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] +2021-02-14 16:23:12.695 INFO 12566 --- [restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2021-02-14 16:23:12.695 INFO 12566 --- [restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 751 ms +2021-02-14 16:23:12.787 INFO 12566 --- [restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2021-02-14 16:23:12.806 INFO 12566 --- [restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.27.Final +2021-02-14 16:23:12.857 INFO 12566 --- [restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +2021-02-14 16:23:12.903 INFO 12566 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2021-02-14 16:23:12.904 WARN 12566 --- [restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. +2021-02-14 16:23:13.091 INFO 12566 --- [restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2021-02-14 16:23:13.100 INFO 12566 --- [restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect +2021-02-14 16:23:13.453 INFO 12566 --- [restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2021-02-14 16:23:13.457 INFO 12566 --- [restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:23:13.497 INFO 12566 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 +2021-02-14 16:23:13.936 WARN 12566 --- [restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2021-02-14 16:23:14.025 INFO 12566 --- [restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2021-02-14 16:23:14.077 INFO 12566 --- [restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index +2021-02-14 16:23:14.228 INFO 12566 --- [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' +2021-02-14 16:23:14.234 INFO 12566 --- [restartedMain] com.hailin.beizhai.BeizhaiApplication : Started BeizhaiApplication in 2.527 seconds (JVM running for 3.213) +2021-02-14 16:23:17.120 INFO 12566 --- [http-nio-8080-exec-1] o.apache.tomcat.util.http.parser.Cookie : A cookie header was received [1610766931,1610805598,1610884631; CNZZDATA1279096621=1786622301-1610242524-%7C1611149783; Webstorm-a04307b7=98e54c31-b574-4032-ba13-42e4af915773; Idea-e55ac3f0=010dca81-f0ca-4056-bbe4-1e521e2f9f2e; JSESSIONID=180547B94CCA8FBBFAE2682D55D13974] that contained an invalid cookie. That cookie will be ignored. + Note: further occurrences of this error will be logged at DEBUG level. +2021-02-14 16:23:17.125 INFO 12566 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' +2021-02-14 16:23:17.125 INFO 12566 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' +2021-02-14 16:23:17.126 INFO 12566 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms +2021-02-14 16:24:28.964 WARN 12566 --- [HikariPool-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=1m15s767ms). +2021-02-14 16:24:48.324 INFO 12566 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2021-02-14 16:24:48.324 INFO 12566 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2021-02-14 16:24:48.327 INFO 12566 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2021-02-14 16:24:48.329 INFO 12566 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. diff --git a/src/main/java/com/hailin/beizhai/dao/BlogRepositiry.java b/src/main/java/com/hailin/beizhai/dao/BlogRepositiry.java new file mode 100644 index 0000000..7e745e0 --- /dev/null +++ b/src/main/java/com/hailin/beizhai/dao/BlogRepositiry.java @@ -0,0 +1,10 @@ +package com.hailin.beizhai.dao; + +import com.hailin.beizhai.po.Blog; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +//JpaRepository传递对象和主键类型 +//JpaSpecificationExecutor jpa动态查询 +public interface BlogRepositiry extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/src/main/java/com/hailin/beizhai/po/Blog.java b/src/main/java/com/hailin/beizhai/po/Blog.java index d8e12b2..b3bb20c 100644 --- a/src/main/java/com/hailin/beizhai/po/Blog.java +++ b/src/main/java/com/hailin/beizhai/po/Blog.java @@ -27,7 +27,7 @@ public class Blog { private boolean shareStatement; private boolean commentabled; private boolean published; - private boolean recommend; + private boolean recommend;//推荐 @Temporal(TemporalType.TIMESTAMP) private Date createTime; @Temporal(TemporalType.TIMESTAMP) diff --git a/src/main/java/com/hailin/beizhai/service/BlogService.java b/src/main/java/com/hailin/beizhai/service/BlogService.java new file mode 100644 index 0000000..18b41d8 --- /dev/null +++ b/src/main/java/com/hailin/beizhai/service/BlogService.java @@ -0,0 +1,19 @@ +package com.hailin.beizhai.service; + +import com.hailin.beizhai.po.Blog; +import com.hailin.beizhai.vo.BlogQuery; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +public interface BlogService { + + Blog getBlog(Long id); + + Page listBlog(Pageable pageable, BlogQuery blog); + + Blog saveBlog(Blog blog); + + Blog updateBlog(Long id,Blog blog); + + void deleteBlog(Long id); +} diff --git a/src/main/java/com/hailin/beizhai/service/BlogServiceImpl.java b/src/main/java/com/hailin/beizhai/service/BlogServiceImpl.java new file mode 100644 index 0000000..bbde669 --- /dev/null +++ b/src/main/java/com/hailin/beizhai/service/BlogServiceImpl.java @@ -0,0 +1,91 @@ +package com.hailin.beizhai.service; + +import com.hailin.beizhai.NotFoundException; +import com.hailin.beizhai.dao.BlogRepositiry; +import com.hailin.beizhai.po.Blog; +import com.hailin.beizhai.po.Type; +import com.hailin.beizhai.vo.BlogQuery; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.ArrayList; +import java.util.List; + +/* +@Name: BlogServiceImpl +@Author: zhouhailin +@Date: 2021/2/14 +@Time: 2:44 下午 +@Description: +*/ + +@Service +public class BlogServiceImpl implements BlogService { + + @Autowired + private BlogRepositiry blogRepositiry; + + + @Override + public Blog getBlog(Long id) { + return blogRepositiry.findById(id).get(); + } + + //查询 + @Override + public Page listBlog(Pageable pageable, BlogQuery blog) { + //动态查询条件 + return blogRepositiry.findAll(new Specification() { + @Override + public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { + List predicates = new ArrayList<>(); + if ("".equals(blog.getTitle()) && (blog.getTitle() != null)) { + //title like 字段模糊查询 + predicates.add(criteriaBuilder.like(root.get("title"), "%" + blog.getTitle() + "%")); + } + // 分类 + if (blog.getTypeId() != null) { + predicates.add(criteriaBuilder.equal(root.get("type").get("id"), blog.getTypeId())); + } + //推荐 + if (blog.isRecommend()){ + predicates.add(criteriaBuilder.equal(root.get("recommend"),blog.isRecommend())); + } + criteriaQuery.where(predicates.toArray(new Predicate[predicates.size()])); + return null; + } + }, pageable); + } + + @Transactional + @Override + public Blog saveBlog(Blog blog) { + return blogRepositiry.save(blog); + } + + @Transactional + @Override + public Blog updateBlog(Long id, Blog blog) { + Blog b = blogRepositiry.findById(id).get(); + if (b == null) { + throw new NotFoundException("博客不存在"); + } + BeanUtils.copyProperties(blog, b); + return blogRepositiry.save(b); + } + + @Transactional + @Override + public void deleteBlog(Long id) { + blogRepositiry.deleteById(id); + } +} diff --git a/src/main/java/com/hailin/beizhai/service/TypeService.java b/src/main/java/com/hailin/beizhai/service/TypeService.java index 37a945e..5b71f75 100644 --- a/src/main/java/com/hailin/beizhai/service/TypeService.java +++ b/src/main/java/com/hailin/beizhai/service/TypeService.java @@ -4,6 +4,8 @@ import com.hailin.beizhai.po.Type; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.List; + public interface TypeService { Type saveType(Type type); @@ -14,6 +16,8 @@ public interface TypeService { Page listType(Pageable pageable);//分页 + List listType(); + Type updateType(Long id,Type type); void deleteType(Long id); diff --git a/src/main/java/com/hailin/beizhai/service/TypeServiceImpl.java b/src/main/java/com/hailin/beizhai/service/TypeServiceImpl.java index 78abbd9..1d51a1a 100644 --- a/src/main/java/com/hailin/beizhai/service/TypeServiceImpl.java +++ b/src/main/java/com/hailin/beizhai/service/TypeServiceImpl.java @@ -10,6 +10,8 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + /* @Name: TypeServiceImpl @Author: zhouhailin @@ -37,7 +39,6 @@ public class TypeServiceImpl implements TypeService{ @Override public Type getTypeByName(String name) { - System.out.println("111"+typeRepository.findByName(name)); return typeRepository.findByName(name); } @@ -47,12 +48,17 @@ public class TypeServiceImpl implements TypeService{ return typeRepository.findAll(pageable); } + @Override + public List listType() { + return typeRepository.findAll(); + } + @Transactional @Override public Type updateType(Long id, Type type) { Type t=typeRepository.findById(id).get(); if (t==null){ - throw new NotFoundException("不存在该类型"); + throw new NotFoundException("不存在该分类"); } BeanUtils.copyProperties(type,t);//type 赋值到t return typeRepository.save(t); diff --git a/src/main/java/com/hailin/beizhai/vo/BlogQuery.java b/src/main/java/com/hailin/beizhai/vo/BlogQuery.java new file mode 100644 index 0000000..c9ba3de --- /dev/null +++ b/src/main/java/com/hailin/beizhai/vo/BlogQuery.java @@ -0,0 +1,50 @@ +package com.hailin.beizhai.vo; + +/* +@Name: BlogQuery +@Author: zhouhailin +@Date: 2021/2/14 +@Time: 4:12 下午 +@Description: +*/ +public class BlogQuery { + private String title; + private Long typeId; + private boolean recommend; + + @Override + public String toString() { + return "BlogQuery{" + + "title='" + title + '\'' + + ", typeId=" + typeId + + ", recommendl=" + recommend + + '}'; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Long getTypeId() { + return typeId; + } + + public void setTypeId(Long typeId) { + this.typeId = typeId; + } + + public boolean isRecommend() { + return recommend; + } + + public void setRecommend(boolean recommend) { + this.recommend = recommend; + } + + public BlogQuery() { + } +} diff --git a/src/main/java/com/hailin/beizhai/web/admin/BlogController.java b/src/main/java/com/hailin/beizhai/web/admin/BlogController.java index 72ad6f5..2049cb2 100644 --- a/src/main/java/com/hailin/beizhai/web/admin/BlogController.java +++ b/src/main/java/com/hailin/beizhai/web/admin/BlogController.java @@ -7,18 +7,48 @@ package com.hailin.beizhai.web.admin; @Description: */ +import com.hailin.beizhai.po.Blog; +import com.hailin.beizhai.service.BlogService; +import com.hailin.beizhai.service.TypeService; +import com.hailin.beizhai.vo.BlogQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/admin") public class BlogController { + @Autowired + private BlogService blogService; + + @Autowired + private TypeService typeService; + @GetMapping("/blogs") - public String blogs(){ - System.out.println("blogs get in"); + public String blogs(@PageableDefault(size = 3, sort = {"updateTime"}, direction = Sort.Direction.DESC) Pageable pageable, + BlogQuery blog, + Model model) { + model.addAttribute("types",typeService.listType()); + model.addAttribute("page", blogService.listBlog(pageable, blog)); return "admin/blogs"; } + //局部渲染 + @PostMapping("/blogs/search") + public String search(@PageableDefault(size = 3, sort = {"updateTime"}, direction = Sort.Direction.DESC) Pageable pageable, + BlogQuery blog, + Model model) { + model.addAttribute("page", blogService.listBlog(pageable, blog)); + return "admin/blogs :: blogList"; + } + + + } diff --git a/src/main/resources/templates/admin/blogs.html b/src/main/resources/templates/admin/blogs.html index e5ac829..934a45f 100644 --- a/src/main/resources/templates/admin/blogs.html +++ b/src/main/resources/templates/admin/blogs.html @@ -16,19 +16,21 @@
-
+
@@ -39,56 +41,57 @@
- +
- +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
标题类型推荐更新时间操作
1刻意练习清单认知升级2017-10-02 09:45 + 编辑 + 删除 +
+ + 新增 +
+
- - - - - - - - - - - - - - - - - - - - - - - - - - -
标题类型推荐更新时间操作
1刻意练习清单认知升级2017-10-02 09:45 - 编辑 - 删除 -
- - 新增 -


- - -