Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
xuchengsheng committed Sep 15, 2023
0 parents commit 9620307
Show file tree
Hide file tree
Showing 63 changed files with 1,053 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .gitignore
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/
65 changes: 65 additions & 0 deletions pom.xml
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>
14 changes: 14 additions & 0 deletions spring-annotation-bean/pom.xml
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>
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();
}
}
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 spring-annotation-bean/src/main/java/com/xcs/spring/bean/B.java
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;
}
}
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");
}
}
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");
}
}
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 {
}
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 {

}
15 changes: 15 additions & 0 deletions spring-annotation-componentScan/pom.xml
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>
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);
}
}
}
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 {
}
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 {
}
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 {

}
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 {
}
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 {

}
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 {

}
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 {
}
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 {
}
Loading

0 comments on commit 9620307

Please sign in to comment.