Commit 631e7101 authored by Tjark Wilhelm Hoeck's avatar Tjark Wilhelm Hoeck Committed by Tom Käsler

Add Swagger dependencies and configuration

parent 6f81833f
......@@ -11,6 +11,7 @@
<org.springframework.security-version>4.0.2.RELEASE</org.springframework.security-version>
<org.springframework.integration-mail-version>4.1.6.RELEASE</org.springframework.integration-mail-version>
<com.fasterxml.jackson-version>2.6.0</com.fasterxml.jackson-version>
<springfoxVersion>2.0.1</springfoxVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.language>java</sonar.language>
<mobile.production.path>../arsnova-mobile/src/main/webapp/build/production/ARSnova</mobile.production.path>
......@@ -109,6 +110,11 @@
<name>Sonatype Snapshot Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>springfoxsnapshots</id>
<name>Springfox Swagger</name>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
</repository>
</repositories>
<dependencies>
......@@ -299,6 +305,17 @@
<version>1.5.5</version>
<scope>runtime</scope>
</dependency>
<!-- Springfox (Swagger) -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfoxVersion}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfoxVersion}</version>
</dependency>
</dependencies>
<build>
......
......@@ -30,6 +30,10 @@ import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import de.thm.arsnova.connector.client.ConnectorClient;
import de.thm.arsnova.connector.client.ConnectorClientImpl;
......@@ -37,12 +41,15 @@ import de.thm.arsnova.socket.ARSnovaSocket;
import de.thm.arsnova.socket.ARSnovaSocketIOServer;
import de.thm.arsnova.ImageUtils;
/**
* Loads property file and configures non-security related beans and components.
*/
@EnableWebMvc
@Configuration
@EnableCaching
public class ExtraConfig {
@Import(SwaggerConfiguration.class)
public class ExtraConfig extends WebMvcConfigurerAdapter {
@Autowired
private Environment env;
......@@ -117,4 +124,13 @@ public class ExtraConfig {
public ImageUtils imageUtils() {
return new ImageUtils();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
package de.thm.arsnova.config;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
public class SwaggerConfiguration {
}
......@@ -26,6 +26,13 @@
<aop:aspectj-autoproxy />
<!-- Enables swgger ui-->
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<!-- Include a swagger configuration-->
<bean name="/SwaggerConfiguration" class="de.thm.arsnova.config.SwaggerConfiguration"/>
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:ignoreUnresolvablePlaceholders="false" p:ignoreResourceNotFound="true">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment