Skip to content

Commit 65f7bb7

Browse files
committed
GH-1064 - Move AOT processor to generate application module metadata into runtime module.
1 parent 8042ad5 commit 65f7bb7

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

spring-modulith-actuator/src/main/java/org/springframework/modulith/actuator/autoconfigure/ApplicationModulesEndpointConfiguration.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.core.io.ClassPathResource;
2626
import org.springframework.core.io.Resource;
2727
import org.springframework.modulith.actuator.ApplicationModulesEndpoint;
28+
import org.springframework.modulith.core.util.ApplicationModulesExporter;
2829
import org.springframework.modulith.runtime.ApplicationModulesRuntime;
2930
import org.springframework.util.function.ThrowingSupplier;
3031

@@ -36,7 +37,7 @@
3637
@AutoConfiguration
3738
class ApplicationModulesEndpointConfiguration {
3839

39-
static final String FILE_LOCATION = "META-INF/spring-modulith/application-modules.json";
40+
private static final String FILE_LOCATION = ApplicationModulesExporter.DEFAULT_LOCATION;
4041

4142
private static final Resource PRECOMPUTED = new ClassPathResource(FILE_LOCATION);
4243
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationModulesEndpointConfiguration.class);

spring-modulith-actuator/src/main/resources/META-INF/spring/aot.factories

-2
This file was deleted.

spring-modulith-core/src/main/java/org/springframework/modulith/core/util/ApplicationModulesExporter.java

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
*/
5151
public class ApplicationModulesExporter {
5252

53+
public static final String DEFAULT_LOCATION = "META-INF/spring-modulith/application-modules.json";
54+
5355
private static final Function<NamedInterface, Stream<String>> TO_EXPOSED_TYPES = it -> it.asJavaClasses()
5456
.map(JavaClass::getName);
5557
private static final Function<Set<DependencyType>, Set<DependencyType>> REMOVE_DEFAULT_DEPENDENCY_TYPE_IF_OTHERS_PRESENT = it -> {
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.modulith.actuator.autoconfigure;
16+
package org.springframework.modulith.runtime.autoconfigure;
1717

1818
import org.slf4j.Logger;
1919
import org.slf4j.LoggerFactory;
@@ -28,7 +28,7 @@
2828
* {@value ApplicationModulesEndpointConfiguration#FILE_LOCATION}.
2929
*
3030
* @author Oliver Drotbohm
31-
* @since 1.1
31+
* @since 1.4
3232
*/
3333
class ApplicationModulesFileGeneratingProcessor implements BeanFactoryInitializationAotProcessor {
3434

@@ -45,7 +45,7 @@ public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableL
4545

4646
var runtime = beanFactory.getBean(ApplicationModulesRuntime.class);
4747
var exporter = new ApplicationModulesExporter(runtime.get());
48-
var location = ApplicationModulesEndpointConfiguration.FILE_LOCATION;
48+
var location = ApplicationModulesExporter.DEFAULT_LOCATION;
4949

5050
LOGGER.info("Generating application modules information to {}", location);
5151

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor=\
2+
org.springframework.modulith.runtime.autoconfigure.ApplicationModulesFileGeneratingProcessor

0 commit comments

Comments
 (0)