Bonjour j'ai un problème de configuration spring.
voila
mon fichier app-context.xml se trouve dans src/main/resources/META-NF/spring
le code de mon XML est :
et dans mes dossiers test/java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <description>Example configuration to get you started.</description> <bean name="service" class="service.ExampleService"></bean> </beans> <context:component-scan base-package="service" />
nous avons : code ExampleConfiguationTest.java
et mes services se trouve dans le main/java/service (cest une interface service avec une methode.)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) public class ExampleConfigurationTests { @Autowired private Service service; @Test public void testSimpleProperties() throws Exception { assertNotNull(service); } }
quand je lance avec maven il lance pas les tests c'est bizarre.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 public class ExampleService implements Service { /** * Reads next record from input */ public String getMessage() { return "Hello world!"; } }
en gros 0 test in run
quand je lance avec JUNIT click droit la classe ExampleConfigurationTest
il me dis qu'il ne trouve pas le ApplicationContext.xml
voila
Partager