spring boot
重要插件:
maven-shade-plugin
spring-boot-maven-plugin
重要命令:
mvn spring-boot:run
java -jar xxx.jar
java -jar xxx.war
java -jar xxx.war --spring.profiles.active=prod
启动流程:
1.spring boot应用打包之后,生成一个fat jar,里面包含了应用依赖的jar包,还有Spring boot loader相关的类
2.Fat jar的启动Main函数是JarLauncher,它负责创建一个LaunchedURLClassLoader来加载/lib下面的jar,并以一个新线程启动应用的Main函数。
(LaunchedURLClassLoader和普通的URLClassLoader的不同之处是,它提供了从Archive里加载.class的能力)
(spring boot在启动时,先通过一个简单的查找Servlet类的方式来判断是不是在web环境,
如果是的话,则会创建AnnotationConfigEmbeddedWebApplicationContext,
否则Spring context就是AnnotationConfigApplicationContext)
基本组件:
(非web)spring-boot-starter
(web)spring-boot-starter-web
测试组件:
spring-boot-starter-test
重要组件:
Spring Boot Actuator
spring Boot Starters
(spring-boot-starter-actuator)
(spring-boot-starter-remote-shell)
重要属性:
endpoints.shutdown.sensitive=false (no-auth)
endpoints.shutdown.enabled=true (curl -X POST localhost:port/shutdown)
重要辅助:
chrome: ctrl+shift+n
ctrl+shift+f5 ctrl+shift+r 强制刷新(不使用本地缓存)
ctrl+f5 or ctrl+r or f5 刷新(使用本地缓存或者内存缓存)
f12 or ctrl+shift+i
client强制nginx不缓存:
Cache-control:no-cache、no-store
nginx强制nginx不缓存:
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
spring cloud
config 配置 配置中心(configcenter) (config server + config client)
netflix euraka 疑惑 服务发现器(discovery) (eureka server + eureka client)
netflix hystrix 豪猪 断路器(circuit braker)
netflix zuul 祖鲁 负载均衡器(load balancer for server)
netflix ribbon 布条 负载均衡器(load balancer for client)
netflix archaius 配置管理api
netfix turbine 汽轮机 仪表(dashboard)
netflix feign 伪装 rest客户端
bus 总线 消息
sleuth 足迹 追踪器