Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!