package <%=packageName%>.config;

import <%=packageName%>.gateway.ratelimiting.RateLimitingFilter;
import <%=packageName%>.gateway.ratelimiting.RateLimitingRepository;

import javax.inject.Inject;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.datastax.driver.core.Session;
<%_ if (databaseType != 'cassandra') { _%>

import info.archinnov.achilles.embedded.CassandraEmbeddedServerBuilder;
<%_ } _%>

@Configuration
public class GatewayConfiguration {
    <%_ if (databaseType != 'cassandra') { _%>

    /**
     * Starts an embedded Cassandra server, useful in development.
     */
    @Configuration
    @ConditionalOnProperty("jhipster.gateway.embedded-cassandra.enabled")
    public static class EmbeddedCassandra {

        @Bean
        public Session session() {
            return CassandraEmbeddedServerBuilder
                .noEntityPackages()
                .withCQLPort(9042)
                .withClusterName("JHipster embedded cluster")
                .withKeyspaceName("gateway2")
                .withScript("config/cql/create-tables.cql")
                .buildPersistenceManager().getNativeSession();
        }
    }
    <%_ } _%>

    /**
     * Configures the Zuul filter that limits the number of API calls per user.
     * <p>
     * For this filter to work, you need to:
     * <p><ul>
     * <li>Have a working Cassandra cluster
     * <li>Have this cluster configured in your application-*.yml files, using the
     * "spring.data.cassandra" keys
     * <li>Have Spring Data Cassandra running, by removing in your application-*.yml the
     * "spring.autoconfigure.exclude" key that excludes the Cassandra and Spring Data
     * Cassandra auto-configuration.
     * </ul><p>
     */
    @Configuration
    @ConditionalOnProperty("jhipster.gateway.rate-limiting.enabled")
    public static class RateLimitingConfiguration {

        @Inject
        private JHipsterProperties jHipsterProperties;

        @Bean
        public RateLimitingRepository rateLimitingRepository() {
            return new RateLimitingRepository();
        }

        @Bean
        public RateLimitingFilter rateLimitingFilter() {
            return new RateLimitingFilter(rateLimitingRepository(), jHipsterProperties);
        }
    }
}

@@ -384,16 +384,57 @@
 ation;%0A%0A
+import com.datastax.driver.core.Cluster;%0A
 import c
@@ -1319,24 +1319,140 @@
 );%0A        %7D
+%0A%0A        @Bean%0A        public Cluster cluster(Session session) %7B%0A            return session.getCluster();%0A        %7D
 %0A    %7D%0A    %3C

Configure Cassandra's Cluster bean, used by Swagger