2017-08-15 35 views

回答

1

要覆蓋SwaggerConfiguration我添加SwaggerConfig類,我的項目配置/擴展SwaggerConfiguration apidocs和@Override的swaggerSpringfoxDocket豆

@Configuration 
public class SwaggerConfig extends SwaggerConfiguration { 
    private final Logger log = LoggerFactory.getLogger(SwaggerConfig.class); 

    @Bean 
    @Override 
    public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) { 

終於在App.java

@EnableAutoConfiguration(exclude = {MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, SwaggerConfiguration.class}) 
添加SwaggerConfiguration到排除的@EnableAutoConfiguration

如果SwaggerConfiguration對於swaggerSpringfoxDocket bean有@ConditionalOnMissingBean,那將會容易得多。