forked from coderbruis/JavaSourceCodeLearning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpringBeanTest.java
More file actions
33 lines (27 loc) · 877 Bytes
/
SpringBeanTest.java
File metadata and controls
33 lines (27 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.bruis.learnsb.bean;
import com.bruis.learnsb.initializer.service.TestService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author LuoHaiYang
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringBeanTest {
@Autowired
private Person person;
@Autowired
private TestService testService;
@Test
public void testInitializer() {
System.out.println("Initializer: " + testService.test());
}
@Test
public void test() {
System.out.println(person.getName() + "'s age = " + person.getAge() + ", and phonto = " + person.getPhone());
}
}