I have a spring boot application with an embedded tomcat and make use of spring-boot-devtools to restart application if something changed in classpath.
My IDE is Spring Tool Suite and I switched of "Build Automatically" as I thought this could change files in the background which triggers the restart
My problem is that after tomcat and application ist started it immediately restart everything in an infinite loop:
2017-08-22 10:24:04.309 INFO 9772 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8055 (http)
2017-08-22 10:24:04.415 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Creating new Restarter for thread Thread[main,5,main]
2017-08-22 10:24:04.417 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Immediately restarting application
2017-08-22 10:24:04.418 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader#558f3be6
2017-08-22 10:24:04.419 DEBUG 9772 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Starting application test.web.MyApplication with URLs
2017-08-22 10:24:04.421 INFO 9772 --- [ restartedMain] test.web.MyApplication : Started MyApplication in 22.347 seconds (JVM running for 24.103)
2017-08-22 10:24:05.524 DEBUG 9772 --- [ File Watcher] o.s.boot.devtools.restart.Restarter : Restarting application
2017-08-22 10:24:05.527 DEBUG 9772 --- [ Thread-9] o.s.boot.devtools.restart.Restarter : Stopping application
2017-08-22 10:24:05.527 INFO 9772 --- [ Thread-9] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#68f499a9: startup date [Tue Aug 22 10:23:43 CEST 2017]; root of context hierarchy
2017-08-22 10:24:05.529 INFO 9772 --- [ Thread-9] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-08-22 10:24:05.537 INFO 9772 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-08-22 10:24:05.539 INFO 9772 --- [ Thread-9] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2017-08-22 10:24:05.567 INFO 9772 --- [ Thread-9] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2017-08-22 10:24:05.864 INFO 9772 --- [ost-startStop-2] org.apache.wicket.Application : [wicket-filter] destroy: DevUtils DebugBar Initializer
...
2017-08-22 10:44:04.309 INFO 9772 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8055 (http)
...
2017-08-22 10:44:04.421 INFO 9772 --- [ restartedMain] test.web.MyApplication : Started MyApplication in 22.347 seconds (JVM running for 24.103)
2017-08-22 10:44:05.527 DEBUG 9772 --- [ Thread-9] o.s.boot.devtools.restart.Restarter : Stopping application
Workaroud: I know with spring.devtools.restart.enabled = false I can stop this behaviour but of course I would like the restart if it's really necessary
Question:
How to find out which file change triggers the restart?
Anybody had similar issues?
Okay, I found the problem related to our application restart via Spring Boot DevTools after some seconds just after the application started.
The log file folder was scanned by DevTools and because the application writes logs to this folder after starting, each start triggered a reload of the whole application via DevTools.
The solution is to exclude the log folder from the monitoring within the application.yml:
spring:
devtools:
restart:
exclude: logs/**
If you´re using normal property files, it´s just the same but with (.) dots in between. See also http://www.logicbig.com/tutorials/spring-framework/spring-boot/restart-exclude/ for reference.
I have added in application.properties, then it was working fine. TQ
spring.devtools.restart.additional-exclude=logs/**
In IntelliJ Idea IDE
Edit Run/Debug Configurations... -> select your Spring Boot service item (at the left panel) -> set Running Application Update Policy:
On 'Update' action: Do nothing
On 'frame deactivation': Do nothing
Related
I bundle a Spring Boot application as a jar
The application spins a Jetty web server not a Tomcat, but I've noticed this behaviour with both types of servers.
I build it with Gradle and deploy it to an ubuntu instance with the following command over ssh:
nohup java -jar my_spring_boot_application.jar
The application works for a various amounts of time , hours, never a complete day, then it shut down :
2022-03-19 04:32:59.502 INFO 21118 --- [ Thread-10] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
2022-03-19 04:32:59.503 INFO 21118 --- [ Thread-10] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2022-03-19 04:32:59.514 INFO 21118 --- [ Thread-10] o.e.jetty.server.AbstractConnector : Stopped ServerConnector#1fdcfe4{HTTP/1.1,[http/1.1]}{0.0.0.0:5000}
2022-03-19 04:32:59.514 INFO 21118 --- [ Thread-10] org.eclipse.jetty.server.session : node0 Stopped scavenging
2022-03-19 04:32:59.517 INFO 21118 --- [ Thread-10] o.e.j.s.h.ContextHandler.application : Destroying Spring FrameworkServlet 'dispatcherServlet'
2022-03-19 04:32:59.518 INFO 21118 --- [ Thread-10] o.e.jetty.server.handler.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext#1e81f160{application,/,[file:///tmp/jetty-docbase.12854945495775065864.5000/],UNAVAILABLE}
How can I make the application run without eventually shutting down?
Where do I look to troubleshoot that?
In my example above I had spring.boot.starter.web on the classpath and the app failed to start. If I add org.apache.tomcat.embed.core then the application starts successfully.
When I configured module-info.java this way
requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.web;
requires spring.boot.starter.web;
2021-05-20 10:56:09.501 INFO 17112 --- [ main] com.example.police.PoliceApplication : Starting PoliceApplication using Java 11 on zhaozhiguang-pc with PID 17112 (D:\item\police\target\classes started by zhaozhiguang in D:\item\police)
2021-05-20 10:56:09.501 INFO 17112 --- [ main] com.example.police.PoliceApplication : No active profile set, falling back to default profiles: default
2021-05-20 10:56:10.565 INFO 17112 --- [ main] com.example.police.PoliceApplication : Started PoliceApplication in 1.435 seconds (JVM running for 3.153)
Process finished with exit code 0
My guess is that Tomcat didn't boot
or
requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.web;
requires org.apache.tomcat.embed.core;
This one worked
2021-05-20 10:57:48.097 INFO 13740 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-05-20 10:57:48.334 INFO 13740 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-05-20 10:57:48.381 INFO 13740 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-05-20 10:57:48.396 INFO 13740 --- [ main] com.example.police.PoliceApplication : Started PoliceApplication in 2.001 seconds (JVM running for 3.202)
2021-05-20 10:57:48.846 INFO 13740 --- [)-192.168.1.107] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-05-20 10:57:48.846 INFO 13740 --- [)-192.168.1.107] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-05-20 10:57:48.847 INFO 13740 --- [)-192.168.1.107] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
why?
spring.boot.starter.web depend on org.apache.tomcat.embed.core ?
One of the main features of Spring Boot is auto-configuration, which means that it configures a feature if it's available.
However, with Java modules, "available" is not just determined by the jar being on the classpath, but also by access being granted with the requires statement.
Without the requires statement, Spring Boot's auto-configuration cannot see Tomcat, so it doesn't even attempt to configure it.
Result: Silently ignores that feature.
I am using eclipse IDE to run my spring boot project(the backend part) which uses the port 8080 on localhost. When i try to run my program it shuts down the program saying port 8080 was already in use. There isn't any other application that is using the port 8080 and there is no other console window because of which i cannot shut down the currently running application that is using port 8080. PFB the logs from the console window:
:: Spring Boot :: (v2.3.3.RELEASE)
2020-09-24 19:31:44.942 INFO 4092 --- [ main] c.library_management.lms.LmsApplication : Starting LmsApplication on DESKTOP-GM2UUP2 with PID 4092 (D:\eclipse-workspace\lms\target\classes started by Electrical Engineer in D:\eclipse-workspace\lms)
2020-09-24 19:31:44.948 INFO 4092 --- [ main] c.library_management.lms.LmsApplication : No active profile set, falling back to default profiles: default
2020-09-24 19:31:50.633 INFO 4092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-09-24 19:31:51.947 INFO 4092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 1092ms. Found 3 JPA repository interfaces.
2020-09-24 19:31:59.953 INFO 4092 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-09-24 19:32:00.358 INFO 4092 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-09-24 19:32:00.360 INFO 4092 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-09-24 19:32:01.666 INFO 4092 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-09-24 19:32:01.667 INFO 4092 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 16526 ms
2020-09-24 19:32:05.077 INFO 4092 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-24 19:32:06.080 INFO 4092 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-09-24 19:32:06.793 WARN 4092 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-09-24 19:32:08.214 INFO 4092 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.20.Final
2020-09-24 19:32:16.114 INFO 4092 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-09-24 19:32:16.817 INFO 4092 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#5477a1ca, org.springframework.security.web.context.SecurityContextPersistenceFilter#6794ac0b, org.springframework.security.web.header.HeaderWriterFilter#77d680e6, org.springframework.security.web.authentication.logout.LogoutFilter#33a3c44a, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#222afc67, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#5cb5bb88, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#3a01773b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#3ae9d1e2, org.springframework.security.web.session.SessionManagementFilter#5c1f6d57, org.springframework.security.web.access.ExceptionTranslationFilter#6014a9ba, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#65f2f9b0]
2020-09-24 19:32:21.739 INFO 4092 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-09-24 19:32:26.793 WARN 4092 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8080 is already in use
2020-09-24 19:32:26.862 INFO 4092 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-09-24 19:32:31.239 INFO 4092 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-09-24 19:32:31.877 INFO 4092 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2020-09-24 19:32:41.109 INFO 4092 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-09-24 19:32:41.172 INFO 4092 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
Exception in thread "task-2" 2020-09-24 19:32:41.202 INFO 4092 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2020-09-24 19:32:41.204 INFO 4092 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
java.lang.IllegalStateException: EntityManagerFactory is closed
at org.hibernate.internal.SessionFactoryImpl.validateNotClosed(SessionFactoryImpl.java:509)
at org.hibernate.internal.SessionFactoryImpl.getProperties(SessionFactoryImpl.java:503)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.findDataSource(DataSourceInitializedPublisher.java:105)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.publishEventIfRequired(DataSourceInitializedPublisher.java:97)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.access$100(DataSourceInitializedPublisher.java:50)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher$DataSourceSchemaCreatedPublisher.lambda$postProcessEntityManagerFactory$0(DataSourceInitializedPublisher.java:200)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2020-09-24 19:32:41.413 INFO 4092 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-09-24 19:32:41.418 INFO 4092 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-09-24 19:32:41.629 INFO 4092 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-09-24 19:32:41.652 ERROR 4092 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
This can be because you might gave run the project first (so it occupied the port) and now you are trying to run it again without closing the last one.Use this Option
The error message is not ambiguous, and that's not something that will occur "erroneously" (saying something is using the port when it's not actually in use). The port doesn't have to be used by something you started from Eclipse. There is no question that something is already listening on that port. You just have to figure out what it is. Alternatively, you could set up your application to run on a different port.
This is what spring does when I start it. It won't even show an error, but it won't create my database.
When I removed LocalDateTime variables, it worked fine and the database is created. Can someone give me some help
2020-08-19 02:08:14.204 INFO 10972 --- [ restartedMain] workshop.WRealestateApplication : Starting WRealestateApplication on DESKTOP-TUAMB9Q with PID 10972 (D:\Java WEB Basic\Workshop realestate\target\classes started by Borislav in D:\Java WEB Basic\Workshop realestate)
2020-08-19 02:08:14.207 INFO 10972 --- [ restartedMain] workshop.WRealestateApplication : No active profile set, falling back to default profiles: default
2020-08-19 02:08:16.012 WARN 10972 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-08-19 02:08:16.194 INFO 10972 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-08-19 02:08:16.249 WARN 10972 --- [ restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2020-08-19 02:08:16.322 INFO 10972 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-08-19 02:08:16.415 INFO 10972 --- [ restartedMain] workshop.WRealestateApplication : Started WRealestateApplication in 2.677 seconds (JVM running for 3.58)
I have two spring boot apps with their own application.properties.
One is in my src/main/resources as application.properties and the other as test.properties in src/test/resources.
I want it so that when I launch my spring boot app in main, it also simultaneously launches the spring boot app in my test. I want to do this in Maven command line but I was also wondering if it is possible to do in Spring Boot as well, perhaps programmatically?
The spring boot apps are running on localhost but two different ports.
The one in main is running on localhost:28433 and the other on localhost:9119.
I have tried running this mvn command:
mvn spring-boot:run -Drun.arguments="--server.port=9119""--server.port=28433"
I am not sure this works though.. when I run it in my terminal it outputs this:
t.TomcatWebServer : Tomcat initialized with port(s): 28433 (http)
2019-08-12 15:25:51.641 INFO 37469 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-08-12 15:25:51.641 INFO 37469 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
2019-08-12 15:25:51.649 INFO 37469 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/asluborski/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-08-12 15:25:51.707 INFO 37469 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-08-12 15:25:51.707 INFO 37469 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 934 ms
2019-08-12 15:25:51.731 INFO 37469 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet messageDispatcherServlet mapped to [/nulogix/ws/*]
2019-08-12 15:25:51.732 INFO 37469 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2019-08-12 15:25:51.735 INFO 37469 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-08-12 15:25:51.735 INFO 37469 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-08-12 15:25:51.735 INFO 37469 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'formContentFilter' to: [/*]
2019-08-12 15:25:51.736 INFO 37469 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-08-12 15:25:51.760 DEBUG 37469 --- [ main] c.n.b.service.PredictionEngineService : billing.engine.address=127.0.0.1
2019-08-12 15:25:51.760 DEBUG 37469 --- [ main] c.n.b.service.PredictionEngineService : billing.engine.port=9119
2019-08-12 15:25:51.760 DEBUG 37469 --- [ main] c.n.b.service.PredictionEngineService : Using http://127.0.0.1:9119
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/Users/asluborski/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.11/jaxb-impl-2.2.11.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-08-12 15:25:52.037 DEBUG 37469 --- [ main] c.n.billing.ws.endpoint.AnalyzeEndPoint : billing.engine.api.version=0.97
2019-08-12 15:25:52.038 DEBUG 37469 --- [ main] c.n.billing.ws.endpoint.AnalyzeEndPoint : billing.engine.core.version=0.97
2019-08-12 15:25:52.038 DEBUG 37469 --- [ main] c.n.billing.ws.endpoint.AnalyzeEndPoint : billing.engine.core.name=Nulogix_Patient_Responsibility
2019-08-12 15:25:52.039 DEBUG 37469 --- [ main] c.n.b.ws.endpoint.GetVersionEndPoint : billing.engine.api.version=0.97
2019-08-12 15:25:52.184 INFO 37469 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-08-12 15:25:52.398 INFO 37469 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 28433 (http) with context path ''
2019-08-12 15:25:52.402 INFO 37469 --- [ main] com..billing.App : Started App in 1.995 seconds (JVM running for 9.911)
It says above that it is using 127.0.0.1:9119 but it seems to only start my main App but not my test App which is specifically called mockServerApp so I do not think it is doing what I want...
How do I launch these simultaneously?
I'm can't tell what mockServerApp is being used for, but I don't think bootRun handles multiple applications or even scans your test classes.
If you want to mock an external dependency for unit testing purposes, you should wrap the calls in a proxy class of some sort and use #MockBean to inject a mock instance.
If you want to deploy a stub external dependency for development purposes, you could create a separate project for the stub as a parent directory that would invoke maven on startup. You could even implement the mock in a different framework or language.
The most straightforward option, though would be to write a shell script that launches and kills both services.
For specifying the ports, in the application.properties of each set the server.port to be an environment variable:
primary application.conf:
server.port=${MY_APP_PORT:28433}
mock application.conf:
server.port=${MOCK_APP_PORT:9119}
For launching external dependencies in integration tests, check out Testcontainers