/** * restful默认不返回主键id, 需要新增配置文件 */ @Configuration class SpringDataRestConfig { @Bean public RepositoryRestConfigurer repositoryRestConfigurer() { return new RepositoryRestConfigurerAdapter() { @Override public void configureRepositoryRestConfiguration( RepositoryRestConfiguration config) { config.exposeIdsFor(Channel.class, Product.class, SysAccount.class, Dealer.class, ProductSku.class,AppVersion.class); config.exposeIdsFor(CustomerStatus.class); config.exposeIdsFor(Campaign.class); config.exposeIdsFor(Function.class); config.setDefaultMediaType(org.springframework.http.MediaType.APPLICATION_JSON); config.setDefaultPageSize(1000); } }; } }
原文:http://www.cnblogs.com/longling2344/p/7241479.html