Sha256: eb5936e4737fbaab0fbab2d504bca565a905b7610884ab7e0059c5734b539247

Contents?: true

Size: 1.81 KB

Versions: 4

Compression:

Stored size: 1.81 KB

Contents

package <%=@package%>.integration.<%=@model_name.downcase%>;

<%=@licence%>

import com.github.fakemongo.Fongo;
import com.mongodb.Mongo;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.hateoas.config.EnableHypermediaSupport;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
 * Configuration class for <%=@package%> integration test.
 * @author <%=@user_name%>
 */
@Configuration
<%if @full%>@ComponentScan(basePackages = {"<%=@package%>.repository",
    "<%=@package%>.controller",
    "<%=@package%>.assembler",
    "<%=@package%>.resource",
    "<%=@package%>.integration"})
<%else%>@ComponentScan(basePackages = {"<%=@package%>.repository","<%=@package%>.integration"})<%end%>
@EnableHypermediaSupport(type = {EnableHypermediaSupport.HypermediaType.HAL})
@EnableSpringDataWebSupport
@EnableWebMvc
@EnableAutoConfiguration
@EnableMongoRepositories(basePackages = "<%=@package%>.repository")
@EnableTransactionManagement
public class <%=@model_name%>IntegrationTestConfig extends WebMvcConfigurerAdapter {

  @Bean
  public Mongo mongo() {
    Fongo fongo = new Fongo("test");
    return fongo.getMongo();
   }
    
  @Bean
  public MongoTemplate mongoTemplate() {
    return new MongoTemplate(mongo(),"<%=@model_name%>");
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spring-gen-0.2.3 lib/templates/src/test/java/integration/mongodb/IntegrationTestConfig.java.erb
spring-gen-0.2.2 lib/templates/src/test/java/integration/mongodb/IntegrationTestConfig.java.erb
spring-gen-0.2.1 lib/templates/resource/test/integration/mongodb/IntegrationTestConfig.java.erb
spring-gen-0.2.0 lib/templates/resource/test/integration/mongodb/IntegrationTestConfig.java.erb