-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from khoa-nd/master
Merged
- Loading branch information
Showing
11 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/main/java/com/techlooper/config/ElasticsearchUserImportConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.techlooper.config; | ||
|
||
import org.elasticsearch.client.transport.TransportClient; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.FactoryBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.data.elasticsearch.client.TransportClientFactoryBean; | ||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations; | ||
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* Created by NguyenDangKhoa on 28/01/15. | ||
*/ | ||
@Configuration | ||
@EnableElasticsearchRepositories(basePackages = "com.techlooper.repository.userimport", | ||
elasticsearchTemplateRef = "elasticsearchTemplateUserImport") | ||
public class ElasticsearchUserImportConfiguration { | ||
|
||
@Resource | ||
private Environment environment; | ||
|
||
@Resource | ||
private TransportClient transportClientUserImport; | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(ElasticsearchUserImportConfiguration.class); | ||
|
||
@Bean | ||
public FactoryBean<TransportClient> transportClientUserImport() throws Exception { | ||
TransportClientFactoryBean factory = new TransportClientFactoryBean(); | ||
factory.setClusterName(environment.getProperty("elasticsearch.userimport.cluster.name")); | ||
factory.setClusterNodes(environment.getProperty("elasticsearch.userimport.host")); | ||
return factory; | ||
} | ||
|
||
@Bean | ||
public ElasticsearchOperations elasticsearchTemplateUserImport() { | ||
return new ElasticsearchTemplate(transportClientUserImport); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...y/elasticsearch/UserImportRepository.java → ...tory/userimport/UserImportRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters