上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 30 下一页
摘要: 热更新 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> 项目或 阅读全文
posted @ 2022-09-04 01:07 咖喱给给啊 阅读(39) 评论(0) 推荐(0)
摘要: 1.导入依赖 <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> idea中搜索安装lombok插件 简化JavaBean开发 @NoArgsConstruct 阅读全文
posted @ 2022-09-04 01:05 咖喱给给啊 阅读(21) 评论(0) 推荐(0)
摘要: 引入场景依赖 https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-starter 查看自动配置了哪些(选做) 自己分析,引入场景对应的自动配置一般都生效了 配 阅读全文
posted @ 2022-09-04 00:58 咖喱给给啊 阅读(25) 评论(0) 推荐(0)
摘要: 简单分析一下场景中的自动配置的流程 就拿springboot-autoconfiguration中的web场景来简单分析 进入web的servlet中的DispatcherServletAutoConfiguration 第一个是优先级不影响自动配置 第二个是是否单例,前端控制器不是单例的,因为是做 阅读全文
posted @ 2022-09-04 00:42 咖喱给给啊 阅读(133) 评论(0) 推荐(0)
摘要: @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan(excludeFilters = { @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.clas 阅读全文
posted @ 2022-09-03 05:13 咖喱给给啊 阅读(85) 评论(0) 推荐(0)
摘要: 如果我们直接使用原生配置文件的方式做配置的话,取值挺花时间的, 比如 public class getProperties { public static void main(String[] args) throws FileNotFoundException, IOException { Pro 阅读全文
posted @ 2022-09-03 03:38 咖喱给给啊 阅读(44) 评论(0) 推荐(0)
摘要: 在xml配置文件中配置的bean 在springboot中是无法正常使用的,因为用的不是这个方法了 ApplicationContext ctx= new ClassPathXmlApplicationContext("bean.xml");在springboot中用的 SpringApplicat 阅读全文
posted @ 2022-09-03 03:09 咖喱给给啊 阅读(40) 评论(0) 推荐(0)
摘要: @Conditional 条件装配:满足Conditional指定的条件,则进行组件注入 @ConditionalOnBean(name = "tom") 存在这个tom时为真,真即执行配置类中全部的@bean下的方法,实例对象放入容器@ConditionalOnMissingBean(name = 阅读全文
posted @ 2022-09-03 02:50 咖喱给给啊 阅读(39) 评论(0) 推荐(0)
摘要: @Import * @Import({User.class, DBHelper.class}) * 给容器中自动创建出这两个类型的组件、默认组件的名字就是全类名 就是导入这两个类,实例化放入容器中 阅读全文
posted @ 2022-09-03 01:40 咖喱给给啊 阅读(41) 评论(0) 推荐(0)
摘要: 1.@configuration注解是代表一个配置类 @configuration public class myconfig{ @Bean public user user1(){ return new user(zhangsan,22); 给容器中添加组件,方法名是组件ID,返回类型就是方法类型 阅读全文
posted @ 2022-09-03 01:38 咖喱给给啊 阅读(37) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 30 下一页