# ElasticSearch Java TransportClient: Need to set TransportAddress

**URL:** https://discuss.elastic.co/t/elasticsearch-java-transportclient-need-to-set-transportaddress/10180
**Category:** Elasticsearch
**Created:** [December 27, 2012, 10:01am UTC](https://discuss.elastic.co/t/elasticsearch-java-transportclient-need-to-set-transportaddress/10180 "2012-12-27T10:01:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![karan](https://avatars.discourse-cdn.com/v4/letter/k/58f4c7/32.png) [@karan](https://discuss.elastic.co/u/karan)
#### Post date: [December 27, 2012, 10:01am UTC](https://discuss.elastic.co/t/elasticsearch-java-transportclient-need-to-set-transportaddress/10180/1 "2012-12-27T10:01:41Z")

</div>

Hi Everyone,

In my java code i am able to create a ElasticSearch client as below:  
org.elasticsearch.client.Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 9300));

Now i needed to initialise/setup the transportClient in a Spring Bean instead of in the java-code. But i am not able to add the transport address to the transportclient in the spring-bean.

Any help on how to setup in Spring will be really appreciated.

Thanks,  
Karan

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 27, 2012, 8:10pm UTC](https://discuss.elastic.co/t/elasticsearch-java-transportclient-need-to-set-transportaddress/10180/2 "2012-12-27T20:10:33Z")

</div>

Look at the spring Elasticsearch project: [https://github.com/dadoonet/spring-elasticsearch](https://github.com/dadoonet/spring-elasticsearch)

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 27 déc. 2012 à 11:01, karan [jaskaran1981@gmail.com](mailto:jaskaran1981@gmail.com) a écrit :

Hi Everyone,

In my java code i am able to create a ElasticSearch client as below:  
org.elasticsearch.client.Client client = new  
TransportClient().addTransportAddress(new  
InetSocketTransportAddress("localhost", 9300));

Now i needed to initialise/setup the transportClient in a Spring Bean  
instead of in the java-code. But i am not able to add the transport address  
to the transportclient in the spring-bean.

Any help on how to setup in Spring will be really appreciated.

Thanks,  
Karan

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/ElasticSearch-Java-TransportClient-Need-to-set-TransportAddress-tp4027459.html](http://elasticsearch-users.115913.n3.nabble.com/ElasticSearch-Java-TransportClient-Need-to-set-TransportAddress-tp4027459.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

--

--

---

<div class="post-metadata">

### Author: ![karan](https://avatars.discourse-cdn.com/v4/letter/k/58f4c7/32.png) [@karan](https://discuss.elastic.co/u/karan)
#### Post date: [December 28, 2012, 9:08am UTC](https://discuss.elastic.co/t/elasticsearch-java-transportclient-need-to-set-transportaddress/10180/3 "2012-12-28T09:08:12Z")

</div>

Hi David ,

Thanks alot. Ill look at the spring based project.

thanks,  
Karan

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:58am UTC](https://discuss.elastic.co/t/elasticsearch-java-transportclient-need-to-set-transportaddress/10180/4 "2017-07-06T02:58:20Z")

</div>


