17:57:19: Executing task ‘bootRun‘...
Parallel execution with configuration on demand is an incubating feature.
:thinkvenus-common:compileJava
:thinkvenus-tool:processResources UP-TO-DATE
:thinkvenus-common:compileJava UP-TO-DATE
:thinkvenus-common:processResources UP-TO-DATE
:thinkvenus-common:classes UP-TO-DATE
:thinkvenus-common:jar UP-TO-DATE
:thinkvenus-tool:compileJava UP-TO-DATE
:thinkvenus-tool:classes UP-TO-DATE
:thinkvenus-tool:findMainClass
:thinkvenus-tool:bootRun
. ____ _ __ _ _
/\\ / ___‘_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | ‘_ | ‘_| | ‘_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
‘ |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE)
2017-12-12 17:57:21.856 INFO 6176 --- [ main] c.t.tool.controller.SampleController : Starting SampleController on MAO-MAO with PID 6176 (D:\java\ThinkVenus\thinkvenus-tool\build\classes\main started by mao.mao in D:\java\ThinkVenus\thinkvenus-tool)
2017-12-12 17:57:21.856 INFO 6176 --- [ main] c.t.tool.controller.SampleController : No active profile set, falling back to default profiles: default
2017-12-12 17:57:22.121 INFO 6176 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5d20e46: startup date [Tue Dec 12 17:57:22 CST 2017]; root of context hierarchy
2017-12-12 17:57:22.605 INFO 6176 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean ‘dataSource‘ with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Dbcp2; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Dbcp2.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]]
2017-12-12 17:57:23.464 INFO 6176 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-12-12 17:57:23.480 INFO 6176 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-12-12 17:57:23.480 INFO 6176 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
2017-12-12 17:57:23.620 INFO 6176 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-12-12 17:57:23.620 INFO 6176 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1499 ms
2017-12-12 17:57:23.745 INFO 6176 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: ‘dispatcherServlet‘ to [/]
2017-12-12 17:57:23.761 INFO 6176 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘characterEncodingFilter‘ to: [/*]
2017-12-12 17:57:23.761 INFO 6176 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘hiddenHttpMethodFilter‘ to: [/*]
2017-12-12 17:57:23.761 INFO 6176 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘httpPutFormContentFilter‘ to: [/*]
2017-12-12 17:57:23.761 INFO 6176 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘requestContextFilter‘ to: [/*]
2017-12-12 17:57:24.026 INFO 6176 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5d20e46: startup date [Tue Dec 12 17:57:22 CST 2017]; root of context hierarchy
2017-12-12 17:57:24.088 INFO 6176 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String com.thinkvenus.tool.controller.SampleController.home()
2017-12-12 17:57:24.104 INFO 6176 --- [ 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)
2017-12-12 17:57:24.104 INFO 6176 --- [ 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)
2017-12-12 17:57:24.120 INFO 6176 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-12 17:57:24.120 INFO 6176 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-12 17:57:24.166 INFO 6176 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-12 17:57:24.260 WARN 6176 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘ defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method ‘dataSource‘ threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2017-12-12 17:57:24.260 INFO 6176 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-12-12 17:57:24.260 INFO 6176 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2017-12-12 17:57:24.291 INFO 6176 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug‘ enabled.
2017-12-12 17:57:24.291 ERROR 6176 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
:thinkvenus-tool:bootRun FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ‘:thinkvenus-tool:bootRun‘.
> Process ‘command ‘C:\Program Files\Java\jdk1.8.0_60\bin\java.exe‘‘ finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.587 secs
Process ‘command ‘C:\Program Files\Java\jdk1.8.0_60\bin\java.exe‘‘ finished with non-zero exit value 1
17:57:24: Task execution finished ‘bootRun‘.
在多方查证后,需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。
后期在继续抽取spring boot底层功能封装时,会从源码找到此问题发生的原因,并更新此文章