Thymeleaf 集成后,跟着老师视频一步步配置的,但是,貌似无法加载。

来源:3-4 前端集成

YuSin

2018-01-27

工具:IDEA

症状:配置了index页面,但是链接进去显示404,Springboot启动的过程中也没报错,但是没有显示映射上/


  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v1.5.7.RELEASE)


2018-01-27 21:29:52.772  INFO 8684 --- [  restartedMain] com.imooc.demo.DemoApplication           : Starting DemoApplication on liuchens-MacBook-Pro.local with PID 8684 (/Users/liuchen/MyDev/IdeaProjects/imooc-springboot/target/classes started by liuchen in /Users/liuchen/MyDev/IdeaProjects/imooc-springboot)

2018-01-27 21:29:52.772  INFO 8684 --- [  restartedMain] com.imooc.demo.DemoApplication           : The following profiles are active: dev

2018-01-27 21:29:53.016  INFO 8684 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@664df26a: startup date [Sat Jan 27 21:29:53 CST 2018]; root of context hierarchy

2018-01-27 21:29:54.824  INFO 8684 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)

2018-01-27 21:29:54.840  INFO 8684 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

2018-01-27 21:29:54.841  INFO 8684 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.20

2018-01-27 21:29:54.936  INFO 8684 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext

2018-01-27 21:29:54.936  INFO 8684 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1924 ms

2018-01-27 21:29:55.145  INFO 8684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]

2018-01-27 21:29:55.145  INFO 8684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]

2018-01-27 21:29:55.145  INFO 8684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]

2018-01-27 21:29:55.145  INFO 8684 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]

2018-01-27 21:29:55.146  INFO 8684 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]

2018-01-27 21:29:55.146  INFO 8684 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Sat Jan 27 21:29:55 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

2018-01-27 21:29:55.833  INFO 8684 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'

2018-01-27 21:29:55.851  INFO 8684 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [

name: default

...]

2018-01-27 21:29:55.987  INFO 8684 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}

2018-01-27 21:29:55.988  INFO 8684 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found

2018-01-27 21:29:55.989  INFO 8684 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist

2018-01-27 21:29:56.025  INFO 8684 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}

2018-01-27 21:29:56.131  INFO 8684 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect

2018-01-27 21:29:56.366  INFO 8684 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2018-01-27 21:29:56.712  INFO 8684 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@664df26a: startup date [Sat Jan 27 21:29:53 CST 2018]; root of context hierarchy

2018-01-27 21:29:56.792  INFO 8684 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello],methods=[GET]}" onto public java.lang.String com.imooc.demo.DemoApplication.hello()

2018-01-27 21:29:56.795  INFO 8684 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)

2018-01-27 21:29:56.795  INFO 8684 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)

2018-01-27 21:29:56.823  INFO 8684 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

2018-01-27 21:29:56.823  INFO 8684 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

2018-01-27 21:29:56.871  INFO 8684 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

2018-01-27 21:29:57.504  INFO 8684 --- [  restartedMain] b.a.s.AuthenticationManagerConfiguration : 


Using default security password: 6b1ebb84-b720-4045-91ff-e748c9b10876


2018-01-27 21:29:57.548  INFO 8684 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/css/**'], Ant [pattern='/js/**'], Ant [pattern='/images/**'], Ant [pattern='/webjars/**'], Ant [pattern='/**/favicon.ico'], Ant [pattern='/error']]], []

2018-01-27 21:29:57.597  INFO 8684 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration$ApplicationNoWebSecurityConfigurerAdapter$1@7dfa9406, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@3c25f12b, org.springframework.security.web.context.SecurityContextPersistenceFilter@6eb703c7, org.springframework.security.web.header.HeaderWriterFilter@40c08cbe, org.springframework.security.web.csrf.CsrfFilter@59b99628, org.springframework.security.web.authentication.logout.LogoutFilter@23c54b64, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5ca2e75c, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@51882cb4, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@35b213a0, org.springframework.security.web.session.SessionManagementFilter@73b0672f, org.springframework.security.web.access.ExceptionTranslationFilter@adae2d8]

2018-01-27 21:29:57.723  INFO 8684 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729

2018-01-27 21:29:57.781  INFO 8684 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup

2018-01-27 21:29:57.856  INFO 8684 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)

2018-01-27 21:29:57.863  INFO 8684 --- [  restartedMain] com.imooc.demo.DemoApplication           : Started DemoApplication in 5.577 seconds (JVM running for 6.039)

2018-01-27 21:30:04.331  INFO 8684 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'

2018-01-27 21:30:04.331  INFO 8684 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started

2018-01-27 21:30:04.353  INFO 8684 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 22 ms

application.propertises

spring.thymeleaf.cache=false
spring.thymeleaf.mode=HTML

pom.xml

UTF-8UTF-81.83.0.3.RELEASE2.1.13.0.2.RELEASE
org.springframework.bootspring-boot-starter-thymeleaforg.thymeleafthymeleaf${thymeleaf.version}org.thymeleafthymeleaf-spring43.0.2.RELEASE


写回答

1回答

瓦力老师

2018-01-28

亲,看起来应该是没问题的,建议尝试直接使用默认配置,看看是不是因为其他配置的问题,导致无法正常加载。

2
1
YuSin
谢谢老师,原因没找到,重新搭建了一遍就好了,好像是IDE的问题
2018-02-08
共1条回复

BAT大牛亲授 基于ElasticSearch的搜房网实战

ES+MySQL+Kafka,打造强力站内搜索

898 学习 · 285 问题

查看课程