上一页 1 2 3 4 5 6 7 8 ··· 13 下一页
摘要: 点击查看代码 ConfigurableApplicationContext context = SpringApplication.run(A45.class, args); Bean1 proxy = context.getBean(Bean1.class); /* 1.演示 spring 代理的 阅读全文
posted @ 2022-07-16 14:58 xy7112 阅读(23) 评论(0) 推荐(0)
摘要: 项目中,只需要加入以下依赖即可 在编译期扫描结束 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-indexer</artifactId> <optional>true</optional> 阅读全文
posted @ 2022-07-16 14:46 xy7112 阅读(53) 评论(0) 推荐(0)
摘要: 点击查看代码 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(A43.class); Bean1 bean1 = (Bean1) context.getBean("bean1"); 阅读全文
posted @ 2022-07-16 14:34 xy7112 阅读(19) 评论(0) 推荐(0)
摘要: 条件装配的底层是本质上是 @Conditional 与 Condition,这两个注解。引入自动配置类时,期望满足一定条件才能被 Spring 管理,不满足则不管理,怎么做呢? 比如条件是【类路径下必须有 dataSource】这个 bean ,怎么做呢? 首先编写条件判断类,它实现 Conditi 阅读全文
posted @ 2022-07-16 13:41 xy7112 阅读(28) 评论(0) 推荐(0)
摘要: AopAutoConfiguration Spring Boot 是利用了自动配置类来简化了 aop 相关配置 AOP 自动配置类为 org.springframework.boot.autoconfigure.aop.AopAutoConfiguration 可以通过 spring.aop.aut 阅读全文
posted @ 2022-07-15 22:48 xy7112 阅读(106) 评论(0) 推荐(0)
摘要: Tomcat 基本结构 Server └───Service ├───Connector (协议, 端口) └───Engine └───Host(虚拟主机 localhost) ├───Context1 (应用1, 可以设置虚拟路径, / 即 url 起始路径; 项目磁盘路径, 即 docBase 阅读全文
posted @ 2022-07-15 15:10 xy7112 阅读(44) 评论(0) 推荐(0)
摘要: 阶段一:SpringApplication 构造 点击查看代码 构造源码: public SpringApplication(Class<?>... primarySources) { this(null, primarySources); } public SpringApplication(Re 阅读全文
posted @ 2022-07-14 20:34 xy7112 阅读(31) 评论(0) 推荐(0)
摘要: 步骤1:创建模块,区别在于打包方式选择 war 接下来勾选 Spring Web 支持 步骤2:编写控制器 @Controller public class MyController { @RequestMapping("/hello") public String abc() { System.o 阅读全文
posted @ 2022-07-14 15:25 xy7112 阅读(30) 评论(0) 推荐(0)
摘要: 如果是 linux 环境,用以下命令即可获取 spring boot 的骨架 pom.xml curl -G https://start.spring.io/pom.xml -d dependencies=web,mysql,mybatis -o pom.xml -d dependencies=相关 阅读全文
posted @ 2022-07-14 15:13 xy7112 阅读(34) 评论(0) 推荐(0)
摘要: 当浏览器发送一个请求 http://localhost:8080/hello 后,请求到达服务器,其处理流程是: 服务器提供了 DispatcherServlet,它使用的是标准 Servlet 技术 路径:默认映射路径为 /,即会匹配到所有请求 URL,可作为请求的统一入口,也被称之为前控制器 j 阅读全文
posted @ 2022-07-14 15:07 xy7112 阅读(35) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页