Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

304
Visualizações
Cosmos DB Container Name with EL not resolving in SpringBootTest
@SpringBootTest(properties = {"spring.profiles.active=build"}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)`
@TestPropertySource(value = {"classpath:application-test.properties"})
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration

I have the annotations shown on my integration test. and the entity class is like below

@Container(containerName = "Statuses-${spring.profiles.active}")
public class MessageStatus implements Serializable

The container name is successfully created as Statuses-local in the local env and when running the spring boot app, but this is not able to resolve the EL on the cosmos DB container name when running tests. Instead, the container creates as Statuses-${spring.profile.active}.

Please help, I need this to run tests using the build profile and the container name correctly resolves the EL on it when running the SpringBoot app, BUT when running my integration tests, this is misbehaving. Anything I am missing?

UPDATE: I have

@SpringBootApplication
DependsOn("expressionResolver")

on the main application class

Furthermore, I have tried another alternative of getting the container name from a function in a bean, but this is again is trying to create the container name as the code to resolve the name...

@Container(containerName = "#{@MyBean.getMessageStatusContainerName()}")
public class MessageStatus implements Serializable

And this, again, works fine when running the SpringBoot App, but NOT when trying to run tests.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I had included the annotation

@ContextConfiguration(classes = {TestContextConfig.class, MyClass1.class, MyClass2.class})

On the Integration Test, whereas, I have @EnableAutoConfiguration already, and that setting was "not happy" on creating the Test Application Context such that some necessary beans would be missing, and the resolution of the EL was not working.

SOLUTION: Removed the annotation: @ContextConfiguration(classes = and all worked like fire!

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda