I have a java app that is just takes a jar from another project, the jar is using an infinite loop to poll for messages on AWS SQS topic.
The loop looks for methods annotated with @subscriber
in my client application.
I have a bean that will return a class which has a method annotated. When I remove the bean that is calling a class with an annotation method my tomcat is started on a port. When i add it in again there is no port hosted.
In the pom file I have these 2 dependencies added (along with some others but these should be the relevant ones)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
My main class looks like this
@SpringBootApplication
@ComponentScan(basePackages = {"com.mypackage.reuse", "com.mypackage.sample.subscriber"})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
The logs I get when I start my app
2020-03-12 14:32:56.228 INFO 2429 --- [ main] c.l.g.e.f.sample.subscriber.Application : The following profiles are active: development
2020-03-12 14:32:57.580 INFO 2429 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 1339 (http)
2020-03-12 14:32:57.586 INFO 2429 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-03-12 14:32:57.587 INFO 2429 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.29]
2020-03-12 14:32:57.650 INFO 2429 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-03-12 14:32:57.651 INFO 2429 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1363 ms
2020-03-12 14:32:58.038 INFO 2429 --- [ main] org.reflections.Reflections : Reflections took 111 ms to scan 2 urls, producing 23 keys and 53 values
there is no log after that I would expect something like this which is what I get if I remove the loop. When i remove the loop i get something like below but the problem is i need the loop to continuously poll.
Exposing 2 endpoint(s) beneath base path '/actuator'
Tomcat started on port(s): 1339 (http) with context path ''