摘要:
@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
咖喱给给啊
阅读(41)
评论(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
咖喱给给啊
阅读(42)
评论(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.当导入某个场景,比如web场景,就会自动导入web相关的所有依赖 tomcat也导入了,那就说明tomcat是内嵌到springboot中了 自动配好SpringMVC 引入SpringMVC全套组件 自动配好SpringMVC常用组件(功能) 自动配好Web常见功能,如:字符编码问题 Spri 阅读全文
posted @ 2022-09-03 01:10
咖喱给给啊
阅读(84)
评论(0)
推荐(0)
摘要:
在编写springboot的时候 只需要导入starter-web,关于wab的所有依赖都进来了,为什么会进来 1.父项目做依赖管理 在每个项目中的pom.xml都会存在这么一个配置依赖管理 <parent> <groupId>org.springframework.boot</groupId> < 阅读全文
posted @ 2022-09-03 00:17
咖喱给给啊
阅读(58)
评论(0)
推荐(0)
浙公网安备 33010602011771号