摘要:最近通过vue cli写了个前端,想通过axios来访问后端接口,结果就报错: No 'Access-Control-Allow-Origin' header is present on the requested resource 跨域可以通过前端解决,也可通过nginx代理解决,也可以通过后端解
阅读全文
摘要:spring boot为各种场景定义了各种starter,称之为场景启动器,引入starter依赖后,SpringBoot就能自动扫描到要加载的信息并启动相应的默认配置,你也可以自己配置一些属性。现在我们自己写一个Starter。 首先看看官方文档对一个starter的要求: A full Spri
阅读全文
摘要:关于Spring AOP,可以去看看官方文档: https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#aop Aspect: A modularization of a co
阅读全文
摘要:继续之前的项目: People加上无参构造方法: @Component public class People { // private User user; public People(){ System.out.println("create People"); } } 在refresh()方法
阅读全文
摘要:访问https://spring.io/ spring boot中: public class MyWebApplicationInitializer implements WebApplicationInitializer { @Override public void onStartup(Ser
阅读全文
摘要:其实就是别人提供了一个类,读取指定目录下的文件,通过反射方式创建对象。 为什么来说spi?因为spring boot就是通过spi来创建对象的。 首先写一个接口: public interface TestInterface { void test(); } 写几个实现类: public class
阅读全文