2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 package org.onap.clamp.clds;
26 import java.util.ArrayList;
27 import java.util.Collection;
29 import javax.ws.rs.client.Client;
30 import javax.ws.rs.client.ClientBuilder;
32 import org.apache.camel.component.servlet.CamelHttpTransportServlet;
33 import org.camunda.bpm.spring.boot.starter.webapp.CamundaBpmWebappAutoConfiguration;
34 import org.springframework.boot.SpringApplication;
35 import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration;
36 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
37 import org.springframework.boot.autoconfigure.SpringBootApplication;
38 import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
39 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
40 import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
41 import org.springframework.boot.builder.SpringApplicationBuilder;
42 import org.springframework.boot.web.servlet.ServletRegistrationBean;
43 import org.springframework.boot.web.support.SpringBootServletInitializer;
44 import org.springframework.context.annotation.Bean;
45 import org.springframework.context.annotation.ComponentScan;
46 import org.springframework.scheduling.annotation.EnableAsync;
48 import com.att.ajsc.common.utility.SystemPropertiesLoader;
50 @SpringBootApplication
51 @ComponentScan(basePackages = { "org.onap.clamp.clds", "com.att.ajsc" })
52 @EnableAutoConfiguration(exclude = { CamundaBpmWebappAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
53 JpaRepositoriesAutoConfiguration.class, SecurityAutoConfiguration.class,
54 ManagementWebSecurityAutoConfiguration.class })
56 public class Application extends SpringBootServletInitializer {
58 private static final String CAMEL_SERVLET_NAME = "CamelServlet";
59 private static final String CAMEL_URL_MAPPING = "/restservices/clds/v1/*";
62 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
63 return application.sources(Application.class);
66 public static void main(String[] args) throws Exception {
67 SystemPropertiesLoader.addSystemProperties();
68 SpringApplication.run(Application.class, args);
72 public ServletRegistrationBean servletRegistrationBean() {
73 ServletRegistrationBean registration = new ServletRegistrationBean();
74 registration.setName(CAMEL_SERVLET_NAME);
75 registration.setServlet(new CamelHttpTransportServlet());
76 Collection<String> urlMappings = new ArrayList<>();
77 urlMappings.add(CAMEL_URL_MAPPING);
78 registration.setUrlMappings(urlMappings);
83 public Client restClient() {
84 return ClientBuilder.newClient();