自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 问答 (4)
  • 收藏
  • 关注

原创 java:IO流递归查询目录下所有文件

public static void listDirectory(File dir) throws IOException { if (!dir.exists()) { throw new IllegalArgumentException("目录" + dir + "不存在"); } if (!dir.isDirectory()) { throw new IllegalArgumentException.

2020-06-07 01:55:00 300

原创 Spring:通过注解懒加载及初始化与销毁

通过注解懒加载:在Bean上加上@Lazy在@Configuration下加入@Lazy,则所有Bean都开启懒加载模式通过注解编写Bean初始化及销毁:1.将Bean的类实现DisposableBean接口 与 InitializingBean接口在destroy()方法 //销毁与afterPropertiesSet()方法//初始化下进行操作2.在自己写的销毁或者初始化方法上加上@PostConstruct //初始化@PreDestroy //销毁3.在@Bean中加ini

2020-06-05 02:54:35 485

原创 Spring: 通过注解设定Bean作用域:

在被管理的Bean上标明@Scope("")自定义作用域:在管理类中创建一个自定义作用域的方法并加上@Bean标签例如:` @Bean public MyScope myScope() { return new MyScope(); } @Bean public CustomScopeConfigurer customScopeConfigurer() { CustomScopeConfigurer customScopeConfigur

2020-06-05 01:56:05 305

原创 Spring:通过注解注入Bean

1.通过构造方法:在构造方法上加上注解@Autowired2.通过set方法:在get方法上加上注解@Autowired3.通过属性直接注入:在private属性上直接加@Autowired(不需要get set方法)4.通过list/set注入:现在的版本好像不支持,我测试起来会报错,没有深入研究了将多个泛型实例注入List时,可以用@Order(number) 来控制输出顺序,number越小,则优先级越大。5.简单类型的注入:是用@Value将值注入,并通过getSet方法来获取,输出6.

2020-06-04 17:25:02 314

原创 Spring:XML管理Bean vs Annotation

ApplicationContext ctx = new ClassPathXmlApplicationContext(""); 需改为ApplicationContext context = new AnnotationConfigApplicationContext(MyConfiguration.class); MyConfiguration类需要加上注解@Configuration 并在需要转成Bean的方法上加上注解@Bean,方法名则是方法名,...

2020-06-04 16:30:41 146

原创 Spring之三种方法实例化Bean

1.使用构造方法实例化BeanBean1public class Bean1 { public Bean1() { System.out.println("Bean.Bean"); }}SpringBeans.xml <bean id="bean1" class="com.Learn.Class.Bean1" />TestclassApplicationContext ctx=new ClassPathXmlApplicationC

2020-05-29 17:33:23 138

原创 Springboot:事务

事务特指数据库事务事务用@Transactional(spring提供的注解)MySql数据库用InnoDB引擎,支持事务

2020-05-27 17:01:50 163

原创 SpringBoot:jdbc serverTimezone以及编码格式设置

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]: BeanPo.

2020-05-27 02:14:27 908

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除