spring.jersey.type=filter
-spring.mvc.urls=swagger,docs,prometheus,auditevents,info,heapdump,autoconfig,beans,loggers,dump,env,trace,health,configprops,mappings,metrics,webjars
-
-
-server.contextPath=/network-discovery
-spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
-
-#This property is used to set the Tomcat connector attributes.developers can define multiple attributes separated by comma
-#tomcat.connector.attributes=allowTrace-true
-#The max number of active threads in this pool
-server.tomcat.max-threads=200
-#The minimum number of threads always kept alive
-server.tomcat.min-Spare-Threads=25
-#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
-server.tomcat.max-idle-time=60000
-
-#Servlet context parameters
-server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
#Enable HTTPS
server.port=8443
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.directory>${project.build.directory}/generated-resources/swagger</swagger.directory>
+
<!--docker -->
<docker.tag>${project.version}-${timestamp}</docker.tag>
<docker.latest.tag>${project.version}-latest</docker.latest.tag>
+
+ <jolt.version>0.1.0</jolt.version>
+
</properties>
+
+
<dependencyManagement>
<dependencies>
<dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>jolt-core</artifactId>
- <version>0.1.0</version>
+ <version>${jolt.version}</version>
</dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>json-utils</artifactId>
- <version>0.1.0</version>
+ <version>${jolt.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jetty</artifactId>
+
+ <!-- Springboot dependencies -->
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
<exclusions>
</exclusion>
</exclusions>
</dependency>
+
+ <!-- Required for swagger UI -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<executions>
<execution>
<goals>
+ <!-- required to package the jar correctly for springboot-->
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
-
+
<resources>
<resource>
<directory>src/main/resources</directory>
</includes>
</resource>
</resources>
+
</build>
<profiles>
package org.onap.sdnc.apps.pomba.networkdiscovery;
import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
-@ComponentScan(basePackages = {"org.onap.sdnc.apps.pomba.networkdiscovery"})
-@EnableAsync
-@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
import org.onap.sdnc.apps.pomba.networkdiscovery.service.rs.RestService;
import org.onap.sdnc.apps.pomba.networkdiscovery.service.rs.RestServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import io.swagger.jaxrs.listing.SwaggerSerializers;
@Component
-@ApplicationPath("/")
+@ApplicationPath("/network-discovery")
public class JerseyConfiguration extends ResourceConfig {
-
+
public static final String SERVICE_NAME = "network-discovery";
+ @Value("${spring.jersey.application-path:/network-discovery}")
+ private String apiPath;
+
private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
-
+
@Autowired
public JerseyConfiguration() {
register(RestServiceImpl.class);
@PostConstruct
public void init() {
// Register components where DI is needed
- this.configureSwagger();
+ configureSwagger();
}
private void configureSwagger() {
this.register(SwaggerSerializers.class);
BeanConfig config = new BeanConfig();
- config.setTitle("Network Discovery Swagger");
+ config.setTitle("Network Discovery API");
config.setVersion("v1");
- config.setSchemes(new String[] { "https", "http" });
- config.setBasePath("/" + SERVICE_NAME);
+ config.setSchemes(new String[] { "https", "http" });
+ config.setBasePath(apiPath);
config.setResourcePackage(RestService.class.getPackage().getName());
config.setPrettyPrint(true);
config.setScan(true);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
- url = "../swagger.json";
+ url = "/network-discovery/swagger.json";
//url = "http://petstore.swagger.io/v2/swagger.json";
}