I've defined my Gemfire's "client-cache.xml" as below:

```
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:gfe="http://www.springframework.org/schema/gemfire"
   xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
                       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <gfe:pool id="client" subscription-enabled="true">
    <gfe:locator host="localhost" port="41114"/>
    </gfe:pool>

    <gfe:client-cache pool-name="client"/>

    <gfe:client-region id="dataRegion" name="dataRegion" pool-name="client" shortcut="PROXY"/>

</beans>

```

I want to create a corresponding Java Configuration for the same.

I've tried below configuration:

```
@Resource
private Cache gemfireCache;

@Resource
private Pool client;

@Bean
public PoolFactoryBean client() {
    PoolFactoryBean client = new PoolFactoryBean();
    client.setSubscriptionEnabled(true);
    client.addLocators(new ConnectionEndpoint("localhost", 41114));
    return client;
}

@Bean
public ClientRegionFactoryBean<String, AbstractContent> dataRegion() {
    ClientRegionFactoryBean<String, AbstractContent> dataRegionFactory = new ClientRegionFactoryBean<>();
    dataRegionFactory.setPoolName("client");
    dataRegionFactory.setName("dataRegion");
    dataRegionFactory.setShortcut(ClientRegionShortcut.PROXY);
    return dataRegionFactory;
}

@Bean
public ClientCacheFactoryBean gemfireCache() {
    ClientCacheFactoryBean clientCacheFactory = new ClientCacheFactoryBean();
    clientCacheFactory.setPoolName("client");
    clientCacheFactory.setPdxSerializer(mappingPdxSerializer());
    return clientCacheFactory;
}

@Bean
public PlatformTransactionManager gemfireTransactionManager() throws Exception {
    return new GemfireTransactionManager(gemfireCache);
}

```

However, I keep running into exception saying :

```
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.gemstone.gemfire.cache.client.ClientCache] is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:372)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:369)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)
at org.springframework.data.gemfire.client.PoolFactoryBean.eagerlyInitializeClientCacheIfNotPresent(PoolFactoryBean.java:218)
at org.springframework.data.gemfire.client.PoolFactoryBean.getObject(PoolFactoryBean.java:171)
at org.springframework.data.gemfire.client.PoolFactoryBean.getObject(PoolFactoryBean.java:65)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1590)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)

```

Is it not possible to transform the above XML into Java based configuration?

Any help would be appreciated.
Thanks.

===============Edited below per John's comments==============

@John,

I tried the example mentioned @ [sample test case for gemfire client](https://github.com/jxblum/pivotal-gemfire-clientserver-examples/blob/master/spring-gemfire-clientserver/src/test/java/io/pivotal/gemfire/cache/client/SpringGemFireClientCacheTest.java) and the sample as it is, worked fine.
I'm using locator and the example worked fine with the locators configuration as
`gemfirePool.setLocators(Collections.singletonList(new InetSocketAddress(host, port)))`.
However, I'm using spring-data-gemfire version 1.8.2.RELEASE as per recommendations of Pivotal support.
So, I 

* upgraded the spring-data-gemfire version to 1.8.2.RELEASE @ [pom.xml](https://github.com/jxblum/pivotal-gemfire-clientserver-examples/blob/master/spring-gemfire-clientserver/pom.xml),
* fixed the compilation errors  

(commented `gemfireCache.setLazyInitialize(true)`),
* and changed `gemfirePool.setLocators(Collections.singletonList(new InetSocketAddress(locatorHost, locatorPort)))` to `gemfirePool.addLocators(Collections.singletonList(new ConnectionEndpoint(locatorHost, locatorPort)))`,

the test case went for a toss.

The test case started giving me below exception:

```
java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gemfireCache' defined in io.pivotal.gemfire.cache.client.SpringGemFireClientCacheTest$SpringGemFireClientConfiguration: Unsatisfied dependency expressed through constructor argument with index 1 of type [com.gemstone.gemfire.cache.client.Pool]: : Error creating bean with name 'gemfirePool': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.gemstone.gemfire.cache.client.ClientCache] is defined; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfirePool': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.gemstone.gemfire.cache.client.ClientCache] is defined
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:125)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
    at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:109)
    at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:261)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
    ... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfirePool': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.gemstone.gemfire.cache.client.ClientCache] is defined
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1585)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    ... 43 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.gemstone.gemfire.cache.client.ClientCache] is defined
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:372)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)
    at org.springframework.data.gemfire.client.PoolFactoryBean.eagerlyInitializeClientCacheIfNotPresent(PoolFactoryBean.java:218)
    at org.springframework.data.gemfire.client.PoolFactoryBean.getObject(PoolFactoryBean.java:171)
    at org.springframework.data.gemfire.client.PoolFactoryBean.getObject(PoolFactoryBean.java:65)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
    ... 52 more

```

So, it looks like, it's an issue with the spring-data-gemfire 1.8.2.RELEASE.
I'm not really sure if I should simply revert back to 1.6.2.RELEASE and, what would I lose on reverting back to a previous revision.

I created another sample spring boot application:

* pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd">
 4.0.0
 com.cdk.test
 TestGemfireLocators
 0.0.1-SNAPSHOT

```
<parent>
    <groupId>io.spring.platform</groupId>
    <artifactId>platform-bom</artifactId>
    <version>2.0.6.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-gemfire</artifactId>
        <version>1.8.2.RELEASE</version>
    </dependency>

</dependencies>

```
* Application.java

@SpringBootApplication
public class Application {

```
public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

@Bean(name = "region")
public ClientRegionFactoryBean region(ClientCache gemfireCache, Pool gemfirePool) {
    ClientRegionFactoryBean versionedRegion = new ClientRegionFactoryBean();
    versionedRegion.setName("region");
    versionedRegion.setCache(gemfireCache);
    versionedRegion.setPool(gemfirePool);
    versionedRegion.setShortcut(ClientRegionShortcut.PROXY);
    return versionedRegion;
}

@Bean
public ClientCacheFactoryBean gemfireCache(@Qualifier("gemfireProperties") Properties gemfireProperties,
        Pool gemfirePool) {
    ClientCacheFactoryBean gemfireCache = new ClientCacheFactoryBean();
    gemfireCache.setPool(gemfirePool);
    gemfireCache.setProperties(gemfireProperties);
    return gemfireCache;
}

@Bean(name = GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME)
public PoolFactoryBean gemfirePool(@Value("${locator.host}") String host, @Value("${locator.port}") int port) {
    PoolFactoryBean gemfirePool = new PoolFactoryBean();
    gemfirePool.setName(GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME);
    gemfirePool.setSubscriptionEnabled(true);
    gemfirePool.addLocators(new ConnectionEndpoint(host, port));
    return gemfirePool;
}

@Bean
public Properties gemfireProperties(@Value("${gemfire.log.level:config}") String logLevel) {
    Properties gemfireProperties = new Properties();
    gemfireProperties.setProperty("log-level", logLevel);
    return gemfireProperties;
}

```

}

The above code too, doesn't work and returns same exception. I tried above code with the default version of "spring-data-gemfire" contained with-in `io.spring.platform` (1.7.4.RELEASE) and still the same result.

-------------POST John's comments and reference program-------------------

Thanks a lot John. The sample provided by you helped me, however, I had to make a few changes to the code. Below is how my final project looks like (if you notice, I'm injecting `GemfireCache` instead of `ClientCache`):

* pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd">
 4.0.0
 com.cdk.test
 TestGemfireLocators
 0.0.1-SNAPSHOT

```
<parent>
    <groupId>io.spring.platform</groupId>
    <artifactId>platform-bom</artifactId>
    <version>2.0.5.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-gemfire</artifactId>
        <version>1.8.2.RELEASE</version>
    </dependency>

</dependencies>

```
* Application.java

@SpringBootApplication
public class Application {

```
public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

@Resource(name = "myRegion")
private Region<String, Object> myRegion;

int intValue(Long value) {
    return value.intValue();
}

String logLevel() {
    return System.getProperty("gemfire.log-level", "config");
}

Properties gemfireProperties() {
    Properties gemfireProperties = new Properties();
    gemfireProperties.setProperty("log-level", logLevel());
    return gemfireProperties;
}

@Bean
ClientCacheFactoryBean gemfireCache() {
    ClientCacheFactoryBean gemfireCache = new ClientCacheFactoryBean();

    gemfireCache.setClose(true);
    gemfireCache.setProperties(gemfireProperties());

    return gemfireCache;
}

@Bean(name = GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME)
PoolFactoryBean gemfirePool(@Value("${locator.host}") String host, @Value("${locator.port}") int port) {

    PoolFactoryBean gemfirePool = new PoolFactoryBean();

    gemfirePool.setKeepAlive(false);
    gemfirePool.setSubscriptionEnabled(true);
    gemfirePool.setThreadLocalConnections(false);

    gemfirePool.addLocators(new ConnectionEndpoint(host, port));

    return gemfirePool;
}

@Bean(name = "myRegion")
ClientRegionFactoryBean<String, Object> myRegion(@Value("${region.name}") String regionName, GemFireCache gemfireCache,
        Pool gemfirePool) {
    ClientRegionFactoryBean<String, Object> myRegion = new ClientRegionFactoryBean<>();

    myRegion.setCache(gemfireCache);
    myRegion.setName(regionName);
    myRegion.setPool(gemfirePool);
    myRegion.setShortcut(ClientRegionShortcut.PROXY);

    return myRegion;
}

@Bean
PlatformTransactionManager gemfireTransactionManager(GemFireCache gemfireCache) {
    return new GemfireTransactionManager((Cache) gemfireCache);
}

```

}