spring-boot不同包结构下,同名类冲突导致服务启动失败解决方案
spring提供两种beanName生成策略,基于注解的sprongboot默认使用的是AnnotationBeanNameGenerator,它生成beanName的策略就是,取当前类名(不是全限定类名)作为beanName。由此,如果出现不同包结构下同样的类名称,肯定会出现冲突。解决方法如下:一、自己写一个类实现 org.springframework.beans.factory.sup...
SpringBoot读取 Resource下文件
SpringBoot 项目在打包成jar文件后运行在服务器上后是无法读取到 jar 文件中的内容的,读取只能通过类加载器读取方法一ClassPathResource classPathResource = new ClassPathResource("templates/index.html");
InputStream inputStream = classPathRe...
spring mvc中的几类拦截器对比
主要分Filter及interceptorFilter是servlet规范中的Filter,spring中有一个基本的实现叫做org/springframework/web/filter/GenericFilterBean.javapublic abstract class GenericFilterBean implements
Filter, BeanNameAware,...