Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
首航-临时账号
api
Commits
bd35191b
Commit
bd35191b
authored
Sep 23, 2019
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加redis依赖
parent
d58bba2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
46 deletions
+9
-46
redis.properties
resources/redis.properties
+1
-0
spring-context.xml
resources/spring-context.xml
+7
-45
UserController.java
src/com/ejweb/modules/user/api/UserController.java
+1
-1
No files found.
resources/redis.properties
View file @
bd35191b
redis.host
=
106.75.105.96
redis.port
=
7211
redis.auth
=
bbdtek!@#2018
redis.timeout
=
10000
redis.maxTotal
=
100
redis.maxIdle
=
20
redis.maxWaitMillis
=
10000
...
...
resources/spring-context.xml
View file @
bd35191b
...
...
@@ -151,50 +151,11 @@
<property
name=
"testOnBorrow"
value=
"${redis.testOnBorrow}"
/>
<property
name=
"testOnReturn"
value=
"${redis.testOnReturn}"
/>
</bean>
<!--redis链接密码-->
<bean
id=
"redisPassword"
class=
"org.springframework.data.redis.connection.RedisPassword"
>
<constructor-arg
name=
"thePassword"
value=
"${redis.auth}"
></constructor-arg>
</bean>
<!--spring-data-redis2.0以上的配置-->
<bean
id=
"redisStandaloneConfiguration"
class=
"org.springframework.data.redis.connection.RedisStandaloneConfiguration"
>
<property
name=
"hostName"
value=
"${redis.host}"
/>
<property
name=
"port"
value=
"${redis.port}"
/>
<property
name=
"password"
ref=
"redisPassword"
/>
<property
name=
"database"
value=
"${redis.dbIndex}"
/>
</bean>
<!--配置jedis链接工厂 spring-data-redis2.0中
建议改为构造器传入一个RedisStandaloneConfiguration 单机
RedisSentinelConfiguration 主从复制
RedisClusterConfiguration 集群-->
<bean
id=
"jedisConnectionFactory"
class=
"org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
>
<!--spring-data-redis2.0以上建议获取的方式-->
<constructor-arg
name=
"standaloneConfig"
ref=
"redisStandaloneConfiguration"
></constructor-arg>
</bean>
<!--手动设置 key 与 value的序列化方式-->
<bean
id=
"keySerializer"
class=
"org.springframework.data.redis.serializer.StringRedisSerializer"
/>
<bean
id=
"valueSerializer"
class=
"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer"
/>
<!--配置jedis模板 -->
<bean
id=
"redisTemplate"
class=
"org.springframework.data.redis.core.RedisTemplate"
>
<property
name=
"connectionFactory"
ref=
"jedisConnectionFactory"
/>
<property
name=
"keySerializer"
ref=
"keySerializer"
/>
<property
name=
"valueSerializer"
ref=
"valueSerializer"
/>
<property
name=
"hashKeySerializer"
ref=
"keySerializer"
/>
<property
name=
"hashValueSerializer"
ref=
"valueSerializer"
/>
</bean>
<!--也可以StringRedisTemplate 专注于String的操作 -->
<bean
id=
"stringRedisTemplate"
class=
"org.springframework.data.redis.core.StringRedisTemplate"
>
<!--<property name="connectionFactory" ref="jedisConnectionFactory"></property>-->
<!--在StringRedisTemplate与redisTemplate不同,可以直接造构造器中传入ConnectionFactory-->
<constructor-arg
name=
"connectionFactory"
ref=
"jedisConnectionFactory"
></constructor-arg>
<property
name=
"keySerializer"
ref=
"keySerializer"
/>
<property
name=
"valueSerializer"
ref=
"valueSerializer"
/>
<property
name=
"hashKeySerializer"
ref=
"keySerializer"
/>
<property
name=
"hashValueSerializer"
ref=
"valueSerializer"
/>
<bean
id=
"jedisPool"
class=
"redis.clients.jedis.JedisPool"
>
<constructor-arg
name=
"poolConfig"
ref=
"jedisPoolConfig"
/>
<constructor-arg
name=
"host"
value=
"${redis.host}"
/>
<constructor-arg
name=
"port"
value=
"${redis.port}"
/>
<constructor-arg
name=
"timeout"
value=
"${redis.timeout}"
/>
<constructor-arg
name=
"password"
value=
"${redis.auth}"
/>
</bean>
</beans>
\ No newline at end of file
src/com/ejweb/modules/user/api/UserController.java
View file @
bd35191b
...
...
@@ -43,7 +43,7 @@ public class UserController {
@Autowired
private
UserService
userService
;
// @Autowired
// private OfficedService officedService;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment