forked from seaswalker/spring-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentConfig.java
More file actions
31 lines (27 loc) · 795 Bytes
/
Copy pathStudentConfig.java
File metadata and controls
31 lines (27 loc) · 795 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
package java_config;
import base.Student;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportAware;
import org.springframework.context.annotation.Scope;
import org.springframework.core.type.AnnotationMetadata;
/**
* {@link base.Student}配置
*
* @author skywalker
*/
@Configuration
public class StudentConfig implements ImportAware {
@Bean
@Scope("prototype")
public Student student() {
Student student = new Student();
student.setAge(22);
student.setName("skywalker");
return student;
}
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
System.out.println("importaware");
}
}