-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid having
TypeConverter
defined as beans
- Loading branch information
Showing
6 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
http-server/src/main/java/io/micronaut/http/server/ConvertersRegistrar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2017-2024 original authors | ||
* | ||
* 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 | ||
* | ||
* https://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. | ||
*/ | ||
package io.micronaut.http.server; | ||
|
||
import io.micronaut.core.annotation.Internal; | ||
import io.micronaut.core.convert.MutableConversionService; | ||
import io.micronaut.core.convert.TypeConverter; | ||
import io.micronaut.core.convert.TypeConverterRegistrar; | ||
import io.micronaut.http.server.cors.CorsOriginConfiguration; | ||
import io.micronaut.http.server.cors.CorsOriginConverter; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The HTTP server type converters registrar. | ||
* | ||
* @author Denis Stepanov | ||
* @since 4.3.0 | ||
*/ | ||
@Internal | ||
public final class ConvertersRegistrar implements TypeConverterRegistrar { | ||
|
||
@Override | ||
public void register(MutableConversionService conversionService) { | ||
conversionService.addConverter(Map.class, CorsOriginConfiguration.class, (TypeConverter) new CorsOriginConverter()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ver/src/main/resources/META-INF/services/io.micronaut.core.convert.TypeConverterRegistrar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.micronaut.http.s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
http/src/main/resources/META-INF/services/io.micronaut.core.convert.TypeConverterRegistrar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
io.micronaut.http.MediaTypeConvertersRegistrar | ||
io.micronaut.http.ConvertersRegistrar | ||
io.micronaut.http.converters.SharedHttpConvertersRegistrar |