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.
2、新增TypeFilter 3、删除无用的模块
- Loading branch information
xuchengsheng
committed
Nov 18, 2023
1 parent
2e02c2a
commit 90dadf8
Showing
14 changed files
with
102 additions
and
43 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
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
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
14 changes: 14 additions & 0 deletions
14
spring-beans/spring-bean-importBeanDefinitionRegistrar/pom.xml
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-beans</artifactId> | ||
<groupId>com.xcs.spring</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>spring-bean-importBeanDefinitionRegistrar</artifactId> | ||
|
||
</project> |
18 changes: 18 additions & 0 deletions
18
...anDefinitionRegistrar/src/main/java/com/xcs/spring/ImportBeanDefinitionRegistrarDemo.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.bean.MyBean; | ||
import com.xcs.spring.config.MyConfiguration; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年11月17日 14时48分 | ||
**/ | ||
public class ImportBeanDefinitionRegistrarDemo { | ||
|
||
public static void main(String[] args) { | ||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MyConfiguration.class); | ||
MyBean bean = context.getBean(MyBean.class); | ||
System.out.println("bean = " + bean); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...s/spring-bean-importBeanDefinitionRegistrar/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,8 @@ | ||
package com.xcs.spring.bean; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年11月17日 14时53分 | ||
**/ | ||
public class MyBean { | ||
} |
13 changes: 13 additions & 0 deletions
13
...an-importBeanDefinitionRegistrar/src/main/java/com/xcs/spring/config/MyConfiguration.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,13 @@ | ||
package com.xcs.spring.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年11月17日 14时52分 | ||
**/ | ||
@Configuration | ||
@Import(MyImportBeanDefinitionRegistrar.class) | ||
public class MyConfiguration { | ||
} |
23 changes: 23 additions & 0 deletions
23
...initionRegistrar/src/main/java/com/xcs/spring/config/MyImportBeanDefinitionRegistrar.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,23 @@ | ||
package com.xcs.spring.config; | ||
|
||
import com.xcs.spring.bean.MyBean; | ||
import org.springframework.beans.factory.support.BeanDefinitionBuilder; | ||
import org.springframework.beans.factory.support.BeanDefinitionRegistry; | ||
import org.springframework.beans.factory.support.GenericBeanDefinition; | ||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; | ||
import org.springframework.core.type.AnnotationMetadata; | ||
|
||
/** | ||
* @author xcs | ||
* @date 2023年11月17日 14时52分 | ||
**/ | ||
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar { | ||
|
||
@Override | ||
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { | ||
// 注册一个名为 "myBean" 的简单Bean | ||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(MyBean.class); | ||
GenericBeanDefinition definition = (GenericBeanDefinition) builder.getBeanDefinition(); | ||
registry.registerBeanDefinition("myBean", definition); | ||
} | ||
} |
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-condition</artifactId> | ||
|
||
</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
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
24 changes: 0 additions & 24 deletions
24
...ng-resource-propertiesPersister/src/main/java/com/xcs/spring/PropertiesPersisterDemo.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...ources/spring-resource-propertiesPersister/src/main/resources/bean-definitions.properties
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
spring-resources/spring-resource-propertiesPersister/src/main/resources/beans.xml
This file was deleted.
Oops, something went wrong.