You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected that when enabling eager initialization (of singletons), the application would continue to work as before.
Actual Behaviour
I get an exception when the application is booting with eager initialization (of singletons) is enabled. The exception is the following:
15:19:48.141 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [io.micronaut.spring.boot.ApplicationRunnerListener] could not be loaded: Failed to inject value for parameter [commandLine] of class: io.micronaut.spring.boot.ApplicationRunnerListener
Message: No bean of type [io.micronaut.core.cli.CommandLine] exists.
Path Taken: new ApplicationRunnerListener(CommandLine commandLine,List<CommandLineRunner E> commandLineRunnerList,List<ApplicationRunner E> applicationRunnerList) --> new ApplicationRunnerListener([CommandLine commandLine],List<CommandLineRunner E> commandLineRunnerList,List<ApplicationRunner E> applicationRunnerList)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [io.micronaut.spring.boot.ApplicationRunnerListener] could not be loaded: Failed to inject value for parameter [commandLine] of class: io.micronaut.spring.boot.ApplicationRunnerListener
Message: No bean of type [io.micronaut.core.cli.CommandLine] exists.
Path Taken: new ApplicationRunnerListener(CommandLine commandLine,List<CommandLineRunner E> commandLineRunnerList,List<ApplicationRunner E> applicationRunnerList) --> new ApplicationRunnerListener([CommandLine commandLine],List<CommandLineRunner E> commandLineRunnerList,List<ApplicationRunner E> applicationRunnerList)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1996)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:307)
at io.micronaut.context.DefaultBeanContext.configureAndStartContext(DefaultBeanContext.java:3314)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:345)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:215)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
at io.github.lengors.Application.main(Application.java:15)
Caused by: io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for parameter [commandLine] of class: io.micronaut.spring.boot.ApplicationRunnerListener
Message: No bean of type [io.micronaut.core.cli.CommandLine] exists.
Path Taken: new ApplicationRunnerListener(CommandLine commandLine,List<CommandLineRunner E> commandLineRunnerList,List<ApplicationRunner E> applicationRunnerList) --> new ApplicationRunnerListener([CommandLine commandLine],List<CommandLineRunner E> commandLineRunnerList,List<ApplicationRunner E> applicationRunnerList)
at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2204)
at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForConstructorArgument(AbstractInitializableBeanDefinition.java:1350)
at io.micronaut.spring.boot.$ApplicationRunnerListener$Definition.instantiate(Unknown Source)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2330)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2300)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2312)
at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3123)
at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:3025)
at io.micronaut.context.DefaultBeanContext.initializeEagerBean(DefaultBeanContext.java:2698)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1990)
... 6 common frames omitted
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.core.cli.CommandLine] exists.
at io.micronaut.context.DefaultBeanContext.newNoSuchBeanException(DefaultBeanContext.java:2794)
at io.micronaut.context.DefaultApplicationContext.newNoSuchBeanException(DefaultApplicationContext.java:322)
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2757)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1745)
at io.micronaut.context.AbstractBeanResolutionContext.getBean(AbstractBeanResolutionContext.java:89)
at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2188)
... 16 common frames omitted
Steps To Reproduce
Simply clone the linked example and run:
./mvnw clean mn:run
Alternatively, go to micronaut launch, select the spring and spring-boot features.
Then enable eagear initialization of singletons as follows:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
Micronaut
.build(args)
.classes(Application.class)
.eagerInitSingletons(true)
.start();
}
}
Expected Behavior
I expected that when enabling eager initialization (of singletons), the application would continue to work as before.
Actual Behaviour
I get an exception when the application is booting with eager initialization (of singletons) is enabled. The exception is the following:
Steps To Reproduce
Simply clone the linked example and run:
Alternatively, go to micronaut launch, select the
spring
andspring-boot
features.Then enable eagear initialization of singletons as follows:
Finally, run the same command as above.
Environment Information
Example Application
https://github.com/lengors/micronaut-spring-bug-demo
Version
4.6.2
The text was updated successfully, but these errors were encountered: