Add spring-boot-parent and fix swagger configuration for self deploy
This commit is contained in:
parent
a9e7ea5d2c
commit
319b384eae
45
pom.xml
45
pom.xml
|
@ -3,22 +3,17 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib</groupId>
|
<groupId>eu.dnetlib</groupId>
|
||||||
<artifactId>uoa-global-parent</artifactId>
|
<artifactId>uoa-spring-boot-parent</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>dnet-role-management</artifactId>
|
<artifactId>dnet-role-management</artifactId>
|
||||||
<version>1.0.3-SNAPSHOT</version>
|
<version>1.0.3-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>dnet-role-management</name>
|
<name>dnet-role-management</name>
|
||||||
<description>DNET Role Management API. Integrated with AAI Registry Service</description>
|
<description>DNET Role Management API. Integrated with AAI Registry Service</description>
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
</properties>
|
|
||||||
<scm>
|
<scm>
|
||||||
<url>https://code-repo.d4science.org/MaDgIK/dnet-role-management</url>
|
|
||||||
<connection>scm:git:gitea@code-repo.d4science.org:MaDgIK/dnet-role-management.git</connection>
|
|
||||||
<developerConnection>scm:git:gitea@code-repo.d4science.org:MaDgIK/dnet-role-management.git</developerConnection>
|
<developerConnection>scm:git:gitea@code-repo.d4science.org:MaDgIK/dnet-role-management.git</developerConnection>
|
||||||
<tag>dnet-role-management-1.0.0</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -32,27 +27,7 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Spring Boot -->
|
<!-- Spring Boot Security -->
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-logging</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
@ -79,23 +54,17 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Json -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.6.2</version>
|
|
||||||
</dependency>
|
|
||||||
<!--swagger-->
|
<!--swagger-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
<version>2.7.0</version>
|
<version>${swagger-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--swagger official ui-->
|
<!--swagger official ui-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
<version>2.7.0</version>
|
<version>${swagger-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
@ -109,8 +78,10 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>eu.dnetlib.dnetrolemanagement.DnetRoleManagementApplication</mainClass>
|
<mainClass>eu.dnetlib.dnetrolemanagement.DnetRoleManagementApplication</mainClass>
|
||||||
|
<executable>true</executable>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
|
@ -5,6 +5,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.ParameterBuilder;
|
import springfox.documentation.builders.ParameterBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
@ -25,7 +28,7 @@ import java.util.List;
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile({"swagger"})
|
@Profile({"swagger"})
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
private final APIProperties apiProperties;
|
private final APIProperties apiProperties;
|
||||||
|
|
||||||
|
@ -64,5 +67,20 @@ public class SwaggerConfig {
|
||||||
.build();
|
.build();
|
||||||
return Collections.singletonList(authTokenHeader);
|
return Collections.singletonList(authTokenHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
|
registry.addRedirectViewController("/v2/api-docs", "/v2/api-docs");
|
||||||
|
registry.addRedirectViewController("/swagger-resources/configuration/ui", "/swagger-resources/configuration/ui");
|
||||||
|
registry.addRedirectViewController("/swagger-resources/configuration/security", "/swagger-resources/configuration/security");
|
||||||
|
registry.addRedirectViewController("/swagger-resources", "/swagger-resources");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
registry.addResourceHandler("/swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
|
||||||
|
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue