BlankCat

BlankCat


  • Home

  • Archives

  • Categories

  • Tags

  • About

  • Search
close

mybatis-memcached框架配置

Posted on 2015-02-06   |   In Java

官方放出了mybatis和memcached的整合包,先附上官方文档地址
http://mybatis.github.io/memcached-cache/
文档很简洁,事实证明使用起来也很简单
memcached的安装我这里就不再讲了,网上很容易找到
在项目中引入

1
2
3
4
5
<dependency>
<groupId>org.mybatis.caches</groupId>
<artifactId>mybatis-memcached</artifactId>
<version>1.0.0</version>
</dependency>

Read more »

centos6.5使用yum安装mysql

Posted on 2015-01-31   |   In centos

要使用yum 安装mysql,要使用mysql的yum仓库,先从官网下载适合你系统的仓库
http://dev.mysql.com/downloads/repo/yum/
centos 6.5 对应的是mysql-community-release-el6-5.noarch.rpm
然后安装一下这个仓库列表

1
sudo yum localinstall mysql-community-release-el6-5.noarch.rpm

执行这个命令后就能看到可安装的mysql

1
yum repolist enabled | grep "mysql.*-community.*"

Read more »

Spring mvc @ResponseBody 返回枚举类型

Posted on 2015-01-31   |   In spring

我们在用@ResponseBody返回实体对象可以用spring mvc自动帮我们转化成json串
但是当实体中包含了枚举类型的属性的时候怎么办,我这里使用的是fastjson,他默认是转换成了字符串。
根据我上一篇博文的解决方案,我们这里自定义一个FastJsonHttpMessageConverter

Read more »

fastjson序列化枚举属性

Posted on 2015-01-30   |   In Java

我的实体类里面有一个属性是枚举类型的,但是我在转换的时候我不希望取它的name,而是它的索引值0,1,2,3,搜索一番后发现这个回答

fastjson enum 枚举 反序列化
为了方便大家查看,我把内容贴过来
看fastjson源码,SerializeWriter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public void writeEnum( Enum < ?>value, char c )
{
if ( value == null )
{
writeNull();  
write( ',' );  
return;  
}
if ( isEnabled( SerializerFeature.WriteEnumUsingToString ) )
{
if ( isEnabled( SerializerFeature.UseSingleQuotes ) )
{
write( '\'' );  
write( value.name() );  
write( '\'' );  
write( c );
} else {
write( '\"' );  
write( value.name() );  
write( '\"' );  
write( c );  
}  
return;  
}
writeIntAndChar( value.ordinal(), c );  
}

Read more »
1…89
BlankCat

BlankCat

三岁学说话,一生学闭嘴!

84 posts
25 categories
46 tags
GitHub Weibo 开发导航 个人主页
© 2017 BlankCat
Powered by Hexo
Theme - NexT.Mist