或者报如下错误,也可能是需要加@WebAppConfiguration:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.mangofactory.swagger.configuration.SpringSwaggerConfig’: Unsatisfied dependency expressed through field ‘servletContext’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘javax.servlet.ServletContext’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}