Skip to content

Failed to parse configuration class, nested exception is Could not open resource [/]

I´m trying to configurate new properties for the test, so I created a test config class:

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.scheduling.annotation.EnableAsync;

public class TestConfig {


Properties file is in src/test/resources/

and in the test class :

@ContextConfiguration(classes = TestConfig.class)
public class InsumoServiceTest {

when I execute the tests the error is: Failed to parse configuration class []; nested exception is Could not open ServletContext resource [/]



It seems that the requested properties can’t be found. I would recommend doing this: is that resolve your problem :