asyncapi / java-spring-cloud-stream-template

Java Spring Cloud Stream template for the AsyncAPI Generator
31 stars 33 forks source link

Generated application won't execute in default pacakage #255

Open RobertOttesen opened 2 years ago

RobertOttesen commented 2 years ago

Describe the bug

If no javaPackage parameter is provided, the Main Application class is generated in the default/root package. Spring Boot will not start the application with the following warning:

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.

How to Reproduce

Generate any main application in the root package.

Expected behavior

Generate the main application in a default package other than the root package. Maybe generate in com.asyncapi.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

Mrc0113 commented 1 year ago

We should provide a default package of org.asyncapi as the value for javaPackage as if this isn't specified as we don't want Spring trying to do a component scan of the default package to avoid this.

If you use the default package, that means that Spring would have to scan every class loaded into the JVM. That's a lot of classes, most of which have nothing to do with your application. This would increase startup time to a ridiculous level.