javaee
renwendaojian
这个作者很懒,什么都没留下…
展开
-
Java 中接口为什么可以调用 toString 方法,接口中根本就没有 toString 方法?
作者:蓝枫铭链接:https://www.zhihu.com/question/24113953/answer/27172633来源:知乎著作权归作者所有,转载请联系作者获得授权。感谢 @pansz 提供的官方链接,遗憾的是他的解释并不准确:原文:If an interface has no direct superinterfaces, then the inte转载 2017-05-25 10:40:32 · 352 阅读 · 0 评论 -
Spring注解@Resource和@Autowired区别对比
@Resource和@Autowired都是做bean的注入时使用,其实@Resource并不是Spring的注解,它的包是javax.annotation.Resource,需要导入,但是Spring支持该注解的注入。1、共同点两者都可以写在字段和setter方法上。两者如果都写在字段上,那么就不需要再写setter方法。2、不同点(1)@Autowired转载 2017-11-20 20:28:30 · 294 阅读 · 0 评论 -
Spring 开启Annotation <context:annotation-config> 和 <context:component-scan>诠释及区别
Spring 开启Annotation 和 诠释及区别 和 的区别 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过package sanning的方式)上面的注解。除了具有的功能之外,还可以在指定的package下扫描以及注册javabean 。下面我们通过例子来详细查看他们的区别,有三个class A,B,C,并且B,C的对象转载 2018-01-30 22:33:25 · 135 阅读 · 0 评论 -
IntelliJ IDEA(2017)安装和破解
IntelliJ IDEA(2017)安装和破解 如果有一定的经济基础,请支持正版,这里提供破解方法。一、下载并安装, IntelliJ IDEA的官网:https://www.jetbrains.com下载下载下载二、破解。百度下载一个 JetbrainsCrack-2.6.2.jar 破解补丁。放在你的安装idea下面的b原创 2018-01-30 13:45:56 · 319 阅读 · 0 评论 -
InputStream转换中文乱码
在new InputStreamReader()要指定charset避免中文乱码public class PropertiesDemo { private static Logger logger = LoggerFactory.getLogger(PropertiesDemo.class); private static Properties props = new Proper...原创 2018-03-30 18:25:46 · 7607 阅读 · 0 评论 -
jackson中序列化为Json中注解的使用
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)//json序列化时,属性为null不参与序列化public class PicUploadResult { //上传是否成功的判断标识,0-成功,1-失败 private Integer error; private String url; ...原创 2018-04-18 14:56:33 · 1454 阅读 · 0 评论 -
JsonUtils类的封装实现Object与json序列化与反序列化
public class JsonUtils { // 定义jackson对象 private static final ObjectMapper MAPPER = new ObjectMapper(); /** * 将对象转换成json字符串。 * <p>Title: pojoToJson</p> * <p&...原创 2018-04-18 15:09:09 · 2260 阅读 · 0 评论 -
Spring中使用两种Aware接口自定义获取bean
在使用spring编程时,常常会遇到想根据bean的名称来获取相应的bean对象,这时候,就可以通过实现BeanFactoryAware来满足需求,代码很简单:@Servicepublic class BeanFactoryHelper implements BeanFactoryAware { private static BeanFactory beanFactory; ...原创 2018-04-26 10:07:50 · 208 阅读 · 0 评论