Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
87c82310
Commit
87c82310
authored
Jan 30, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
1bf5768b
11f700aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
2 deletions
+50
-2
RedisConnectionConfiguration.java
...utoconfigure/data/redis/RedisConnectionConfiguration.java
+1
-1
RedisAutoConfigurationJedisTests.java
...onfigure/data/redis/RedisAutoConfigurationJedisTests.java
+23
-1
RedisAutoConfigurationTests.java
...autoconfigure/data/redis/RedisAutoConfigurationTests.java
+26
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisConnectionConfiguration.java
View file @
87c82310
...
...
@@ -132,7 +132,7 @@ abstract class RedisConnectionConfiguration {
String
password
=
null
;
if
(
uri
.
getUserInfo
()
!=
null
)
{
password
=
uri
.
getUserInfo
();
int
index
=
password
.
lastI
ndexOf
(
':'
);
int
index
=
password
.
i
ndexOf
(
':'
);
if
(
index
>=
0
)
{
password
=
password
.
substring
(
index
+
1
);
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java
View file @
87c82310
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -94,6 +94,28 @@ public class RedisAutoConfigurationJedisTests {
assertThat
(
cf
.
isUseSsl
()).
isTrue
();
}
@Test
public
void
testPasswordInUrlWithColon
()
{
load
(
"spring.redis.url:redis://:pass:word@example:33"
);
assertThat
(
this
.
context
.
getBean
(
JedisConnectionFactory
.
class
).
getHostName
())
.
isEqualTo
(
"example"
);
assertThat
(
this
.
context
.
getBean
(
JedisConnectionFactory
.
class
).
getPort
())
.
isEqualTo
(
33
);
assertThat
(
this
.
context
.
getBean
(
JedisConnectionFactory
.
class
).
getPassword
())
.
isEqualTo
(
"pass:word"
);
}
@Test
public
void
testPasswordInUrlStartsWithColon
()
{
load
(
"spring.redis.url:redis://user::pass:word@example:33"
);
assertThat
(
this
.
context
.
getBean
(
JedisConnectionFactory
.
class
).
getHostName
())
.
isEqualTo
(
"example"
);
assertThat
(
this
.
context
.
getBean
(
JedisConnectionFactory
.
class
).
getPort
())
.
isEqualTo
(
33
);
assertThat
(
this
.
context
.
getBean
(
JedisConnectionFactory
.
class
).
getPassword
())
.
isEqualTo
(
":pass:word"
);
}
@Test
public
void
testRedisConfigurationWithPool
()
{
load
(
"spring.redis.host:foo"
,
"spring.redis.jedis.pool.min-idle:1"
,
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java
View file @
87c82310
...
...
@@ -120,6 +120,32 @@ public class RedisAutoConfigurationTests {
});
}
@Test
public
void
testPasswordInUrlWithColon
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.redis.url:redis://:pass:word@example:33"
)
.
run
((
context
)
->
{
LettuceConnectionFactory
cf
=
context
.
getBean
(
LettuceConnectionFactory
.
class
);
assertThat
(
cf
.
getHostName
()).
isEqualTo
(
"example"
);
assertThat
(
cf
.
getPort
()).
isEqualTo
(
33
);
assertThat
(
cf
.
getPassword
()).
isEqualTo
(
"pass:word"
);
});
}
@Test
public
void
testPasswordInUrlStartsWithColon
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.redis.url:redis://user::pass:word@example:33"
)
.
run
((
context
)
->
{
LettuceConnectionFactory
cf
=
context
.
getBean
(
LettuceConnectionFactory
.
class
);
assertThat
(
cf
.
getHostName
()).
isEqualTo
(
"example"
);
assertThat
(
cf
.
getPort
()).
isEqualTo
(
33
);
assertThat
(
cf
.
getPassword
()).
isEqualTo
(
":pass:word"
);
});
}
@Test
public
void
testRedisConfigurationWithPool
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.redis.host:foo"
,
...
...
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