Skip to content

Commit

Permalink
Add @ConditionalOnMissingBean on beans in `UrlMappingsPluginConfigu…
Browse files Browse the repository at this point in the history
…ration`

Closes gh-808
  • Loading branch information
rainboyan committed Dec 18, 2024
1 parent d7e8669 commit 2cab9ff
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 the original author or authors.
* Copyright 2021-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,6 +76,7 @@ public UrlConverter hyphenatedUrlConverter() {
}

@Bean
@ConditionalOnMissingBean
public UrlMappingsHandlerMapping urlMappingsHandlerMapping(ObjectProvider<GrailsApplication> grailsApplicationProvider,
ObjectProvider<UrlMappingsHolder> urlMappingsHolderProvider,
GrailsCorsConfiguration grailsCorsConfiguration) {
Expand All @@ -93,6 +94,7 @@ public UrlMappingsHandlerMapping urlMappingsHandlerMapping(ObjectProvider<Grails
}

@Bean
@ConditionalOnMissingBean
public UrlMappingsInfoHandlerAdapter urlMappingsInfoHandlerAdapter(
ObjectProvider<ActionResultTransformer> actionResultTransformerProvider,
LinkGenerator grailsLinkGenerator) {
Expand All @@ -107,6 +109,7 @@ public UrlMappingsInfoHandlerAdapter urlMappingsInfoHandlerAdapter(
}

@Bean
@ConditionalOnMissingBean
public UrlMappingsHolderFactoryBean grailsUrlMappingsHolder(
ObjectProvider<GrailsApplication> grailsApplication,
ObjectProvider<GrailsPluginManager> pluginManager,
Expand All @@ -121,6 +124,7 @@ public UrlMappingsHolderFactoryBean grailsUrlMappingsHolder(
}

@Bean({"linkGenerator", "grailsLinkGenerator"})
@ConditionalOnMissingBean
public LinkGenerator grailsLinkGenerator(ObjectProvider<GrailsApplication> grailsApplicationProvider,
ObjectProvider<UrlMappingsHolder> grailsUrlMappingsHolder) {
Config config = grailsApplicationProvider.getIfAvailable().getConfig();
Expand Down

0 comments on commit 2cab9ff

Please sign in to comment.