摘要: 获取方法的返回值类型 方法 描述 Type getGenericReturnType() 返回表示返回值类型的Type对象 Class<?> getReturnType() 返回表示返回值类型的Class对象 这两个方法的区别主要是在返回值类型上:-Type是一个接口-Class是一个Type接口的 阅读全文
posted @ 2020-12-17 16:54 Bonnie_ξ 阅读(158) 评论(0) 推荐(0)
摘要: 反射能干什么 得到 Class 的三种方式 Person p1 = new Person(); Class c1 = p1.getClass(); Class c2 = Person.class; Class c3 = Class.forName("com.ys.reflex.Person"); 通 阅读全文
posted @ 2020-12-17 14:14 Bonnie_ξ 阅读(66) 评论(0) 推荐(0)
摘要: spring 中初始化和销毁有三种办法 1、实现接口 DisposableBean ,initilzingBean2、使用注解 @PostConstructor, @PreDestory3、@Bean(initMethod = "",destroyMethod="") package com.sha 阅读全文
posted @ 2020-12-17 11:44 Bonnie_ξ 阅读(229) 评论(0) 推荐(0)
摘要: spring 读取配置文件 spring 注解 @PropertySource 引入文件 @Value读取文件内容,EmbeddedValueResolverAware读取文件内容 @Value注解: 1、基本数值; 2、可以写SpEL; #{}; 3、可以写${};取出配置文件【propertie 阅读全文
posted @ 2020-12-17 10:45 Bonnie_ξ 阅读(114) 评论(0) 推荐(0)
摘要: 使用Spring-jdbcTemplate准备 引入jar包(Spring基础jar包、aop、jdbc、tx、MySql驱动) 配置dataSource源 <!--引入本地数据库配置--> <context:property-placeholder location="classpath:jdbc 阅读全文
posted @ 2020-12-16 10:34 Bonnie_ξ 阅读(116) 评论(0) 推荐(0)
摘要: JdbcTemplate 入门示例 pom <dependencies> <!--Spring核心包--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <ver 阅读全文
posted @ 2020-12-16 10:13 Bonnie_ξ 阅读(210) 评论(0) 推荐(0)
摘要: 在Java领域,数据持久化有几个常见的方案,有Spring自带的JdbcTemplate、有MyBatis,还有JPA,在这些方案中,最简单的就是Spring自带的JdbcTemplate了,这个东西虽然没有MyBatis那么方便,但是比起最开始的Jdbc已经强了很多了,它没有MyBatis功能那么 阅读全文
posted @ 2020-12-16 09:32 Bonnie_ξ 阅读(182) 评论(0) 推荐(0)
摘要: commons 常用依赖项 <!-- commons --> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.2</versio 阅读全文
posted @ 2020-12-07 09:23 Bonnie_ξ 阅读(2353) 评论(0) 推荐(0)
摘要: SerializeFilter SerializeFilter是通过编程扩展的方式定制序列化。fastjson支持6种SerializeFilter,用于不同场景的定制序列化。 PropertyPreFilter 根据PropertyName判断是否序列化 PropertyFilter 根据Prop 阅读全文
posted @ 2020-12-04 09:52 Bonnie_ξ 阅读(583) 评论(0) 推荐(0)
摘要: 通过maven引入相应的json包 <dependencies> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.49</version> </dependency> 阅读全文
posted @ 2020-12-04 09:32 Bonnie_ξ 阅读(307) 评论(0) 推荐(0)