本文整理匯總了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);
}
};
}
示例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");
}
}
示例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
}
};
}
示例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()]));
}
示例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);
}
示例7: configureRepositoryRestConfiguration
import org.springframework.data.rest.core.config.RepositoryRestConfiguration; //導入依賴的package包/類
@Override
public void configureRepositoryRestConfiguration(
RepositoryRestConfiguration config) {
super.configureRepositoryRestConfiguration(config);
config.exposeIdsFor(
Country.class);
}
示例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);
}
示例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");
}
示例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();
}
示例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);
}
};
}
示例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());
}
示例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);
}
示例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