File tree Expand file tree Collapse file tree 6 files changed +32
-9
lines changed
main/resources/org/springframework/data/mongodb/config
java/org/springframework/data/mongodb/config
resources/org/springframework/data/mongodb Expand file tree Collapse file tree 6 files changed +32
-9
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ The MongoClientURI string.]]></xsd:documentation>
137
137
</xsd : documentation >
138
138
</xsd : annotation >
139
139
</xsd : attribute >
140
- <xsd : attribute name =" create-query-indexes" type =" xsd:boolean " default =" false" >
140
+ <xsd : attribute name =" create-query-indexes" type =" xsd:string " default =" false" >
141
141
<xsd : annotation >
142
142
<xsd : documentation >
143
143
Enables creation of indexes for queries that get derived from the method name
@@ -541,7 +541,7 @@ This controls if the driver is allowed to read from secondaries or slaves. Defa
541
541
]]> </xsd : documentation >
542
542
</xsd : annotation >
543
543
</xsd : attribute >
544
- <xsd : attribute name =" ssl" type =" xsd:boolean " >
544
+ <xsd : attribute name =" ssl" type =" xsd:string " >
545
545
<xsd : annotation >
546
546
<xsd : documentation ><![CDATA[
547
547
This controls if the driver should us an SSL connection. Defaults to false.
@@ -739,7 +739,7 @@ The socket timeout for connections used for the cluster heartbeat.
739
739
]]> </xsd : documentation >
740
740
</xsd : annotation >
741
741
</xsd : attribute >
742
- <xsd : attribute name =" ssl" type =" xsd:boolean " >
742
+ <xsd : attribute name =" ssl" type =" xsd:string " >
743
743
<xsd : annotation >
744
744
<xsd : documentation ><![CDATA[
745
745
This controls if the driver should us an SSL connection. Defaults to false.
Original file line number Diff line number Diff line change 29
29
import org .springframework .context .ApplicationContext ;
30
30
import org .springframework .data .authentication .UserCredentials ;
31
31
import org .springframework .data .mongodb .MongoDbFactory ;
32
+ import org .springframework .data .mongodb .core .MongoClientFactoryBean ;
32
33
import org .springframework .data .mongodb .core .MongoFactoryBean ;
33
34
import org .springframework .data .mongodb .core .MongoOperations ;
34
35
import org .springframework .data .mongodb .core .ReflectiveMongoOptionsInvokerTestUtil ;
38
39
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
39
40
40
41
import com .mongodb .Mongo ;
42
+ import com .mongodb .MongoClientOptions ;
41
43
import com .mongodb .MongoOptions ;
42
44
import com .mongodb .WriteConcern ;
43
45
@@ -101,6 +103,19 @@ public void testMongoSingletonWithSslEnabled() throws Exception {
101
103
assertTrue ("socketFactory should be a SSLSocketFactory" , options .getSocketFactory () instanceof SSLSocketFactory );
102
104
}
103
105
106
+ /**
107
+ * @see DATAMONGO-1490
108
+ */
109
+ @ Test
110
+ public void testMongoClientSingletonWithSslEnabled () {
111
+
112
+ assertTrue (ctx .containsBean ("mongoClientSsl" ));
113
+ MongoClientFactoryBean mfb = (MongoClientFactoryBean ) ctx .getBean ("&mongoClientSsl" );
114
+
115
+ MongoClientOptions options = (MongoClientOptions ) getField (mfb , "mongoClientOptions" );
116
+ assertTrue ("socketFactory should be a SSLSocketFactory" , options .getSocketFactory () instanceof SSLSocketFactory );
117
+ }
118
+
104
119
/**
105
120
* @see DATAMONGO-764
106
121
*/
Original file line number Diff line number Diff line change 29
29
30
30
<mongo : db-factory dbname =" database" mongo-ref =" mongo" />
31
31
32
+ <mongo : mongo-client id =" mongoClientSsl" >
33
+ <mongo : client-options ssl =" ${mongoSsl.ssl}" />
34
+ </mongo : mongo-client >
32
35
33
-
34
36
<mongo : db-factory id =" secondMongoDbFactory"
35
37
host =" localhost"
36
38
port =" 27017"
49
51
<mongo : mongo id =" defaultMongo" host =" localhost" port =" 27017" />
50
52
51
53
<mongo : mongo id =" mongoSsl" host =" localhost" port =" 27017" >
52
- <mongo : options ssl =" true " />
54
+ <mongo : options ssl =" ${mongoSsl.ssl} " />
53
55
</mongo : mongo >
54
56
55
57
<mongo : mongo id =" mongoSslWithCustomSslFactory" host =" localhost" port =" 27017" >
Original file line number Diff line number Diff line change @@ -10,3 +10,5 @@ mongo.socketKeepAlive=true
10
10
mongo.fsync =true
11
11
mongo.slaveOk =true
12
12
13
+ mongoSsl.ssl =true
14
+
Original file line number Diff line number Diff line change 2
2
<beans xmlns =" http://www.springframework.org/schema/beans"
3
3
xmlns:mongo=" http://www.springframework.org/schema/data/mongo"
4
4
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
5
- xmlns:util =" http://www.springframework.org/schema/util "
5
+ xmlns:context =" http://www.springframework.org/schema/context "
6
6
xsi:schemaLocation=" http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
7
7
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
8
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util /spring-util .xsd" >
8
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context /spring-context .xsd" >
9
9
10
- <mongo : db-factory dbname =" repositories" />
10
+ <context : property-placeholder
11
+ location=" classpath:/org/springframework/data/mongodb/repository/mongo.properties" />
12
+
13
+ <mongo : db-factory dbname =" repositories" />
11
14
<mongo : mapping-converter base-package =" org.springframework.data.mongodb.repository" />
12
15
13
16
<bean id =" mongoTemplate" class =" org.springframework.data.mongodb.core.MongoTemplate" >
14
17
<constructor-arg ref =" mongoDbFactory" />
15
18
<constructor-arg ref =" mappingConverter" />
16
19
</bean >
17
20
18
- <mongo : repositories base-package =" org.springframework.data.mongodb.repository" create-query-indexes =" true " />
21
+ <mongo : repositories base-package =" org.springframework.data.mongodb.repository" create-query-indexes =" ${mongo.create-query-indexes} " />
19
22
20
23
</beans >
Original file line number Diff line number Diff line change
1
+ mongo.create-query-indexes =true
You can’t perform that action at this time.
0 commit comments