Skip to content

Commit

Permalink
format codes
Browse files Browse the repository at this point in the history
  • Loading branch information
dunwu committed Oct 11, 2019
1 parent 5b5c8f7 commit 59a762b
Show file tree
Hide file tree
Showing 357 changed files with 30,223 additions and 29,209 deletions.
508 changes: 255 additions & 253 deletions docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cat << EOF
# ----------------------------------------------------------------------------------
EOF
printf "${RESET}"

printf "${BLUE}>>>>>>>> begin.\n${RESET}"

cd ..
Expand Down
Binary file modified scripts/version.sh
Binary file not shown.
4 changes: 2 additions & 2 deletions settings/maven/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ under the License.
| values (values used when the setting is not specified) are provided.
|
|-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
Expand Down
2 changes: 1 addition & 1 deletion spring-examples/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand Down
5 changes: 3 additions & 2 deletions spring-examples/spring-examples-common/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project 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"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,40 @@
*/
public class BlockTag extends TagSupport {

private static final long serialVersionUID = 5981092740359798010L;
private static final String BLOCK = "__jsp_override__";

protected String name;

@Override
public int doStartTag() {
return getOverriedContent() == null ? EVAL_BODY_INCLUDE : SKIP_BODY;
}

@Override
public int doEndTag() throws JspException {
String overriedContent = getOverriedContent();
if (overriedContent == null) {
return EVAL_PAGE;
}

try {
pageContext.getOut().write(overriedContent);
} catch (IOException e) {
throw new JspException("try to override jsp content failed, block name:" + name, e);
}
return EVAL_PAGE;
}

public void setName(String name) {
this.name = name;
}

private String getOverriedContent() {
String newName = BLOCK + name;
return (String) pageContext.getRequest().getAttribute(newName);
}
private static final long serialVersionUID = 5981092740359798010L;

private static final String BLOCK = "__jsp_override__";

protected String name;

@Override
public int doStartTag() {
return getOverriedContent() == null ? EVAL_BODY_INCLUDE : SKIP_BODY;
}

@Override
public int doEndTag() throws JspException {
String overriedContent = getOverriedContent();
if (overriedContent == null) {
return EVAL_PAGE;
}

try {
pageContext.getOut().write(overriedContent);
}
catch (IOException e) {
throw new JspException("try to override jsp content failed, block name:" + name, e);
}
return EVAL_PAGE;
}

public void setName(String name) {
this.name = name;
}

private String getOverriedContent() {
String newName = BLOCK + name;
return (String) pageContext.getRequest().getAttribute(newName);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,36 @@
*/
public class OverrideTag extends BodyTagSupport {

private static final long serialVersionUID = 1692569211455126528L;
private static final String BLOCK = "__jsp_override__";

protected String name;

@Override
public int doStartTag() {
return isOverrided() ? SKIP_BODY : EVAL_BODY_BUFFERED;
}

@Override
public int doEndTag() {
if (isOverrided()) {
return EVAL_PAGE;
}
BodyContent b = getBodyContent();
String newName = BLOCK + name;

pageContext.getRequest().setAttribute(newName, b.getString());
return EVAL_PAGE;
}

public void setName(String name) {
this.name = name;
}

private boolean isOverrided() {
String newName = BLOCK + name;
return pageContext.getRequest().getAttribute(newName) != null;
}
private static final long serialVersionUID = 1692569211455126528L;

private static final String BLOCK = "__jsp_override__";

protected String name;

@Override
public int doStartTag() {
return isOverrided() ? SKIP_BODY : EVAL_BODY_BUFFERED;
}

@Override
public int doEndTag() {
if (isOverrided()) {
return EVAL_PAGE;
}
BodyContent b = getBodyContent();
String newName = BLOCK + name;

pageContext.getRequest().setAttribute(newName, b.getString());
return EVAL_PAGE;
}

public void setName(String name) {
this.name = name;
}

private boolean isOverrided() {
String newName = BLOCK + name;
return pageContext.getRequest().getAttribute(newName) != null;
}

}
5 changes: 3 additions & 2 deletions spring-examples/spring-examples-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project 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"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project 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"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
package io.github.dunwu.spring.core.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class Audience {

@Pointcut("execution(* io.github.dunwu.spring.core.aop.Instrumentalist.perform(..))")
public void performance() {}

@Before("performance()")
public void takeSeats() {
System.out.println("takeSeats()");
}

@Before("performance()")
public void turnOffCellPhones() {
System.out.println("turnOffCellPhones()");
}

@AfterReturning("performance()")
public void applaud() {
System.out.println("applaud()");
}

@AfterThrowing("performance()")
public void demandRefund() {
System.out.println("demandRefund()");
}
@Pointcut("execution(* io.github.dunwu.spring.core.aop.Instrumentalist.perform(..))")
public void performance() {
}

@Before("performance()")
public void takeSeats() {
System.out.println("takeSeats()");
}

@Before("performance()")
public void turnOffCellPhones() {
System.out.println("turnOffCellPhones()");
}

@AfterReturning("performance()")
public void applaud() {
System.out.println("applaud()");
}

@AfterThrowing("performance()")
public void demandRefund() {
System.out.println("demandRefund()");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
@Component
public class Instrumentalist implements Performer {

@Override
public String perform() {
String action = "play a song";
System.out.println(action);
return action;
}
@Override
public String perform() {
String action = "play a song";
System.out.println(action);
return action;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.dunwu.spring.core.aop;

public interface Performer {
String perform();

String perform();

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
@ContextConfiguration(locations = "classpath:spring-aop.xml")
public class SpringAopTest {

@Autowired
Performer performer;
@Autowired
Performer performer;

@Test
public void test() {
Assert.assertEquals("play a song", performer.perform());
}

@Test
public void test() {
Assert.assertEquals("play a song", performer.perform());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project 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"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

public class BeanLifeCycleDemo {

public static void main(String[] args) {
System.out.println("现在开始初始化容器");
public static void main(String[] args) {
System.out.println("现在开始初始化容器");

ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext("spring-beans.xml");
System.out.println("容器初始化成功");
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext("spring-beans.xml");
System.out.println("容器初始化成功");

Person person = factory.getBean("person", Person.class);
System.out.println(person);
Person person = factory.getBean("person", Person.class);
System.out.println(person);

System.out.println("现在开始关闭容器!");
factory.registerShutdownHook();
}

System.out.println("现在开始关闭容器!");
factory.registerShutdownHook();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@

public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

public MyBeanFactoryPostProcessor() {
super();
System.out.println("[BeanFactoryPostProcessor] construct");
}
public MyBeanFactoryPostProcessor() {
super();
System.out.println("[BeanFactoryPostProcessor] construct");
}

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
System.out.println("[BeanFactoryPostProcessor] BeanFactoryPostProcessor call postProcessBeanFactory");
BeanDefinition bd = beanFactory.getBeanDefinition("person");
bd.getPropertyValues().addPropertyValue("phone", "110");
}

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
System.out.println("[BeanFactoryPostProcessor] BeanFactoryPostProcessor call postProcessBeanFactory");
BeanDefinition bd = beanFactory.getBeanDefinition("person");
bd.getPropertyValues().addPropertyValue("phone", "110");
}
}
Loading

0 comments on commit 59a762b

Please sign in to comment.