Browse Source

batch update

wenwan 6 years ago
parent
commit
a343f52b1d

+ 71 - 1
basic-knowledge/springboot-javaConfig.md

@@ -71,6 +71,14 @@ public class PersonProperties {
 	private int age;
 }
 ```
+
+* @EnableConfigurationProperties
+
+用 @EnableConfigurationProperties注解使 @ConfigurationProperties生效,并从IOC容器中获取bean。
+
+https://blog.csdn.net/u010502101/article/details/78758330
+
+
 * @RestController
 
 组合@Controller和@ResponseBody,当你开发一个和页面交互数据的控制时,比如bbs-web的api接口需要此注解
@@ -173,6 +181,14 @@ public class TestController {
 
 路由网关的主要目的是为了让所有的微服务对外只有一个接口,我们只需访问一个网关地址,即可由网关将所有的请求代理到不同的服务中。Spring Cloud是通过Zuul来实现的,支持自动路由映射到在Eureka Server上注册的服务。Spring Cloud提供了注解@EnableZuulProxy来启用路由代理。
 
+* Autowired
+
+在默认情况下使用 @Autowired 注释进行自动注入时,Spring 容器中匹配的候选 Bean 数目必须有且仅有一个。当找不到一个匹配的 Bean 时,Spring 容器将抛出 BeanCreationException 异常,并指出必须至少拥有一个匹配的 Bean。
+
+当不能确定 Spring 容器中一定拥有某个类的 Bean 时,可以在需要自动注入该类 Bean 的地方可以使用 @Autowired(required = false),这等于告诉 Spring:在找不到匹配 Bean 时也不报错
+
+[@Autowired注解注入map、list与@Qualifier](https://blog.csdn.net/ethunsex/article/details/66475792)
+
 
 * @Configuration
 
@@ -219,4 +235,58 @@ public class CDPlayerConfig {
         return new CDPlayer(compactDisc);
     }
 }
-```
+```
+
+* @Order
+
+@Order(1),值越小优先级超高,越先运行
+
+* @ConditionalOnExpression
+
+```
+@Configuration
+@ConditionalOnExpression("${enabled:false}")
+public class BigpipeConfiguration {
+    @Bean
+    public OrderMessageMonitor orderMessageMonitor(ConfigContext configContext) {
+        return new OrderMessageMonitor(configContext);
+    }
+}
+```
+
+开关为true的时候才实例化bean
+
+* @ConditionalOnProperty
+
+这个注解能够控制某个 @Configuration 是否生效。具体操作是通过其两个属性name以及havingValue来实现的,其中name用来从application.properties中读取某个属性值,如果该值为空,则返回false;如果值不为空,则将该值与havingValue指定的值进行比较,如果一样则返回true;否则返回false。如果返回值为false,则该configuration不生效;为true则生效。
+
+https://blog.csdn.net/dalangzhonghangxing/article/details/78420057
+
+* @ConditionalOnClass
+
+该注解的参数对应的类必须存在,否则不解析该注解修饰的配置类
+
+```
+@Configuration
+@ConditionalOnClass({Gson.class})
+public class GsonAutoConfiguration {
+    public GsonAutoConfiguration() {
+    }
+
+    @Bean
+    @ConditionalOnMissingBean
+    public Gson gson() {
+        return new Gson();
+    }
+}
+
+```
+
+* @ConditionalOnMisssingClass({ApplicationManager.class})
+
+如果存在它修饰的类的bean,则不需要再创建这个bean;
+
+
+* @ConditionOnMissingBean(name = "example")
+
+表示如果name为“example”的bean存在,该注解修饰的代码块不执行。

+ 3 - 1
other/intellij.md

@@ -7,6 +7,7 @@
 #### 快捷键
 
 * [将intellij idea的快捷键与Eclipse的快捷键设置成一样](http://blog.csdn.net/boot_strap/article/details/21729143)
+* [快捷键---IntelliJ IDEA全局内容搜索和替换](https://blog.csdn.net/gnail_oug/article/details/78281354)
 * [如何打开Intellij IDEA的代码提示功能](https://jingyan.baidu.com/article/36d6ed1f62e9821bcf4883af.html)
 * [IntelliJ IDEA 设置选中标识符高亮](http://blog.csdn.net/wskinght/article/details/43052407)
 * [IDEA提示方法的注释](https://www.oschina.net/question/100896_83213)
@@ -21,4 +22,5 @@
 * Intellij IDEA中常用快捷键(main, try/catch) ---> command+option+Z
 
 #### 常见问题
-* [修改IntelliJ IDEA中Maven项目的默认JDK版](https://blog.csdn.net/geekun/article/details/51325510)
+* [修改IntelliJ IDEA中Maven项目的默认JDK版](https://blog.csdn.net/geekun/article/details/51325510)
+* [idea的环境变量设置(Enviroment variables)](https://www.cnblogs.com/gradven/p/7228142.html)

+ 1 - 0
other/java-interview.md

@@ -21,3 +21,4 @@
 * [关于 MySQL 的知识点与面试常见问题都在这里](https://mp.weixin.qq.com/s/ENQZii1xgxlsIbR-oMseKw)
 * [Java架构师面试题全分享](https://mp.weixin.qq.com/s/md2r34uwVC13KSeROmuZDg)
 * [Java-Interview(出自github)](https://github.com/crossoverJie/Java-Interview)
+* [作为面试官,我是怎么快速判断程序员能力的?](https://mp.weixin.qq.com/s/SodWSw-3zSWRYmxZNvjlgA)

+ 2 - 0
system-architecture/architecture-experience.md

@@ -79,6 +79,8 @@
 * 限流
 	* [如何设计API的限流](如何设计API的限流.md)
 	* [分布式限流](https://mp.weixin.qq.com/s/VXu82MgWwn993n8fSlaNtg)
+	* [探索常见的几种限流策略和实现](https://mp.weixin.qq.com/s/GEu7UVO7s_HX88T_DmBmnQ)
+	
 * 容灾
 * 隔离
 * 异地双活

+ 1 - 0
web/http.md

@@ -4,6 +4,7 @@
 ### 资料
 
 * [HTTP/2到底是什么?](https://mp.weixin.qq.com/s/MNbjdnSeoeSlTwuXokaXMQ)
+* [彻底弄懂 HTTP 缓存机制及原理](https://mp.weixin.qq.com/s/qnBExJ0sjVmhk8UTxAPK1Q)
 
 ---
 HTTP协议是指计算机通信网络中两台计算机之间进行通信所必须共同遵守的规定或规则,超文本传输协议(HTTP)是一种通信协议,它允许将超文本标记语言(HTML)文档从Web服务器传送到客户端的浏览器。