Skip to content

Logging beans are missing during AOT processing #32483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sdeleuze opened this issue Sep 23, 2022 · 3 comments
Closed

Logging beans are missing during AOT processing #32483

sdeleuze opened this issue Sep 23, 2022 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@sdeleuze
Copy link
Contributor

When running https://github.com/spring-projects/spring-aot-smoke-tests/tree/main/actuator-webmvc on the JVM, http://localhost:8080/actuator/loggers is accessible. On native, it is not and returns a 404.

@wilkinsona
Copy link
Member

I see the same problem on the JVM with AOT enabled. Looking at the generated code, there's no definition for the loggersEndpoint bean:

package org.springframework.boot.actuate.autoconfigure.logging;

import java.lang.Class;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;

/**
 * Bean definitions for {@link LoggersEndpointAutoConfiguration}
 */
public class LoggersEndpointAutoConfiguration__BeanDefinitions {
  /**
   * Get the bean definition for 'loggersEndpointAutoConfiguration'
   */
  public static BeanDefinition getLoggersEndpointAutoConfigurationBeanDefinition() {
    Class<?> beanType = LoggersEndpointAutoConfiguration.class;
    RootBeanDefinition beanDefinition = new RootBeanDefinition(beanType);
    beanDefinition.setInstanceSupplier(LoggersEndpointAutoConfiguration::new);
    return beanDefinition;
  }
}

It looks like the conditions didn't match when evaluated at build time. I suspect it's because the LoggingSystem bean is missing.

@wilkinsona
Copy link
Member

The LoggingSystem bean should be registered at the end of SpringApplication's preparation of the context via the ApplicationPreparedEvent that's published due to the contextLoaded call to the run listeners. However, the ApplicationPreparedEvent is never published as the AOT processing hook's run listener is called before EventPublishingRunListener and it throws an AbandonedRunException.

@wilkinsona wilkinsona changed the title Loggers actuator endpoint not accessible on native Loggers actuator endpoint not accessible after AOT processing Sep 23, 2022
@wilkinsona wilkinsona changed the title Loggers actuator endpoint not accessible after AOT processing Logging beans are lost following AOT processing Sep 23, 2022
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 23, 2022
@wilkinsona wilkinsona added this to the 3.0.0-RC1 milestone Sep 23, 2022
@wilkinsona wilkinsona changed the title Logging beans are lost following AOT processing Logging beans are missing after AOT processing Sep 23, 2022
@wilkinsona wilkinsona self-assigned this Sep 23, 2022
@wilkinsona
Copy link
Member

Closed by 26eff5a.

@wilkinsona wilkinsona changed the title Logging beans are missing after AOT processing Logging beans are missing during AOT processing Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants