當前位置: 首頁>>代碼示例>>Java>>正文


Java RepositoryRestConfiguration類代碼示例

本文整理匯總了Java中org.springframework.data.rest.core.config.RepositoryRestConfiguration的典型用法代碼示例。如果您正苦於以下問題:Java RepositoryRestConfiguration類的具體用法?Java RepositoryRestConfiguration怎麽用?Java RepositoryRestConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RepositoryRestConfiguration類屬於org.springframework.data.rest.core.config包,在下文中一共展示了RepositoryRestConfiguration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: repositoryRestConfigurer

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {

	return new RepositoryRestConfigurerAdapter() {
		@Override
		public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
			config.exposeIdsFor(Order.class, Item.class, Customer.class);
		}
	};
}
 
開發者ID:ewolff,項目名稱:microservice-atom,代碼行數:11,代碼來源:SpringRestDataConfig.java

示例2: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
    //config.setBasePath("api");

    try {
        config.exposeIdsFor(UserEntity.class);
        ClassPathUtils.streamClassesAnnotatedWith(UserEntity.class, Entity.class)
                .peek(clazz -> log.debug("enable @Id json mapping for entity {}", clazz.getSimpleName()))
                .forEach(config::exposeIdsFor);
    } catch (IOException e) {
        throw new IllegalStateException("Could not exposeIds for @Entity classes");
    }
}
 
開發者ID:amvnetworks,項目名稱:amv-access-api-poc,代碼行數:14,代碼來源:RepositoryConfig.java

示例3: testWithCustomSettings

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Test
public void testWithCustomSettings() throws Exception {
	load(TestConfiguration.class, "spring.data.rest.default-page-size:42",
			"spring.data.rest.max-page-size:78",
			"spring.data.rest.page-param-name:_page",
			"spring.data.rest.limit-param-name:_limit",
			"spring.data.rest.sort-param-name:_sort",
			"spring.data.rest.default-media-type:application/my-json",
			"spring.data.rest.return-body-on-create:false",
			"spring.data.rest.return-body-on-update:false",
			"spring.data.rest.enable-enum-translation:true");
	assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class))
			.isNotNull();
	RepositoryRestConfiguration bean = this.context
			.getBean(RepositoryRestConfiguration.class);
	assertThat(bean.getDefaultPageSize()).isEqualTo(42);
	assertThat(bean.getMaxPageSize()).isEqualTo(78);
	assertThat(bean.getPageParamName()).isEqualTo("_page");
	assertThat(bean.getLimitParamName()).isEqualTo("_limit");
	assertThat(bean.getSortParamName()).isEqualTo("_sort");
	assertThat(bean.getDefaultMediaType())
			.isEqualTo(MediaType.parseMediaType("application/my-json"));
	assertThat(bean.returnBodyOnCreate(null)).isFalse();
	assertThat(bean.returnBodyOnUpdate(null)).isFalse();
	assertThat(bean.isEnableEnumTranslation()).isTrue();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:27,代碼來源:RepositoryRestMvcAutoConfigurationTests.java

示例4: repositoryRestConfigurer

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {

    return new RepositoryRestConfigurerAdapter() {

        @Override
        public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
            config.setRepositoryDetectionStrategy(
                    RepositoryDetectionStrategy.RepositoryDetectionStrategies.ANNOTATED
            );
        }

        @Override
        public void configureJacksonObjectMapper(ObjectMapper objectMapper) {
            objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
            objectMapper.registerModule(new AfterburnerModule()); //MOAR SPEED
        }
    };
}
 
開發者ID:EMBL-EBI-SUBS-OLD,項目名稱:subs,代碼行數:20,代碼來源:RestRepositoryConfig.java

