From 6b2f4ad20acdee8e64821519aa666674c2681bcf Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Sun, 15 Jun 2025 11:42:47 +0200 Subject: [PATCH] Adjust spring annotations - remove ComponentScan and Configuration annotations from spring boot main class - declare RestTemplate in separate RestClientConfiguration class - build RestTemplate from dependency injected RestTemplateBuilder to support trace context propagation (when tracing is later added) - bump snapshot version to 1.13.0-SNAPSHOT Issue-ID: SO-4172 Change-Id: I9b3cbccb4b04773558ea3f39bc8930f59c0f8ac6 Signed-off-by: Fiete Ostkamp --- packages/docker/pom.xml | 4 +-- packages/pom.xml | 4 +-- pom.xml | 2 +- so-cnf-adapter-application/pom.xml | 4 +-- .../onap/so/adapters/cnf/MSOCnfApplication.java | 11 ------- .../so/adapters/cnf/RestClientConfiguration.java | 35 ++++++++++++++++++++++ so-cnfm/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml | 2 +- .../so-cnfm-lcm/so-cnfm-lcm-application/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml | 2 +- .../so-cnfm-lcm-database-service/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml | 2 +- version.properties | 4 +-- 14 files changed, 51 insertions(+), 27 deletions(-) create mode 100644 so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/RestClientConfiguration.java diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index 1bfade4..b638d93 100755 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -4,10 +4,10 @@ org.onap.so.adapters.so-cnf-adapter packages - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT org.onap.so.adapters.so-cnf-adapter.packages - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT pom docker Docker Packaging diff --git a/packages/pom.xml b/packages/pom.xml index d78cf28..7969a86 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -4,11 +4,11 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT packages pom - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT Packages diff --git a/pom.xml b/pom.xml index c325fa0..0cd05fd 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT SO CNF Adapter pom diff --git a/so-cnf-adapter-application/pom.xml b/so-cnf-adapter-application/pom.xml index b745c59..b82a62f 100755 --- a/so-cnf-adapter-application/pom.xml +++ b/so-cnf-adapter-application/pom.xml @@ -26,10 +26,10 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnf-adapter-application - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT SO CNF Application Jar ${project.artifactId}-${project.version} diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java index a437b9d..5984192 100644 --- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java @@ -28,25 +28,14 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestTemplate; @SpringBootApplication -@ComponentScan(basePackages = {"org.onap.so.adapters.cnf", "org.onap.so.spring"}) @EnableAutoConfiguration(exclude = {LiquibaseAutoConfiguration.class, HibernateJpaAutoConfiguration.class, DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, SecurityAutoConfiguration.class}) -@Configuration public class MSOCnfApplication { public static void main(String... args) { SpringApplication.run(MSOCnfApplication.class, args); } - - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } } diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/RestClientConfiguration.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/RestClientConfiguration.java new file mode 100644 index 0000000..b8ffbd6 --- /dev/null +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/RestClientConfiguration.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2025 Deutsche Telekom. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.cnf; + +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestClientConfiguration { + + @Bean + RestTemplate restTemplate(RestTemplateBuilder builder) { + return builder.build(); + } +} diff --git a/so-cnfm/pom.xml b/so-cnfm/pom.xml index 0ba6c9f..7abfb00 100644 --- a/so-cnfm/pom.xml +++ b/so-cnfm/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnfm pom diff --git a/so-cnfm/so-cnfm-lcm/pom.xml b/so-cnfm/so-cnfm-lcm/pom.xml index 2cf7667..316b8e3 100644 --- a/so-cnfm/so-cnfm-lcm/pom.xml +++ b/so-cnfm/so-cnfm-lcm/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter so-cnfm - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml index 04075bc..38147c2 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnfm-lcm-api diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml index 86a97f0..14fed45 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnfm-lcm-application diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml index d183161..447577e 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnfm-lcm-bpmn-flows diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml index afa923b..f5ee660 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnfm-lcm-database-service diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml index a683ef6..7b6cbef 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.12.1-SNAPSHOT + 1.13.0-SNAPSHOT so-cnfm-lcm-service diff --git a/version.properties b/version.properties index 0e7c66e..362b4c7 100644 --- a/version.properties +++ b/version.properties @@ -3,8 +3,8 @@ # because they are used in Jenkins, whose plug-in doesn't support.. major=1 -minor=12 -patch=3 +minor=13 +patch=0 base_version=${major}.${minor}.${patch} -- 2.16.6