Skip to main content

Posts

Showing posts from June, 2016

Spring boot: configure it to find the webapp folder

See the docs:  http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-static-content The static resources are loaded from  /static ,  /public ,  /resources ,  /META-INF/resources Using  src/main/webapp  is not recommended. You can customize that by overriding the  addResourceHandlers  method in  WebMvcConfigurerAdapter @Configuration public class MvcConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers ( ResourceHandlerRegistry registry ){ registry . addResourceHandler ( "/**" ) . addResourceLocations ( "/" ) . setCachePeriod ( 0 ); } } http://stackoverflow.com/questions/28725635/spring-boot-configure-it-to-find-the-webapp-folder

Spring annotation

In Spring 2.0 and later, the @Repository annotation is a marker for any class that fulfills the role or stereotype (also known as Data Access Object or DAO) of a repository. Among the uses of this marker is the automatic translation of exceptions. Spring 2.5 introduces further stereotype annotations: @Component, @Service, and @Controller. @Component is a generic stereotype for any Spring-managed component. @Repository, @Service, and @Controller are specializations of @Component for more specific use cases, for example, in the persistence, service, and presentation layers, respectively. Therefore, you can annotate your component classes with @Component, but by annotating them with @Repository, @Service, or @Controller instead, your classes are more properly suited for processing by tools or associating with aspects. For example, these stereotype annotations make ideal targets for pointcuts. Thus, if you are choosing between using @Component or @Service for your service layer, @S

System design (转)

我的面试也结束了 因为知道FLAG这类公司都会问到System Design的问题 所以这次面 试着重准备了一下 在这里分享给大家 如果有不对或者需要补充的地方 大家可以留言 这里说的System Design和OO Design不同 System Design在FLAG以及很多大公司中主要 是design scalable distributed systems 这里只讨论如何准备这种题目 == 入门 == 对于0基础的同学们 下面的资料可以按顺序开始看 1. http://www.hiredintech.com/app#system-design 这是一个专门准备面试的网站 你只用关心system design部分 有很多的link后面会重 复提到 建议看完至少一遍 2. https://www.youtube.com/watch?v=-W9F__D3oY4 非常非常好的入门资料 建议看3遍以上! 这是1里面提到的资料 是Harvard web app课的最后一节 讲scalability 里面会讲到很 多基础概念比如Vertical scaling, Horizontal scaling, Caching, Load balancing, Database replication, Database partitioning 还会提到很多基本思想比如avoid  single point of failure 再强调一遍 非常好的资料! 3. http://www.lecloud.net/post/7295452622/scalability-for-dummies-part-1-clones 1里面提到的 Scalability for Dummies 还算不错 可以看一遍 知道基本思想 结束语:当你结束这一部分的学习的时候 你已经比50%的candidate知道的多了(因为很 多人都不准备 或者不知道怎么准备system design) 恭喜:) == 进阶 == 这一部分的资料更加零散 每个看的可能不一样 但是你每多看一篇文章或者一个视频  你就比别人强一点 这部分你会遇到很多新名词 我的建议是每当你遇到一个不懂的概念时 多google一下  看看这个概念或者技术是什么意思 优点和缺点各是什么 什么时候用 这些你都知道以 后 你就可以把他运用到面试中 让