. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.4.RELEASE)
2018-09-11 04:11:33.381 INFO 19674 --- [ main] com.eoitek.hello.HelloApplication : Starting HelloApplication on dongjunqiangde-MacBook-Pro.local with PID 19674 (/Users/eoino1/Downloads/hello/target/classes started by eoino1 in /Users/eoino1/Downloads/hello)
2018-09-11 04:11:33.385 INFO 19674 --- [ main] com.eoitek.hello.HelloApplication : No active profile set, falling back to default profiles: default
2018-09-11 04:11:33.582 INFO 19674 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2357d90a: startup date [Tue Sep 11 04:11:33 CST 2018]; root of context hierarchy
2018-09-11 04:11:35.408 INFO 19674 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-09-11 04:11:35.452 INFO 19674 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-09-11 04:11:35.452 INFO 19674 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32
2018-09-11 04:11:35.465 INFO 19674 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/eoino1/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-09-11 04:11:35.600 INFO 19674 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-09-11 04:11:35.600 INFO 19674 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2023 ms
2018-09-11 04:11:35.675 INFO 19674 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-09-11 04:11:35.680 INFO 19674 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-09-11 04:11:35.681 INFO 19674 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-09-11 04:11:35.681 INFO 19674 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-09-11 04:11:35.681 INFO 19674 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-09-11 04:11:35.826 INFO 19674 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-09-11 04:11:36.062 INFO 19674 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2357d90a: startup date [Tue Sep 11 04:11:33 CST 2018]; root of context hierarchy
2018-09-11 04:11:36.173 INFO 19674 --- [ 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.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-09-11 04:11:36.175 INFO 19674 --- [ 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.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-09-11 04:11:36.218 INFO 19674 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-09-11 04:11:36.219 INFO 19674 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-09-11 04:11:36.448 INFO 19674 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-09-11 04:11:36.518 INFO 19674 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-09-11 04:11:36.523 INFO 19674 --- [ main] com.eoitek.hello.HelloApplication : Started HelloApplication in 4.29 seconds (JVM running for 4.955)
create database microservice;
use microservice;
create table tb_user(id int(32) primary key auto_increment,username varchar(32),address varchar(256));
alter table tb_user default character set utf8;
show create table tb_user;
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tb_user | CREATE TABLE `tb_user` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`username` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
`address` varchar(256) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
alter table tb_user change username username varchar(32) character set utf8;
alter table tweets change WeiboContent WeiboContent varchar(350) character set utf8mb4 collate utf8mb4_unicode_ci; //或者 alter table tweets modify column WeiboContent varchar(350) character set utf8mb4 collate utf8mb4_unicode_ci default null;
SpringApplication.run(HelloApplication.class,args)
SpringApplication初始化时
1 根据classpath内是否存在某个特征来判断是否为web应用,并使用webEnvironment标记是否为web应用
2 使用SpringFactoriesLoader在classpath中的spring.factories文件查找并加载所有可用的ApplicationContextInitializer
3 使用SpringFactoriesLoader在classpath中的spring.factories文件查找并加载所有可用的ApplicationListener
4 推断并设置main()方法的定义类
二
1 查找并加载spring.factories中配置的SpringApplicationRunListener,并调用他们的started()方法,告诉SpringApplicationRunListener,spring应用就要执行了。
2 创建并配置当前spring boot 应用要使用的Environment,然偶遍历调用所有