Skip to content

Commit

Permalink
[NO-JIRA] Fix bean naming in API V2 + enable failing fast in case sam…
Browse files Browse the repository at this point in the history
…e bean names appears
  • Loading branch information
jacek-poreda-sonarsource authored and sonartech committed Sep 4, 2024
1 parent 26138ba commit a4e8edf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
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
Expand Down Expand Up @@ -152,7 +153,8 @@ public RuleController ruleController(UserSession userSession, RuleService ruleSe
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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;
Expand Down Expand Up @@ -88,6 +89,8 @@ public void initDispatcherLevel4(PlatformLevel platformLevel) {

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)) {
Expand Down
2 changes: 1 addition & 1 deletion sonar-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a4e8edf

Please sign in to comment.