Skip to content

Commit

Permalink
springframeworkguru#9: Spring web config with XML
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel Van Huyck committed Sep 20, 2022
1 parent dc0b2cd commit 7894543
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.springframework.samples.petclinic.web;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.service.ClinicService;
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;

@SpringJUnitWebConfig(locations = {"classpath:spring/mvc-test-config.xml", "classpath:spring/mvc-core-config.xml"})
class OwnerControllerTest {

@Autowired
OwnerController ownerController;

//autowired fromù XML bean mvc-test-config.xml
@Autowired
ClinicService clinicService;


@Test
void tempTest() {

//ownerController
}
}
12 changes: 12 additions & 0 deletions src/test/resources/spring/mvc-test-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">


<bean class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.springframework.samples.petclinic.service.ClinicService"/>
</bean>

</beans>

0 comments on commit 7894543

Please sign in to comment.