• Spring Data Rest如何暴露ID字段


    /**
     * 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);
                }
            };
        }
    
    }
  • 相关阅读:
    SpringBoot04-web
    springboot03-日志功能
    SpringBoot02-自动配置原理
    SpringBoot02
    SpringBoot01
    八大排序算法
    SpringSecurity04
    SpringSecurity03
    SpringSecurity02
    SpringSecurity01
  • 原文地址:https://www.cnblogs.com/longling2344/p/7241479.html
Copyright © 2020-2023  润新知