Upgrade to Boot 3.x

- For now port spring-native to framework config.
- 3rd party configs should go somewhere else.
- Fix changes from javax to jakarta.
- Change java settings as we now require jdk 17.
- Fixes #385
This commit is contained in:
Janne Valkealahti
2022-07-24 08:07:14 +01:00
parent 218abd7095
commit e193ca1d24
41 changed files with 589 additions and 858 deletions

View File

@@ -0,0 +1,49 @@
/*
* Copyright 2022 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.
* 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 org.springframework.shell.standard.commands;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.ReflectionHints;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
/**
* {@link RuntimeHintsRegistrar} for Shell Standard Commands temlate model classes.
*
* @author Janne Valkealahti
*/
class StandardCommandsModelsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
ReflectionHints reflection = hints.reflection();
registerForDeclaredMethodsInvocation(reflection, CommandAvailabilityInfoModel.class, CommandInfoModel.class,
CommandParameterInfoModel.class, GroupCommandInfoModel.class, GroupsInfoModel.class);
}
private void registerForDeclaredMethodsInvocation(ReflectionHints reflection, Class<?>... classes) {
reflection.registerTypes(typeReferences(classes),
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_METHODS));
}
private Iterable<TypeReference> typeReferences(Class<?>... classes) {
return Stream.of(classes).map(TypeReference::of).collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2022 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.
* 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 org.springframework.shell.standard.commands;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
/**
* {@link RuntimeHintsRegistrar} for Shell Standard Commands resources.
*
* @author Janne Valkealahti
*/
class StandardCommandsResourcesRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.resources()
.registerPattern("template/*.st")
.registerPattern("template/*.stg");
}
}

View File

@@ -1,26 +0,0 @@
[
{
"name": "org.springframework.shell.standard.commands.CommandInfoModel",
"allDeclaredMethods": true
},
{
"name": "org.springframework.shell.standard.commands.CommandParameterInfoModel",
"allDeclaredMethods": true
},
{
"name": "org.springframework.shell.standard.commands.GroupCommandInfoModel",
"allDeclaredMethods": true
},
{
"name": "org.springframework.shell.standard.commands.GroupsInfoModel",
"allDeclaredMethods": true
},
{
"name": "org.springframework.shell.standard.commands.CommandParameterInfoModel",
"allDeclaredMethods": true
},
{
"name": "org.springframework.shell.standard.commands.CommandAvailabilityInfoModel",
"allDeclaredMethods": true
}
]

View File

@@ -1,12 +0,0 @@
{
"resources": {
"includes": [
{
"pattern": "template/.*.st"
},
{
"pattern": "template/.*.stg"
}
]
}
}

View File

@@ -0,0 +1,3 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.shell.standard.commands.StandardCommandsResourcesRuntimeHints,\
org.springframework.shell.standard.commands.StandardCommandsModelsRuntimeHints

View File

@@ -23,7 +23,7 @@ import java.util.Collection;
import java.util.Locale;
import java.util.Optional;
import javax.validation.constraints.Max;
import jakarta.validation.constraints.Max;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;