]> source.dussan.org Git - sonarqube.git/commitdiff
[NO-JIRA] Fix bean naming in API V2 + enable failing fast in case same bean names...
authorJacek Poreda <jacek.poreda@sonarsource.com>
Wed, 4 Sep 2024 08:25:12 +0000 (10:25 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 4 Sep 2024 20:03:11 +0000 (20:03 +0000)
server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/PlatformLevel4WebConfig.java
server/sonar-webserver/src/main/java/org/sonar/server/platform/web/ApiV2Servlet.java
sonar-application/build.gradle

index 87ef131bb2975ffa4115bae5445ec3b24aed8e61..3bf8b16bf0bd7c953b0d823343d4188d8e0b8419 100644 (file)
@@ -89,6 +89,7 @@ import org.sonar.server.v2.common.DeprecatedHandler;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.Primary;
 import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
 
 @Configuration
@@ -152,7 +153,8 @@ public class PlatformLevel4WebConfig {
     return new DefaultRuleController(userSession, ruleService, ruleRestResponseGenerator);
   }
 
-  @Bean
+  @Primary
+  @Bean("org.sonar.server.v2.config.PlatformLevel4WebConfig.requestMappingHandlerMapping")
   public RequestMappingHandlerMapping requestMappingHandlerMapping(UserSession userSession) {
     RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
     handlerMapping.setInterceptors(new DeprecatedHandler(userSession));
index 8d1d7d22a1996e74b8a46a07287836a152a28d57..13bce63f78021f34ee8d3a298495d50867b72257 100644 (file)
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.sonar.server.platform.platformlevel.PlatformLevel;
 import org.sonar.server.v2.config.PlatformLevel4WebConfig;
 import org.sonar.server.v2.config.SafeModeWebConfig;
+import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
 import org.springframework.web.servlet.DispatcherServlet;
@@ -88,6 +89,8 @@ public class ApiV2Servlet implements Servlet {
 
   private DispatcherServlet initDispatcherServlet(PlatformLevel platformLevel, Class<?> configClass) {
     AnnotationConfigWebApplicationContext springMvcContext = new AnnotationConfigWebApplicationContext();
+    springMvcContext.setBeanNameGenerator(FullyQualifiedAnnotationBeanNameGenerator.INSTANCE);
+    springMvcContext.setAllowBeanDefinitionOverriding(false);
     springMvcContext.setParent(platformLevel.getContainer().context());
     springMvcContext.register(configClass);
     if (PlatformLevel4WebConfig.class.equals(configClass)) {
index f2da57e729099f1a2fe595a8163b8807ccf534bd..ee484a67c46228348614cf09335cdd93517c67d7 100644 (file)
@@ -339,7 +339,7 @@ task zip(type: Zip, dependsOn: [configurations.compileClasspath]) {
 zip {
   mustRunAfter cyclonedxBom
   doLast {
-    def minLength = 340000000
+    def minLength = 342000000
     def maxLength = 750000000
 
     def length = archiveFile.get().asFile.length()