示例5: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
    provider.addIncludeFilter(new AssignableTypeFilter(IdentifiableEntity.class));
    Set<BeanDefinition> components = provider.findCandidateComponents(this.getClass().getPackage().getName());
    List<Class<?>> classes = new ArrayList<>();

    components.forEach(component -> {
        try {
            classes.add(Class.forName(component.getBeanClassName()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    });

    config.exposeIdsFor(classes.toArray(new Class[classes.size()]));
}
 
開發者ID:thomasletsch,項目名稱:moserp,代碼行數:18,代碼來源:RestConfiguration.java

示例6: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(
        RepositoryRestConfiguration config) {
    super.configureRepositoryRestConfiguration(config);
    config.exposeIdsFor(
            Country.class, City.class, CountryLanguage.class);
}
 
開發者ID:ceefour,項目名稱:java-web-services-training,代碼行數:8,代碼來源:RepositoryConfig.java

示例7: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(
        RepositoryRestConfiguration config) {
    super.configureRepositoryRestConfiguration(config);
    config.exposeIdsFor(
            Country.class);
}
 
開發者ID:ceefour,項目名稱:java-web-services-training,代碼行數:8,代碼來源:RepositoryConfig.java

示例8: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
  config.exposeIdsFor(
          ServiceLevel.class,
          ShipmentTrackingInfo.class,
          //TrackingHistory.class,
          TrackingStatus.class);
}
 
開發者ID:pacphi,項目名稱:track-shipments,代碼行數:9,代碼來源:RepositoryRestResourceConfig.java

示例9: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
/**
 * Configure rest settings
 *
 * @param config repository rest configuration
 */
@Override
public void configureRepositoryRestConfiguration(final RepositoryRestConfiguration config) {
    config.setPageParamName("page")
            .setLimitParamName("limit")
            .setSortParamName("sort");
}
 
開發者ID:mhaddon,項目名稱:Sound.je,代碼行數:12,代碼來源:RestConfig.java

示例10: StateEngine

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
public StateEngine(SubmissionEnvelopeRepository submissionEnvelopeRepository,
                   MessageSender messageSender,
                   ResourceMappings mappings,
                   RepositoryRestConfiguration config) {
    this.submissionEnvelopeRepository = submissionEnvelopeRepository;
    this.messageSender = messageSender;
    this.mappings = mappings;
    this.config = config;

    this.executorService = Executors.newCachedThreadPool();
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:12,代碼來源:StateEngine.java

示例11: repositoryRestConfigurer

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {

    return new RepositoryRestConfigurerAdapter() {

        @Override
        public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
            config.setDefaultPageSize(150);
        }
    };
}
 
開發者ID:SpartaSystems,項目名稱:holdmail,代碼行數:12,代碼來源:MvcConfig.java

示例12: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
	if (null == journal.getApiPath())
		config.setBasePath(API_PATH);
	else
		config.setBasePath(journal.getApiPath());
}
 
開發者ID:Apress,項目名稱:pro-spring-boot,代碼行數:8,代碼來源:JournalAutoConfiguration.java

示例13: configureRepositoryRestConfiguration

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {

    // for this time only one solution which works completely
    config.exposeIdsFor(io.smsc.model.admin.User.class, User.class, Role.class, Authority.class, Group.class, Customer.class, Contact.class,
            Dashboard.class, DashboardBox.class, DashboardBoxType.class);
}
 
開發者ID:bulktrade,項目名稱:SMSC,代碼行數:8,代碼來源:RepositoryIdExposingConfiguration.java

示例14: applyTo

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
public void applyTo(RepositoryRestConfiguration configuration) {
	if (this.basePath != null) {
		configuration.setBasePath(this.basePath);
	}
	if (this.defaultPageSize != null) {
		configuration.setDefaultPageSize(this.defaultPageSize);
	}
	if (this.maxPageSize != null) {
		configuration.setMaxPageSize(this.maxPageSize);
	}
	if (this.pageParamName != null) {
		configuration.setPageParamName(this.pageParamName);
	}
	if (this.limitParamName != null) {
		configuration.setLimitParamName(this.limitParamName);
	}
	if (this.sortParamName != null) {
		configuration.setSortParamName(this.sortParamName);
	}
	if (this.defaultMediaType != null) {
		configuration.setDefaultMediaType(this.defaultMediaType);
	}
	if (this.returnBodyOnCreate != null) {
		configuration.setReturnBodyOnCreate(this.returnBodyOnCreate);
	}
	if (this.returnBodyOnUpdate != null) {
		configuration.setReturnBodyOnUpdate(this.returnBodyOnUpdate);
	}
	if (this.enableEnumTranslation != null) {
		configuration.setEnableEnumTranslation(this.enableEnumTranslation);
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:33,代碼來源:RepositoryRestProperties.java

示例15: testWithCustomBasePath

import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Test
public void testWithCustomBasePath() throws Exception {
	load(TestConfiguration.class, "spring.data.rest.base-path:foo");
	assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class))
			.isNotNull();
	RepositoryRestConfiguration bean = this.context
			.getBean(RepositoryRestConfiguration.class);
	URI expectedUri = URI.create("/foo");
	assertThat(bean.getBaseUri()).as("Custom basePath not set")
			.isEqualTo(expectedUri);
	BaseUri baseUri = this.context.getBean(BaseUri.class);
	assertThat(expectedUri).as("Custom basePath has not been applied to BaseUri bean")
			.isEqualTo(baseUri.getUri());
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:RepositoryRestMvcAutoConfigurationTests.java


注:本文中的org.springframework.data.rest.core.config.RepositoryRestConfiguration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。