I have a project that uses spring-cloud-function-adapter-aws. My main class has a custom @ComponentScan that forces a scan of a package dependency I bring in with maven.
@SpringBootApplication
@ComponentScan(basePackages = {"com.mypackage.mobileapi", "com.mypackage.data"})
public class MobileapiApplication {
public static void main(String[] args) {
SpringApplication.run(MobileapiApplication.class, args);
}
}
In the com.mypackage.data dependency, I set up HikariCP in an @Configuration class that uses an @Profile annotation. I have that profile set to active in my application.properties file. When testing locally, everything works as expected. The com.mypackage.data configuration class is loaded and the Hikari dataSource is created.
However, when uploading and testing my MobileapiApplication in AWS Lambda, the component scan is not running. As a result, my Hikari dataSource isn't getting created and my function complains that I have not setup a dataSource. I am not using spring.cloud.function.scan.packages in my application.properties file, so the @ComponentScan shouldn't be getting overridden.
Why would running this package as an AWS Lambda prevent the custom @ComponentScan?
I'm using spring-boot-starter-parent 2.7.1 with dependencyManagement of spring-cloud-dependencies 2021.0.3.
I have a project that uses spring-cloud-function-adapter-aws. My main class has a custom @ComponentScan that forces a scan of a package dependency I bring in with maven.
In the
com.mypackage.data
dependency, I set up HikariCP in an @Configuration class that uses an @Profile annotation. I have that profile set to active in myapplication.properties
file. When testing locally, everything works as expected. Thecom.mypackage.data
configuration class is loaded and the Hikari dataSource is created.However, when uploading and testing my
MobileapiApplication
in AWS Lambda, the component scan is not running. As a result, my Hikari dataSource isn't getting created and my function complains that I have not setup a dataSource. I am not usingspring.cloud.function.scan.packages
in my application.properties file, so the @ComponentScan shouldn't be getting overridden.Why would running this package as an AWS Lambda prevent the custom @ComponentScan?
I'm using spring-boot-starter-parent 2.7.1 with dependencyManagement of spring-cloud-dependencies 2021.0.3.