我有一个问题“spring.jpa.hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect”它无法被eclipse识别,我不知道为什么。下面是我的Pom.xml和application.properties,任何建议都会很棒。有没有其他解决方案如何将hibernate与MySql连接?谢谢
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<tiles.version>3.0.5</tiles.version>
</properties>
<groupId>com.caveofprogramming</groupId>
<artifactId>spring-boot-tutorial</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${tiles.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
</dependencies>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
server.port=9099
debug=true
spring.datasource.url=jdbc:mysql://localhost:3306/springboottutorial
spring.datasource.username=springboot
spring.datasource.password=hello
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
logging.level.org.hibernate.SQL=DEBUG
2016-11-27 21:55:24.324 INFO 8048 --- [ main] com.caveofprogramming.App : Starting App on Norby-PC with PID 8048 (started by Norby in C:\Users\Norby\Documents\Java EE-2\springboot-master\springboot-master\spring-boot-tutorial-connecting)
2016-11-27 21:55:24.328 INFO 8048 --- [ main] com.caveofprogramming.App : No active profile set, falling back to default profiles: default
2016-11-27 21:55:24.328 DEBUG 8048 --- [ main] o.s.boot.SpringApplication : Loading source class com.caveofprogramming.App
2016-11-27 21:55:24.490 DEBUG 8048 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'classpath:/application.properties'
2016-11-27 21:55:24.490 DEBUG 8048 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped (empty) config file 'classpath:/application.properties' for profile default
2016-11-27 21:55:24.498 INFO 8048 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@71a794e5: startup date [Sun Nov 27 21:55:24 GMT 2016]; root of context hierarchy
2016-11-27 21:55:24.505 DEBUG 8048 --- [ main] ationConfigEmbeddedWebApplicationContext : Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@71a794e5: org.springframework.beans.factory.support.DefaultListableBeanFactory@1ed1993a: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,app]; root of factory hierarchy
2016-11-27 21:55:28.386 DEBUG 8048 --- [ main] o.s.b.a.AutoConfigurationPackages : @EnableAutoConfiguration was declared on a class in the package 'com.caveofprogramming'. Automatic @Repository and @Entity scanning is enabled.
2016-11-27 21:55:29.327 INFO 8048 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$785ab572] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-11-27 21:55:29.410 DEBUG 8048 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@5b6e8f77]
2016-11-27 21:55:29.410 DEBUG 8048 --- [ main] ationConfigEmbeddedWebApplicationContext : Using ApplicationEventMulticaster [org.springframework.context.event.SimpleApplicationEventMulticaster@41a6d121]
2016-11-27 21:55:30.486 DEBUG 8048 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\Norby\.m2\repository\org\springframework\boot\spring-boot\1.3.5.RELEASE\spring-boot-1.3.5.RELEASE.jar
2016-11-27 21:55:30.486 DEBUG 8048 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\Norby\.m2\repository\org\springframework\boot\spring-boot\1.3.5.RELEASE\spring-boot-1.3.5.RELEASE.jar
2016-11-27 21:55:30.487 DEBUG 8048 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Document root: C:\Users\Norby\Documents\Java EE-2\springboot-master\springboot-master\spring-boot-tutorial-connecting\src\main\webapp
2016-11-27 21:55:30.596 INFO 8048 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9099 (http)
2016-11-27 21:55:30.626 INFO 8048 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-11-27 21:55:30.629 INFO 8048 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.33
2016-11-27 21:55:31.600 INFO 8048 --- [ost-startStop-1] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2016-11-27 21:55:31.609 INFO 8048 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-11-27 21:55:31.610 INFO 8048 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 7116 ms
2016-11-27 21:55:31.819 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Added existing Servlet initializer bean 'dispatcherServletRegistration'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class]
2016-11-27 21:55:32.283 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'characterEncodingFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class]
2016-11-27 21:55:32.283 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'hiddenHttpMethodFilter'; order=-10000, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2016-11-27 21:55:32.284 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'httpPutFormContentFilter'; order=-9900, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class]
2016-11-27 21:55:32.284 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'requestContextFilter'; order=-105, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]
2016-11-27 21:55:32.290 INFO 8048 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-11-27 21:55:32.296 INFO 8048 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-11-27 21:55:32.297 INFO 8048 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-11-27 21:55:32.297 INFO 8048 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-11-27 21:55:32.297 INFO 8048 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-11-27 21:55:32.334 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.web.OrderedRequestContextFilter : Initializing filter 'requestContextFilter'
2016-11-27 21:55:32.337 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.web.OrderedRequestContextFilter : Filter 'requestContextFilter' configured successfully
2016-11-27 21:55:32.338 DEBUG 8048 --- [ost-startStop-1] .s.b.c.w.OrderedHttpPutFormContentFilter : Initializing filter 'httpPutFormContentFilter'
2016-11-27 21:55:32.339 DEBUG 8048 --- [ost-startStop-1] .s.b.c.w.OrderedHttpPutFormContentFilter : Filter 'httpPutFormContentFilter' configured successfully
2016-11-27 21:55:32.339 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.w.OrderedHiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter'
2016-11-27 21:55:32.339 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.w.OrderedHiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully
2016-11-27 21:55:32.340 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.w.OrderedCharacterEncodingFilter : Initializing filter 'characterEncodingFilter'
2016-11-27 21:55:32.341 DEBUG 8048 --- [ost-startStop-1] o.s.b.c.w.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured successfully
Sun Nov 27 21:55:32 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
Sun Nov 27 21:55:33 GMT 2016 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.
2016-11-27 21:55:33.271 INFO 8048 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-11-27 21:55:33.294 INFO 8048 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-11-27 21:55:33.536 INFO 8048 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.11.Final}
2016-11-27 21:55:33.539 INFO 8048 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-11-27 21:55:33.542 INFO 8048 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-11-27 21:55:33.908 INFO 8048 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-11-27 21:55:34.019 INFO 8048 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2016-11-27 21:55:34.323 INFO 8048 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-11-27 21:55:34.620 INFO 8048 --- [ main] org.hibernate.tuple.PojoInstantiator : HHH000182: No default (no-argument) constructor for class: com.caveofprogramming.model.StatusUpdate (class must be instantiated by Interceptor)
2016-11-27 21:55:35.101 INFO 8048 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2016-11-27 21:55:35.101 INFO 8048 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2016-11-27 21:55:35.103 INFO 8048 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2016-11-27 21:55:35.141 INFO 8048 --- [ main] java.sql.DatabaseMetaData : HHH000262: Table not found: status_update
2016-11-27 21:55:35.144 INFO 8048 --- [ main] java.sql.DatabaseMetaData : HHH000262: Table not found: status_update
2016-11-27 21:55:35.145 INFO 8048 --- [ main] java.sql.DatabaseMetaData : HHH000262: Table not found: status_update
2016-11-27 21:55:35.592 INFO 8048 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete
2016-11-27 21:55:35.800 INFO 8048 --- [ main] org.apache.tiles.access.TilesAccess : Publishing TilesContext for context: org.springframework.web.servlet.view.tiles3.SpringWildcardServletTilesApplicationContext
2016-11-27 21:55:36.212 INFO 8048 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@71a794e5: startup date [Sun Nov 27 21:55:24 GMT 2016]; root of context hierarchy
2016-11-27 21:55:36.368 INFO 8048 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/admin]}" onto java.lang.String com.caveofprogramming.controllers.AuthController.admin()
2016-11-27 21:55:36.371 INFO 8048 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addstatus]}" onto java.lang.String com.caveofprogramming.controllers.PageController.addStatus()
2016-11-27 21:55:36.371 INFO 8048 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String com.caveofprogramming.controllers.PageController.home()
2016-11-27 21:55:36.371 INFO 8048 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/about]}" onto java.lang.String com.caveofprogramming.controllers.PageController.about()
2016-11-27 21:55:36.375 INFO 8048 --- [ main] 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)
2016-11-27 21:55:36.376 INFO 8048 --- [ main] 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)
2016-11-27 21:55:36.446 INFO 8048 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-27 21:55:36.446 INFO 8048 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-27 21:55:36.531 INFO 8048 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-27 21:55:37.046 INFO 8048 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-11-27 21:55:37.058 DEBUG 8048 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@7a83ccd2]
2016-11-27 21:55:37.069 DEBUG 8048 --- [ main] utoConfigurationReportLoggingInitializer :
Exclusions:
None
Unconditional classes:
----------------------
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
2016-11-27 21:55:37.427 INFO 8048 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9099 (http)
2016-11-27 21:55:37.436 INFO 8048 --- [ main] com.caveofprogramming.App : Started App in 14.024 seconds (JVM running for 15.077)