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
bce6bd65
Commit
bce6bd65
authored
Jun 17, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
7b5df365
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
MongoProperties.java
...ngframework/boot/autoconfigure/mongo/MongoProperties.java
+2
-2
MongoAutoConfigurationTests.java
...boot/autoconfigure/mongo/MongoAutoConfigurationTests.java
+4
-6
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java
View file @
bce6bd65
...
...
@@ -18,7 +18,7 @@ package org.springframework.boot.autoconfigure.mongo;
import
java.net.UnknownHostException
;
import
java.util.ArrayList
;
import
java.util.
Array
s
;
import
java.util.
Collection
s
;
import
java.util.List
;
import
com.mongodb.MongoClient
;
...
...
@@ -209,7 +209,7 @@ public class MongoProperties {
}
String
host
=
this
.
host
==
null
?
"localhost"
:
this
.
host
;
int
port
=
determinePort
(
environment
);
return
new
MongoClient
(
Arrays
.
as
List
(
new
ServerAddress
(
host
,
port
)),
return
new
MongoClient
(
Collections
.
singleton
List
(
new
ServerAddress
(
host
,
port
)),
credentials
,
options
);
}
// The options and credentials are in the URI
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java
View file @
bce6bd65
...
...
@@ -57,7 +57,6 @@ public class MongoAutoConfigurationTests {
assertThat
(
this
.
context
.
getBeanNamesForType
(
Mongo
.
class
).
length
).
isEqualTo
(
1
);
}
@SuppressWarnings
(
"deprecation"
)
@Test
public
void
optionsAdded
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
...
@@ -66,11 +65,10 @@ public class MongoAutoConfigurationTests {
this
.
context
.
register
(
OptionsConfig
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
MongoAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBean
(
Mongo
.
class
).
getMongoOptions
().
getSocketTimeout
()
)
.
isEqualTo
(
300
);
assertThat
(
this
.
context
.
getBean
(
Mongo
Client
.
class
).
getMongoClientOptions
(
)
.
getSocketTimeout
()).
isEqualTo
(
300
);
}
@SuppressWarnings
(
"deprecation"
)
@Test
public
void
optionsAddedButNoHost
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
...
@@ -79,8 +77,8 @@ public class MongoAutoConfigurationTests {
this
.
context
.
register
(
OptionsConfig
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
MongoAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBean
(
Mongo
.
class
).
getMongoOptions
().
getSocketTimeout
()
)
.
isEqualTo
(
300
);
assertThat
(
this
.
context
.
getBean
(
Mongo
Client
.
class
).
getMongoClientOptions
(
)
.
getSocketTimeout
()).
isEqualTo
(
300
);
}
@Test
...
...
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