Skip to content

Commit cee7479

Browse files
committed
#2 - Exclude reactive repositories from JdbcRepositoryConfigExtension.
1 parent 9d9c665 commit cee7479

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2017-2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.jdbc.repository.config;
17+
18+
import java.util.Locale;
19+
20+
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactoryBean;
21+
import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport;
22+
import org.springframework.data.repository.core.RepositoryMetadata;
23+
24+
/**
25+
* {@link org.springframework.data.repository.config.RepositoryConfigurationExtension} extending the repository
26+
* registration process by registering JDBC repositories.
27+
*
28+
* @author Jens Schauder
29+
* @author Mark Paluch
30+
*/
31+
public class JdbcRepositoryConfigExtension extends RepositoryConfigurationExtensionSupport {
32+
33+
/*
34+
* (non-Javadoc)
35+
* @see org.springframework.data.repository.config.RepositoryConfigurationExtension#getModuleName()
36+
*/
37+
@Override
38+
public String getModuleName() {
39+
return "JDBC";
40+
}
41+
42+
/*
43+
* (non-Javadoc)
44+
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getRepositoryFactoryBeanClassName()
45+
*/
46+
@Override
47+
public String getRepositoryFactoryBeanClassName() {
48+
return JdbcRepositoryFactoryBean.class.getName();
49+
}
50+
51+
/*
52+
* (non-Javadoc)
53+
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getModulePrefix()
54+
*/
55+
@Override
56+
protected String getModulePrefix() {
57+
return getModuleName().toLowerCase(Locale.US);
58+
}
59+
60+
/*
61+
* (non-Javadoc)
62+
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#useRepositoryConfiguration(org.springframework.data.repository.core.RepositoryMetadata)
63+
*/
64+
@Override
65+
protected boolean useRepositoryConfiguration(RepositoryMetadata metadata) {
66+
return !metadata.isReactiveRepository();
67+
}
68+
}

0 commit comments

Comments
 (0)