forked from xuchengsheng/spring-reading
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuchengsheng
committed
Sep 15, 2023
0 parents
commit 9620307
Showing
63 changed files
with
1,053 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<packaging>pom</packaging> | ||
<groupId>com.xcs.spring</groupId> | ||
<artifactId>spring-reading</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>spring-reading</name> | ||
<description>spring-reading</description> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<java.version>11</java.version> | ||
<spring.version>5.3.10</spring.version> | ||
</properties> | ||
|
||
<modules> | ||
<module>spring-interface-beanFactoryPostProcessor</module> | ||
<module>spring-interface-beanPostProcessor</module> | ||
<module>spring-interface-environment</module> | ||
<module>spring-interface-applicationListener</module> | ||
<module>spring-interface-importSelector</module> | ||
<module>spring-interface-importBeanDefinitionRegistrar</module> | ||
<module>spring-interface-resource</module> | ||
<module>spring-interface-embeddedValueResolver</module> | ||
<module>spring-interface-factoryBean</module> | ||
<module>spring-annotation-configuration</module> | ||
<module>spring-annotation-bean</module> | ||
<module>spring-annotation-import</module> | ||
<module>spring-annotation-propertySource</module> | ||
<module>spring-annotation-componentScan</module> | ||
</modules> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-aspects</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-aop</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-tx</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-webmvc</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>spring-reading</artifactId> | ||
<groupId>com.xcs.spring</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>spring-annotation-bean</artifactId> | ||
|
||
</project> |
19 changes: 19 additions & 0 deletions
19
spring-annotation-bean/src/main/java/com/xcs/spring/BeanApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.xcs.spring; | ||
|
||
import com.xcs.spring.config.MyBeanConfig; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年08月07日 16时21分 | ||
**/ | ||
public class BeanApplication { | ||
|
||
public static void main(String[] args) { | ||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MyBeanConfig.class); | ||
for (String beanDefinitionName : context.getBeanDefinitionNames()) { | ||
System.out.println("beanName = " + beanDefinitionName); | ||
} | ||
context.close(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
spring-annotation-bean/src/main/java/com/xcs/spring/bean/A.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.xcs.spring.bean; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月23日 15时30分 | ||
**/ | ||
public class A { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
spring-annotation-bean/src/main/java/com/xcs/spring/bean/B.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.xcs.spring.bean; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月23日 15时30分 | ||
**/ | ||
public class B { | ||
|
||
private A a; | ||
|
||
public B(A a) { | ||
this.a = a; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
spring-annotation-bean/src/main/java/com/xcs/spring/bean/MyBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.xcs.spring.bean; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月25日 10时22分 | ||
**/ | ||
public class MyBean { | ||
|
||
private String name; | ||
|
||
public MyBean(String name) { | ||
this.name = name; | ||
} | ||
|
||
public void init(){ | ||
System.out.println("MyBean.init"); | ||
} | ||
|
||
public void destroy(){ | ||
System.out.println("MyBean.destroy"); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
spring-annotation-bean/src/main/java/com/xcs/spring/config/MyBeanConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.xcs.spring.config; | ||
|
||
import com.xcs.spring.bean.A; | ||
import com.xcs.spring.bean.B; | ||
import com.xcs.spring.bean.MyBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年08月07日 16时25分 | ||
**/ | ||
@Configuration | ||
public class MyBeanConfig { | ||
|
||
@Bean | ||
public A a(){ | ||
return new A(); | ||
} | ||
|
||
@Bean | ||
public B b(){ | ||
return new B(a()); | ||
} | ||
|
||
@Bean(initMethod = "init",destroyMethod = "destroy") | ||
public MyBean myBean(){ | ||
return new MyBean("xcs"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
spring-annotation-bean/src/main/java/com/xcs/spring/service/MyService1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.xcs.spring.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月14日 17时14分 | ||
**/ | ||
@Service | ||
public class MyService1 { | ||
} |
12 changes: 12 additions & 0 deletions
12
spring-annotation-bean/src/main/java/com/xcs/spring/service/MyService2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.xcs.spring.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月14日 17时14分 | ||
**/ | ||
@Service | ||
public class MyService2 { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>spring-reading</artifactId> | ||
<groupId>com.xcs.spring</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>spring-annotation-componentScan</artifactId> | ||
|
||
</project> |
18 changes: 18 additions & 0 deletions
18
spring-annotation-componentScan/src/main/java/com/xcs/spring/ComponentScanApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.xcs.spring; | ||
|
||
import com.xcs.spring.config.MyComponentScanConfig; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年08月07日 16时21分 | ||
**/ | ||
public class ComponentScanApplication { | ||
|
||
public static void main(String[] args) { | ||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MyComponentScanConfig.class); | ||
for (String beanDefinitionName : context.getBeanDefinitionNames()) { | ||
System.out.println("beanName = " + beanDefinitionName); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
spring-annotation-componentScan/src/main/java/com/xcs/spring/MyPackageMarker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.xcs.spring; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月14日 15时06分 | ||
**/ | ||
public class MyPackageMarker { | ||
} |
12 changes: 12 additions & 0 deletions
12
spring-annotation-componentScan/src/main/java/com/xcs/spring/component/MyAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.xcs.spring.component; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import java.lang.annotation.*; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@Component | ||
public @interface MyAnnotation { | ||
} |
12 changes: 12 additions & 0 deletions
12
spring-annotation-componentScan/src/main/java/com/xcs/spring/component/MyComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.xcs.spring.component; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月15日 14时13分 | ||
**/ | ||
@Component | ||
public class MyComponent implements MyInterface { | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...nnotation-componentScan/src/main/java/com/xcs/spring/component/MyComponentAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.xcs.spring.component; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月16日 15时46分 | ||
**/ | ||
@MyAnnotation | ||
public class MyComponentAnnotation { | ||
} |
12 changes: 12 additions & 0 deletions
12
...g-annotation-componentScan/src/main/java/com/xcs/spring/component/MyComponentAspectJ.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.xcs.spring.component; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月15日 15时04分 | ||
**/ | ||
@Component | ||
public class MyComponentAspectJ { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...ng-annotation-componentScan/src/main/java/com/xcs/spring/component/MyComponentCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.xcs.spring.component; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月15日 14时15分 | ||
**/ | ||
@Component | ||
public class MyComponentCustom { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
spring-annotation-componentScan/src/main/java/com/xcs/spring/component/MyComponentRegex.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.xcs.spring.component; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月15日 14时59分 | ||
**/ | ||
@Component | ||
public class MyComponentRegex { | ||
} |
8 changes: 8 additions & 0 deletions
8
spring-annotation-componentScan/src/main/java/com/xcs/spring/component/MyInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.xcs.spring.component; | ||
|
||
/** | ||
* @author 林雷 | ||
* @date 2023年08月15日 14时12分 | ||
**/ | ||
public interface MyInterface { | ||
} |
Oops, something went wrong.