如何从jhipster SwaggerConfiguration覆盖Docket bean?我需要为我的api添加自定义Docket :: directModelSubstitute。
答案 0 :(得分:3)
要覆盖SwaggerConfiguration,我将SwaggerConfig类添加到我的项目config / apidocs,它扩展了SwaggerConfiguration和@Override swaggerSpringfoxDocket bean
@Configuration
public class SwaggerConfig extends SwaggerConfiguration {
private final Logger log = LoggerFactory.getLogger(SwaggerConfig.class);
@Bean
@Override
public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
最后将SwaggerConfiguration添加到App.java中@EnableAutoConfiguration的排除
@EnableAutoConfiguration(exclude = {MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, SwaggerConfiguration.class})
如果SwaggerConfiguration为swaggerSpringfoxDocket bean设置了@ConditionalOnMissingBean,那将会容易得多。