Category : spring-boot

Running testcontainers leads to failed initialization. Config class: @ActiveProfiles("test") @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) @ContextConfiguration(initializers = {Postgres.Initializer.class}) @SpringBootTest @Transactional @Sql("classpath: schema.sql") public abstract class IntegrationTestConfig { @Autowired protected ApplicationContext applicationContext; @BeforeAll static void startContainer(){ Postgres.CONTAINER.start(); } } Initializer class: @UtilityClass public class Postgres { public static final PostgreSQLContainer CONTAINER = new PostgreSQLContainer("postgres:14.0"); public static class Initializer implements ..

Read more

Unable to host my Spring Boot modules on Docker environment. Here, I am connecting Oracle database11g and Sleuth, Zipkin, RabbitMQ. If i am not adding sleuth, Zipkin, Rabbitmq then my docker-compose file executing successfully but i am facing issues after adding these 3 features. any help…. Below provided one is my docker-compose file version: ‘3.5’ ..

Read more

I have a Spring boot app running inside a docker container on port 8080 and on the host 8082 Here is the docker log 2021-10-27 08:08:53,810 [main] INFO org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver – Exposing 2 endpoint(s) beneath base path ‘/actuator’ 2021-10-27 08:08:54,105 [main] INFO org.apache.coyote.http11.Http11NioProtocol – Starting ProtocolHandler ["http-nio-127.0.0.1-8080"] 2021-10-27 08:08:54,180 [main] INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer – Tomcat started on ..

Read more

There is no problem with my PC. The following problems occur when creating and running containers through docker build. I don’t know why this is happening. ERROR LOG 2021-10-26 23:59:18.131 WARN 1 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘postConstructInitializeBean’: Invocation of ..

Read more

I try to dockerize my java spring application. In my build.gradle implementation ‘org.testcontainers:junit-jupiter’ implementation ‘org.testcontainers:postgresql’ In my test file: @SpringBootTest class ApplicationTests { @ClassRule public static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer("postgres:11.1") .withDatabaseName("integration-tests-db") .withUsername("sa") .withPassword("sa"); static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { public void initialize(ConfigurableApplicationContext configurableApplicationContext) { TestPropertyValues.of( "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), "spring.datasource.username=" + postgreSQLContainer.getUsername(), "spring.datasource.password=" + postgreSQLContainer.getPassword() ..

Read more

I am developing small Spring Boot micro-service application. I am facing an issue when I am trying to create custom Spring image to deploy into Docker engine. To create new custom image I am using configuration element in Maven plugin section of my POM file. Error : Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.5:build-image (default-cli) on project ..

Read more