GH-1064 - Move AOT processor to generate application module metadata into runtime module.
This commit is contained in:
@@ -25,6 +25,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.modulith.actuator.ApplicationModulesEndpoint;
|
||||
import org.springframework.modulith.core.util.ApplicationModulesExporter;
|
||||
import org.springframework.modulith.runtime.ApplicationModulesRuntime;
|
||||
import org.springframework.util.function.ThrowingSupplier;
|
||||
|
||||
@@ -36,7 +37,7 @@ import org.springframework.util.function.ThrowingSupplier;
|
||||
@AutoConfiguration
|
||||
class ApplicationModulesEndpointConfiguration {
|
||||
|
||||
static final String FILE_LOCATION = "META-INF/spring-modulith/application-modules.json";
|
||||
private static final String FILE_LOCATION = ApplicationModulesExporter.DEFAULT_LOCATION;
|
||||
|
||||
private static final Resource PRECOMPUTED = new ClassPathResource(FILE_LOCATION);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationModulesEndpointConfiguration.class);
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
|
||||
org.springframework.modulith.actuator.autoconfigure.ApplicationModulesFileGeneratingProcessor
|
||||
@@ -50,6 +50,8 @@ import com.tngtech.archunit.core.domain.JavaClass;
|
||||
*/
|
||||
public class ApplicationModulesExporter {
|
||||
|
||||
public static final String DEFAULT_LOCATION = "META-INF/spring-modulith/application-modules.json";
|
||||
|
||||
private static final Function<NamedInterface, Stream<String>> TO_EXPOSED_TYPES = it -> it.asJavaClasses()
|
||||
.map(JavaClass::getName);
|
||||
private static final Function<Set<DependencyType>, Set<DependencyType>> REMOVE_DEFAULT_DEPENDENCY_TYPE_IF_OTHERS_PRESENT = it -> {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.modulith.actuator.autoconfigure;
|
||||
package org.springframework.modulith.runtime.autoconfigure;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.modulith.runtime.ApplicationModulesRuntime;
|
||||
* {@value ApplicationModulesEndpointConfiguration#FILE_LOCATION}.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
* @since 1.1
|
||||
* @since 1.4
|
||||
*/
|
||||
class ApplicationModulesFileGeneratingProcessor implements BeanFactoryInitializationAotProcessor {
|
||||
|
||||
@@ -45,7 +45,7 @@ class ApplicationModulesFileGeneratingProcessor implements BeanFactoryInitializa
|
||||
|
||||
var runtime = beanFactory.getBean(ApplicationModulesRuntime.class);
|
||||
var exporter = new ApplicationModulesExporter(runtime.get());
|
||||
var location = ApplicationModulesEndpointConfiguration.FILE_LOCATION;
|
||||
var location = ApplicationModulesExporter.DEFAULT_LOCATION;
|
||||
|
||||
LOGGER.info("Generating application modules information to {}", location);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
|
||||
org.springframework.modulith.runtime.autoconfigure.ApplicationModulesFileGeneratingProcessor
|
||||
Reference in New Issue
Block a user