-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
Description
Not entirely sure if this belongs here or on the actual swagger-springmvc project; tried to follow the given steps to get Swagger working with SpringMVC in a no XML environment: servlet 3, @configuration everywhere. Ended up doing the following:
- Add a
PropertyPlaceholderConfigurer
to the existing Spring configuration class:
@Bean
public static PropertyPlaceholderConfigurer swaggerProperties() {
final PropertyPlaceholderConfigurer swaggerProperties = new PropertyPlaceholderConfigurer();
swaggerProperties.setLocation(new ClassPathResource("swagger.properties"));
return swaggerProperties;
}
- Modify the
WebApplicationInitializer
to load theDocumentationConfig
:
// Create the 'root' Spring application context
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(SpringBaseConfiguration.class, SpringWebConfiguration.class, DocumentationConfig.class);
I didn't have to create any other beans or instantiate any other objects.