├── .idea
└── misc.xml
├── aop-annotation
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── aop
│ │ │ ├── MyFirstAspect.java
│ │ │ ├── business
│ │ │ │ ├── domain
│ │ │ │ │ └── Product.java
│ │ │ │ └── service
│ │ │ │ │ ├── ProductDao.java
│ │ │ │ │ ├── ProductService.java
│ │ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ │ └── ProductDaoImpl.java
│ │ │ └── config
│ │ │ └── applicationContext.xml
│ └── resources
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── aop-config
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── aop
│ │ │ ├── MyFirstAspect.java
│ │ │ ├── business
│ │ │ │ ├── domain
│ │ │ │ │ └── Product.java
│ │ │ │ └── service
│ │ │ │ │ ├── ProductDao.java
│ │ │ │ │ ├── ProductService.java
│ │ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ │ └── ProductDaoImpl.java
│ │ │ └── config
│ │ │ └── applicationContext.xml
│ └── resources
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── aop-javaconfig
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── aop
│ │ │ ├── MyFirstAspect.java
│ │ │ ├── business
│ │ │ │ ├── domain
│ │ │ │ │ └── Product.java
│ │ │ │ └── service
│ │ │ │ │ ├── ProductDao.java
│ │ │ │ │ ├── ProductService.java
│ │ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ │ └── ProductDaoImpl.java
│ │ │ └── config
│ │ │ └── AppConfig.java
│ └── resources
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── batch-advanced
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── com.springsource.sts.config.flow.prefs
│ └── org.eclipse.jdt.core.prefs
├── .springBeans
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ └── business
│ │ │ └── domain
│ │ │ ├── Member.java
│ │ │ └── Product.java
│ └── resources
│ │ ├── META-INF
│ │ ├── jdbc.properties
│ │ ├── schema-init-hsqldb.sql
│ │ └── spring
│ │ │ ├── item-context.xml
│ │ │ └── job-context.xml
│ │ ├── batch-context.xml
│ │ ├── log4j.properties
│ │ └── product_csv
│ │ └── 1.csv
│ ├── site
│ └── site.xml
│ └── test
│ ├── java
│ ├── .gitignore
│ └── sample.sql
│ └── resources
│ ├── .gitignore
│ └── sample.sql
├── batch-basic
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── com.springsource.sts.config.flow.prefs
│ └── org.eclipse.jdt.core.prefs
├── .springBeans
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── batch
│ │ │ └── listener
│ │ │ │ ├── SampleChunkListener.java
│ │ │ │ └── SampleStepExecutionListener.java
│ │ │ └── business
│ │ │ └── domain
│ │ │ └── Product.java
│ └── resources
│ │ ├── META-INF
│ │ ├── jdbc.properties
│ │ ├── schema-init-hsqldb.sql
│ │ └── spring
│ │ │ ├── item-context.xml
│ │ │ └── job-context.xml
│ │ ├── batch-context.xml
│ │ ├── log4j.properties
│ │ └── product_csv
│ │ └── 1.csv
│ ├── site
│ └── site.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ ├── .gitignore
│ └── sample.sql
├── batch-entry
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── com.springsource.sts.config.flow.prefs
│ └── org.eclipse.jdt.core.prefs
├── .springBeans
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ └── batch
│ │ │ ├── exception
│ │ │ └── BatchSkipException.java
│ │ │ └── step
│ │ │ ├── EntryItemProcessor.java
│ │ │ ├── EntryItemReader.java
│ │ │ └── EntryItemWriter.java
│ └── resources
│ │ ├── META-INF
│ │ ├── jdbc.properties
│ │ ├── schema-init-hsqldb.sql
│ │ └── spring
│ │ │ └── job-context.xml
│ │ ├── batch-context.xml
│ │ └── log4j.properties
│ ├── site
│ └── site.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── cache
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── config
│ │ │ └── applicationContext.xml
│ │ │ └── di
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ └── Product.java
│ │ │ └── service
│ │ │ │ ├── ProductDao.java
│ │ │ │ ├── ProductService.java
│ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ └── ProductDaoImpl.java
│ └── resources
│ │ ├── log4j.dtd
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── di-annotation
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── config
│ │ │ └── applicationContext.xml
│ │ │ └── di
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ └── Product.java
│ │ │ └── service
│ │ │ │ ├── ProductDao.java
│ │ │ │ ├── ProductService.java
│ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ └── ProductDaoImpl.java
│ └── resources
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── di-config
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── config
│ │ │ └── applicationContext.xml
│ │ │ └── di
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ └── Product.java
│ │ │ └── service
│ │ │ │ ├── ProductDao.java
│ │ │ │ ├── ProductService.java
│ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ └── ProductDaoImpl.java
│ └── resources
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── di-javaconfig
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ProductSampleRun.java
│ │ │ ├── config
│ │ │ └── AppConfig.java
│ │ │ └── di
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ └── Product.java
│ │ │ └── service
│ │ │ │ ├── ProductDao.java
│ │ │ │ ├── ProductService.java
│ │ │ │ └── ProductServiceImpl.java
│ │ │ └── dataaccess
│ │ │ └── ProductDaoImpl.java
│ └── resources
│ │ └── log4j.xml
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── hibernate
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe.txt
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── Main.java
│ │ │ ├── config
│ │ │ ├── DataSourceConfig.java
│ │ │ ├── HibernateConfig.java
│ │ │ └── spring-hibernate.xml
│ │ │ └── hibernate
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ └── Pet.java
│ │ │ └── service
│ │ │ │ └── PetDao.java
│ │ │ └── dataaccess
│ │ │ ├── HibernatePetDao.java
│ │ │ └── Pet.hbm.xml
│ └── resources
│ │ ├── db.properties
│ │ ├── log4j.properties
│ │ └── script
│ │ ├── data.sql
│ │ └── table.sql
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── jpa
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe.txt
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── JndiMain.java
│ │ │ ├── Main.java
│ │ │ ├── config
│ │ │ ├── DataSourceConfig.java
│ │ │ ├── JpaConfig.java
│ │ │ ├── JpaJndiConfig.java
│ │ │ ├── spring-jpa-jndi.xml
│ │ │ └── spring-jpa.xml
│ │ │ └── jpa
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ ├── Owner.java
│ │ │ │ └── Pet.java
│ │ │ └── service
│ │ │ │ └── PetDao.java
│ │ │ └── dataaccess
│ │ │ └── JpaPetDao.java
│ └── resources
│ │ ├── db.properties
│ │ ├── log4j.properties
│ │ └── script
│ │ ├── data.sql
│ │ └── table.sql
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── mvc
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── .jsdtscope
│ ├── org.eclipse.jdt.core.prefs
│ ├── org.eclipse.m2e.core.prefs
│ ├── org.eclipse.wst.common.component
│ ├── org.eclipse.wst.common.project.facet.core.xml
│ ├── org.eclipse.wst.jsdt.ui.superType.container
│ ├── org.eclipse.wst.jsdt.ui.superType.name
│ └── org.eclipse.wst.validation.prefs
├── .springBeans
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ └── customer
│ │ │ ├── biz
│ │ │ ├── domain
│ │ │ │ └── Customer.java
│ │ │ └── service
│ │ │ │ ├── CustomerService.java
│ │ │ │ ├── DataNotFoundException.java
│ │ │ │ └── MockCustomerService.java
│ │ │ ├── config
│ │ │ ├── BizConfig.java
│ │ │ └── WebConfig.java
│ │ │ └── web
│ │ │ └── controller
│ │ │ ├── CustomerControllerAdvice.java
│ │ │ ├── CustomerEditController.java
│ │ │ ├── CustomerListController.java
│ │ │ └── CustomerRestController.java
│ ├── resources
│ │ ├── META-INF
│ │ │ ├── messages.properties
│ │ │ └── spring
│ │ │ │ ├── beans-biz.xml
│ │ │ │ └── beans-webmvc.xml
│ │ ├── log4j.dtd
│ │ └── log4j.xml
│ └── webapp
│ │ └── WEB-INF
│ │ ├── views
│ │ ├── customer
│ │ │ ├── detail.jsp
│ │ │ ├── edit
│ │ │ │ ├── edited.jsp
│ │ │ │ ├── enter.jsp
│ │ │ │ └── review.jsp
│ │ │ ├── list.jsp
│ │ │ └── notfound.jsp
│ │ └── error.jsp
│ │ └── web.xml
│ └── test
│ └── java
│ └── sample
│ └── customer
│ └── biz
│ └── domain
│ ├── FindCustomerByIdMain.java
│ └── RegisterCustomerMain.java
├── mybatis
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe.txt
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── Main.java
│ │ │ ├── MainForMapper.java
│ │ │ ├── config
│ │ │ ├── DataSourceConfig.java
│ │ │ ├── MyBatisConfig.java
│ │ │ ├── MyBatisConfigForMapper.java
│ │ │ ├── mybatis-config.xml
│ │ │ ├── spring-mybatis-mapper.xml
│ │ │ └── spring-mybatis.xml
│ │ │ └── mybatis
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ └── Pet.java
│ │ │ └── service
│ │ │ │ └── PetDao.java
│ │ │ └── dataaccess
│ │ │ ├── MyBatisPetDao.java
│ │ │ └── pet.xml
│ └── resources
│ │ ├── db.properties
│ │ ├── log4j.properties
│ │ └── script
│ │ ├── data.sql
│ │ └── table.sql
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── security
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── .jsdtscope
│ ├── org.eclipse.jdt.core.prefs
│ ├── org.eclipse.m2e.core.prefs
│ ├── org.eclipse.wst.common.component
│ ├── org.eclipse.wst.common.project.facet.core.xml
│ ├── org.eclipse.wst.jsdt.ui.superType.container
│ ├── org.eclipse.wst.jsdt.ui.superType.name
│ └── org.eclipse.wst.validation.prefs
├── .springBeans
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── sample
│ │ └── security
│ │ ├── authentication
│ │ ├── SampleJdbcDaoImpl.java
│ │ └── SampleUser.java
│ │ └── config
│ │ ├── DataAccessMockConfig.java
│ │ ├── SecurityConfigInMemory.java
│ │ └── SecurityConfigJdbc.java
│ ├── resources
│ ├── META-INF
│ │ ├── db
│ │ │ ├── ddl.sql
│ │ │ └── dml.sql
│ │ └── spring
│ │ │ ├── beans-dataaccess-mock.xml
│ │ │ ├── beans-security-in-memory.xml
│ │ │ └── beans-security-jdbc.xml
│ ├── log4j.dtd
│ └── log4j.xml
│ └── webapp
│ ├── WEB-INF
│ └── web.xml
│ ├── accessDenied.jsp
│ ├── admin
│ └── admin.jsp
│ ├── login.jsp
│ ├── top.jsp
│ └── user
│ └── user.jsp
├── springdatajpa
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe.txt
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── Main.java
│ │ │ ├── config
│ │ │ ├── AppConfig.java
│ │ │ ├── DataSourceConfig.java
│ │ │ ├── JpaConfig.java
│ │ │ └── spring-jpa.xml
│ │ │ └── springdatajpa
│ │ │ ├── business
│ │ │ ├── domain
│ │ │ │ ├── Owner.java
│ │ │ │ └── Pet.java
│ │ │ └── service
│ │ │ │ ├── PetDao.java
│ │ │ │ └── PetDaoCustom.java
│ │ │ └── dataaccess
│ │ │ └── PetDaoImpl.java
│ └── resources
│ │ ├── db.properties
│ │ ├── log4j.properties
│ │ └── script
│ │ ├── data.sql
│ │ └── table.sql
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
├── springjdbc
├── .classpath
├── .gitignore
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── ReadMe.txt
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── sample
│ │ │ ├── ExecuteSqlMain.java
│ │ │ ├── JndiMain.java
│ │ │ ├── config
│ │ │ ├── DataSourceConfig.java
│ │ │ ├── JndiConfig.java
│ │ │ ├── TemplateConfig.java
│ │ │ ├── spring-db.xml
│ │ │ └── spring-jndi.xml
│ │ │ └── springjdbc
│ │ │ └── business
│ │ │ └── domain
│ │ │ ├── Owner.java
│ │ │ └── Pet.java
│ └── resources
│ │ ├── jdbc.properties
│ │ ├── jndi.properties
│ │ ├── log4j.properties
│ │ └── script
│ │ ├── data.sql
│ │ ├── proc.sql
│ │ └── table.sql
│ └── test
│ ├── java
│ └── .gitignore
│ └── resources
│ └── .gitignore
└── transaction
├── .classpath
├── .gitignore
├── .project
├── .settings
├── org.eclipse.jdt.core.prefs
└── org.eclipse.m2e.core.prefs
├── ReadMe.txt
├── pom.xml
└── src
├── main
├── java
│ └── sample
│ │ ├── TranByAnnotationMain.java
│ │ ├── TranByFileMain.java
│ │ ├── TranByJavaConfigMain.java
│ │ ├── TranByProgrammaticMain.java
│ │ ├── biz
│ │ ├── dao
│ │ │ └── PetDao.java
│ │ ├── domain
│ │ │ ├── Owner.java
│ │ │ └── Pet.java
│ │ ├── exception
│ │ │ └── BussinessException.java
│ │ └── service
│ │ │ ├── PetService.java
│ │ │ └── impl
│ │ │ └── PetServiceImpl.java
│ │ ├── config
│ │ ├── TransactionConfig.java
│ │ ├── spring-tranByAnnotation.xml
│ │ ├── spring-tranByFile.xml
│ │ └── spring-tranByProgrammatic.xml
│ │ └── dao
│ │ └── PetDaoSpringJdbc.java
└── resources
│ ├── log4j.properties
│ └── script
│ ├── data.sql
│ └── table.sql
└── test
├── java
└── .gitignore
└── resources
└── .gitignore
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aop-annotation/.classpath:
--------------------------------------------------------------------------------
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 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/aop-annotation/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/aop-annotation/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | aop-annotation
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.springframework.ide.eclipse.core.springbuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.ide.eclipse.core.springnature
26 | org.eclipse.jdt.core.javanature
27 | org.eclipse.m2e.core.maven2Nature
28 |
29 |
30 |
--------------------------------------------------------------------------------
/aop-annotation/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/aop-annotation/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/aop-annotation/ReadMe:
--------------------------------------------------------------------------------
1 | ***예제 실행 방법***
2 | 1.「src/main/java」폴더안의 「sample」패키지의 「ProductSampleRun.java」를 선택
3 | 2.마우스 오른쪽 클릭해서「Run As > Java Application」로 실행
4 | 3.결과를 콘솔에서 확인
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/ProductSampleRun.java:
--------------------------------------------------------------------------------
1 | package sample;
2 |
3 | import org.springframework.beans.factory.BeanFactory;
4 | import org.springframework.context.support.ClassPathXmlApplicationContext;
5 |
6 | import sample.aop.business.domain.Product;
7 | import sample.aop.business.service.ProductService;
8 |
9 | public class ProductSampleRun {
10 |
11 | public static void main(String[] args) {
12 | ProductSampleRun productSampleRun = new ProductSampleRun();
13 | productSampleRun.execute();
14 | }
15 |
16 | @SuppressWarnings("resource")
17 | public void execute() {
18 | // BeanFactory는 ApplicationContext에 적어도 괜찮습니다.
19 | BeanFactory ctx = new ClassPathXmlApplicationContext("/sample/config/applicationContext.xml");
20 | ProductService productService = ctx.getBean(ProductService.class);
21 |
22 | productService.addProduct(new Product("공책", 100));
23 |
24 | Product product = productService.findByProductName("공책");
25 | System.out.println(product);
26 | }
27 | }
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/aop/business/domain/Product.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.domain;
2 |
3 | public class Product {
4 | private String name;
5 | private int price;
6 |
7 | public Product(String name, int price) {
8 | this.name = name;
9 | this.price = price;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public int getPrice() {
17 | return price;
18 | }
19 |
20 | @Override
21 | public String toString() {
22 | return "Product [name=" + name + ", price=" + price + "]";
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/aop/business/service/ProductDao.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import sample.aop.business.domain.Product;
4 |
5 | public interface ProductDao {
6 | void addProduct(Product product);
7 |
8 | Product findProduct(String name);
9 | }
10 |
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/aop/business/service/ProductService.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import sample.aop.business.domain.Product;
4 |
5 | public interface ProductService {
6 | void addProduct(Product product);
7 | Product findByProductName(String name);
8 | }
9 |
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/aop/business/service/ProductServiceImpl.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Component;
5 |
6 | import sample.aop.business.domain.Product;
7 |
8 | @Component
9 | public class ProductServiceImpl implements ProductService {
10 | @Autowired
11 | private ProductDao productDao;
12 |
13 | public void addProduct(Product product) {
14 | productDao.addProduct(product);
15 | }
16 |
17 | public Product findByProductName(String name) {
18 | return productDao.findProduct(name);
19 | }
20 | }
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/aop/dataaccess/ProductDaoImpl.java:
--------------------------------------------------------------------------------
1 | package sample.aop.dataaccess;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.springframework.stereotype.Component;
7 |
8 | import sample.aop.business.domain.Product;
9 | import sample.aop.business.service.ProductDao;
10 |
11 | @Component
12 | public class ProductDaoImpl implements ProductDao {
13 | // Dao만으로 간단하게 구현하게 위해서 RDB에 접속은 하지 않습니다.
14 | // Map은 RDB대신으로 사용
15 | private Map storage = new HashMap();
16 |
17 | public Product findProduct(String name) {
18 | return storage.get(name);
19 | }
20 |
21 | public void addProduct(Product product) {
22 | storage.put(product.getName(), product);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/aop-annotation/src/main/java/sample/config/applicationContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/aop-annotation/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/aop-annotation/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/aop-annotation/src/test/java/.gitignore
--------------------------------------------------------------------------------
/aop-annotation/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/aop-annotation/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/aop-config/.classpath:
--------------------------------------------------------------------------------
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 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/aop-config/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/aop-config/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | aop-config
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.springframework.ide.eclipse.core.springbuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.ide.eclipse.core.springnature
26 | org.eclipse.jdt.core.javanature
27 | org.eclipse.m2e.core.maven2Nature
28 |
29 |
30 |
--------------------------------------------------------------------------------
/aop-config/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/aop-config/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/aop-config/ReadMe:
--------------------------------------------------------------------------------
1 | ***예제 실행 방법***
2 | 1.「src/main/java」폴더안의 「sample」패키지의「ProductSampleRun.java」를 선택
3 | 2.마우스 오른쪽 클릭해서「Run As > Java Application」로 실행
4 | 3.결과를 콘솔에서 확인
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/ProductSampleRun.java:
--------------------------------------------------------------------------------
1 | package sample;
2 |
3 | import org.springframework.beans.factory.BeanFactory;
4 | import org.springframework.context.support.ClassPathXmlApplicationContext;
5 |
6 | import sample.aop.business.domain.Product;
7 | import sample.aop.business.service.ProductService;
8 |
9 | public class ProductSampleRun {
10 |
11 | public static void main(String[] args) {
12 | ProductSampleRun productSampleRun = new ProductSampleRun();
13 | productSampleRun.execute();
14 | }
15 |
16 | @SuppressWarnings("resource")
17 | public void execute() {
18 | BeanFactory ctx = new ClassPathXmlApplicationContext("/sample/config/applicationContext.xml");
19 | ProductService productService = ctx.getBean(ProductService.class);
20 |
21 | productService.addProduct(new Product("공책", 100));
22 |
23 | Product product = productService.findByProductName("공책");
24 | System.out.println(product);
25 | }
26 | }
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/aop/business/domain/Product.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.domain;
2 |
3 | public class Product {
4 | private String name;
5 | private int price;
6 |
7 | public Product(String name, int price) {
8 | this.name = name;
9 | this.price = price;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public int getPrice() {
17 | return price;
18 | }
19 |
20 | @Override
21 | public String toString() {
22 | return "Product [name=" + name + ", price=" + price + "]";
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/aop/business/service/ProductDao.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import sample.aop.business.domain.Product;
4 |
5 | public interface ProductDao {
6 | void addProduct(Product product);
7 |
8 | Product findProduct(String name);
9 | }
10 |
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/aop/business/service/ProductService.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import sample.aop.business.domain.Product;
4 |
5 | public interface ProductService {
6 | void addProduct(Product product);
7 | Product findByProductName(String name);
8 | }
9 |
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/aop/business/service/ProductServiceImpl.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Component;
5 |
6 | import sample.aop.business.domain.Product;
7 |
8 | @Component
9 | public class ProductServiceImpl implements ProductService {
10 | @Autowired
11 | private ProductDao productDao;
12 |
13 | public void addProduct(Product product) {
14 | productDao.addProduct(product);
15 | }
16 |
17 | public Product findByProductName(String name) {
18 | return productDao.findProduct(name);
19 | }
20 | }
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/aop/dataaccess/ProductDaoImpl.java:
--------------------------------------------------------------------------------
1 | package sample.aop.dataaccess;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.springframework.stereotype.Component;
7 |
8 | import sample.aop.business.domain.Product;
9 | import sample.aop.business.service.ProductDao;
10 |
11 | @Component
12 | public class ProductDaoImpl implements ProductDao {
13 | // Dao만으로 간단하게 구현하게 위해서 RDB에 접속은 하지 않습니다.
14 | // Map은 RDB대신으로 사용
15 | private Map storage = new HashMap();
16 |
17 | public Product findProduct(String name) {
18 | return storage.get(name);
19 | }
20 |
21 | public void addProduct(Product product) {
22 | storage.put(product.getName(), product);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/aop-config/src/main/java/sample/config/applicationContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/aop-config/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/aop-config/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/aop-config/src/test/java/.gitignore
--------------------------------------------------------------------------------
/aop-config/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/aop-config/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/aop-javaconfig/.classpath:
--------------------------------------------------------------------------------
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 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/aop-javaconfig/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/aop-javaconfig/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | aop-javaconfig
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.springframework.ide.eclipse.core.springbuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.ide.eclipse.core.springnature
26 | org.eclipse.jdt.core.javanature
27 | org.eclipse.m2e.core.maven2Nature
28 |
29 |
30 |
--------------------------------------------------------------------------------
/aop-javaconfig/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.8
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.source=1.8
14 |
--------------------------------------------------------------------------------
/aop-javaconfig/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/aop-javaconfig/ReadMe:
--------------------------------------------------------------------------------
1 | ***예제 실행 방법***
2 | 1.「src/main/java」폴더안의 「sample」패키지의「ProductSampleRun.java」를 선택
3 | 2.마우스 오른쪽 클릭해서「Run As > Java Application」로 실행
4 | 3.결과를 콘솔에서 확인
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/ProductSampleRun.java:
--------------------------------------------------------------------------------
1 | package sample;
2 |
3 | import org.springframework.beans.factory.BeanFactory;
4 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
5 |
6 | import sample.aop.business.domain.Product;
7 | import sample.aop.business.service.ProductService;
8 | import sample.config.AppConfig;
9 |
10 | public class ProductSampleRun {
11 |
12 | public static void main(String[] args) {
13 | ProductSampleRun productSampleRun = new ProductSampleRun();
14 | productSampleRun.execute();
15 | }
16 |
17 | @SuppressWarnings("resource")
18 | public void execute() {
19 | BeanFactory ctx = new AnnotationConfigApplicationContext(AppConfig.class);
20 |
21 | ProductService productService = ctx.getBean(ProductService.class);
22 |
23 | productService.addProduct(new Product("공책", 100));
24 |
25 | Product product = productService.findByProductName("공책");
26 | System.out.println(product);
27 | }
28 | }
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/aop/business/domain/Product.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.domain;
2 |
3 | public class Product {
4 | private String name;
5 | private int price;
6 |
7 | public Product(String name, int price) {
8 | this.name = name;
9 | this.price = price;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public int getPrice() {
17 | return price;
18 | }
19 |
20 | @Override
21 | public String toString() {
22 | return "Product [name=" + name + ", price=" + price + "]";
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/aop/business/service/ProductDao.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import sample.aop.business.domain.Product;
4 |
5 | public interface ProductDao {
6 | void addProduct(Product product);
7 |
8 | Product findProduct(String name);
9 | }
10 |
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/aop/business/service/ProductService.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import sample.aop.business.domain.Product;
4 |
5 | public interface ProductService {
6 | void addProduct(Product product);
7 | Product findByProductName(String name);
8 | }
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/aop/business/service/ProductServiceImpl.java:
--------------------------------------------------------------------------------
1 | package sample.aop.business.service;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 |
5 | import sample.aop.business.domain.Product;
6 |
7 | public class ProductServiceImpl implements ProductService {
8 | @Autowired
9 | private ProductDao productDao;
10 |
11 | public void addProduct(Product product) {
12 | productDao.addProduct(product);
13 | }
14 |
15 | public Product findByProductName(String name) {
16 | return productDao.findProduct(name);
17 | }
18 | }
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/aop/dataaccess/ProductDaoImpl.java:
--------------------------------------------------------------------------------
1 | package sample.aop.dataaccess;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import sample.aop.business.domain.Product;
7 | import sample.aop.business.service.ProductDao;
8 |
9 | public class ProductDaoImpl implements ProductDao {
10 | // Dao만으로 간단하게 구현하게 위해서 RDB에 접속은 하지 않습니다.
11 | // Map은 RDB대신으로 사용
12 | private Map storage = new HashMap();
13 |
14 | public Product findProduct(String name) {
15 | return storage.get(name);
16 | }
17 |
18 | public void addProduct(Product product) {
19 | storage.put(product.getName(), product);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/java/sample/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package sample.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
6 |
7 | import sample.aop.MyFirstAspect;
8 | import sample.aop.business.service.ProductServiceImpl;
9 | import sample.aop.dataaccess.ProductDaoImpl;
10 |
11 | @Configuration
12 | @EnableAspectJAutoProxy
13 | public class AppConfig {
14 | @Bean
15 | public ProductServiceImpl productService() {
16 | return new ProductServiceImpl();
17 | }
18 |
19 | @Bean
20 | public ProductDaoImpl productDao() {
21 | return new ProductDaoImpl();
22 | }
23 |
24 | @Bean
25 | public MyFirstAspect myFirstAspect() {
26 | return new MyFirstAspect();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/aop-javaconfig/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/aop-javaconfig/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/aop-javaconfig/src/test/java/.gitignore
--------------------------------------------------------------------------------
/aop-javaconfig/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/aop-javaconfig/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/batch-advanced/.classpath:
--------------------------------------------------------------------------------
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 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/batch-advanced/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/batch-advanced/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | batch-advanced
4 | This plugin is an archetype that creates a command line batch sample from Spring Batch. Once installed you can create the archetype project using<br/><pre>$ mvn archetype:create -DgroupId=com.first -DartifactId=batch \ -DarchetypeGroupId=org.springframework.batch \ -DarchetypeArtifactId=spring-batch-cli -DarchetypeVersion=1.0-m3-SNAPSHOT</pre><br/> Then you should be able to "cd batch; mvn package exec:exec", and see the app run.
5 |
6 |
7 |
8 |
9 |
10 | org.eclipse.jdt.core.javabuilder
11 |
12 |
13 |
14 |
15 | org.springframework.ide.eclipse.core.springbuilder
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Builder
21 |
22 |
23 |
24 |
25 |
26 | org.springframework.ide.eclipse.core.springnature
27 | org.eclipse.jdt.core.javanature
28 | org.eclipse.m2e.core.maven2Nature
29 |
30 |
31 |
--------------------------------------------------------------------------------
/batch-advanced/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 | org.eclipse.jdt.core.compiler.compliance=1.5
4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 | org.eclipse.jdt.core.compiler.source=1.5
6 |
--------------------------------------------------------------------------------
/batch-advanced/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 | src/main/resources/batch-context.xml
11 | src/main/resources/META-INF/spring/job-context.xml
12 | src/main/resources/META-INF/spring/item-context.xml
13 |
14 |
15 |
16 |
17 |
18 |
19 | true
20 | false
21 |
22 | src/main/resources/batch-context.xml
23 | src/main/resources/META-INF/spring/job-context.xml
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/batch-advanced/ReadMe:
--------------------------------------------------------------------------------
1 | ***예제의 실행 방법***
2 | [HSQLDB의 실행]
3 | 1.HSQLDB 실행하기.
4 | 1-1. HSQLDB(1.8.0)를 다운로드 한다.
5 | 1−2. %HSQLDB_HOME%¥lib폴더에 이동. 이하의 커맨드로 HSQLDB를 서버 모드로 실행한다.
6 | ・java -cp hsqldb.jar org.hsqldb.Server -database db/test
7 | 1−2. 동일하게 lib폴더에서 이하의 커맨드로 DatabaseManager를 실행한다.
8 | ・java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
9 | ・다이어로그가 표시되면 Type에서 "HSQL Database Engine Server"를 선택
10 |
11 | [Eclipse에서의 실행 방법]
12 | 1.batch-advanced프로젝트를 선택한 다음, 우 클릭으로 [Run as > Run Configurations...]를 선택
13 | 2.다이어로그가 표시되면 main탭의 프로젝트에 [batch-advanced]를, main클래스에는 [org.springframework.batch.core.launch.support.CommandLineJobRunner]를 설정
14 | 3.Argument탭을 선택해 Program arguments에 [classpath:/batch-context.xml job1 inputFile=classpath:/product_csv/1.csv]를 설정
15 | 4.Run버튼을 클릭하면 배치가 실행됩니다.
16 | 5.DatabaseManager에서 배치를 실행하여 테이블(필요하다면 DatabaseManager에서 View>Reflesh Tree를 실행) 및 CVS파일이 변경된 것을 확인한다.
17 |
18 | [주의]
19 | item-context.xml에서 member.csv의 출력 위치가 [c:/member.csv]로 되어 있으므로 필요하다면 출력 위치를 변경합니다.
--------------------------------------------------------------------------------
/batch-advanced/src/main/java/sample/business/domain/Member.java:
--------------------------------------------------------------------------------
1 | package sample.business.domain;
2 |
3 | public class Member {
4 | private int memberId;
5 | private String name;
6 |
7 | public int getMemberId() {
8 | return memberId;
9 | }
10 |
11 | public void setMemberId(int memberId) {
12 | this.memberId = memberId;
13 | }
14 |
15 | public String getName() {
16 | return name;
17 | }
18 |
19 | public void setName(String name) {
20 | this.name = name;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/batch-advanced/src/main/java/sample/business/domain/Product.java:
--------------------------------------------------------------------------------
1 | package sample.business.domain;
2 |
3 | import javax.validation.constraints.NotNull;
4 | import javax.validation.constraints.Size;
5 |
6 | import org.hibernate.validator.constraints.Range;
7 |
8 |
9 | public class Product {
10 | @NotNull
11 | @Size(max=10)
12 | private String name;
13 |
14 | @NotNull
15 | @Range(min=50, max=900)
16 | private int price;
17 |
18 | public void setName(String name) {
19 | this.name = name;
20 | }
21 |
22 | public void setPrice(int price) {
23 | this.price = price;
24 | }
25 |
26 | public String getName() {
27 | return name;
28 | }
29 |
30 | public int getPrice() {
31 | return price;
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "Product [name=" + name + ", price=" + price + "]";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/batch-advanced/src/main/resources/META-INF/jdbc.properties:
--------------------------------------------------------------------------------
1 | # HSQLDB
2 | batch.jdbc.driver=org.hsqldb.jdbcDriver
3 | batch.jdbc.url=jdbc:hsqldb:hsql://localhost/
4 | batch.jdbc.user=sa
5 | batch.jdbc.password=
6 | batch.schema=
7 | batch.schema.init.script=classpath:/META-INF/schema-init-hsqldb.sql
8 | #batch.schema.init.script=classpath:/org/springframework/batch/core/schema-hsqldb.sql
9 | #batch.schema.drop.script=classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql
10 |
--------------------------------------------------------------------------------
/batch-advanced/src/main/resources/META-INF/spring/job-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/batch-advanced/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootCategory=ERROR, stdout
2 |
3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
6 |
7 | log4j.logger.org.apache.activemq=ERROR
8 | # log4j.logger.org.springframework.batch=DEBUG
9 | # log4j.logger.org.springframework.transaction=INFO
10 |
11 | log4j.logger.test.jdbc=DEBUG
12 | # for debugging datasource initialization
13 | # log4j.category.test.jdbc=DEBUG
14 |
--------------------------------------------------------------------------------
/batch-advanced/src/main/resources/product_csv/1.csv:
--------------------------------------------------------------------------------
1 | name,price
2 | Pen,100
3 | Apple,200
--------------------------------------------------------------------------------
/batch-advanced/src/site/site.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Spring Batch: ${project.name}
6 | index.html
7 |
8 |
9 |
10 | org.springframework.maven.skins
11 | maven-spring-skin
12 | 1.0.5
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/batch-advanced/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/batch-advanced/src/test/java/.gitignore
--------------------------------------------------------------------------------
/batch-advanced/src/test/java/sample.sql:
--------------------------------------------------------------------------------
1 | create table product(
2 | name varchar(20),
3 | price int);
4 |
5 | create table member (
6 | member_id int,
7 | name varchar(20));
8 |
9 | insert into member values(100, 'ChulSoo Kim');
10 | insert into member values(112, 'Tiger Woods');
--------------------------------------------------------------------------------
/batch-advanced/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/batch-advanced/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/batch-advanced/src/test/resources/sample.sql:
--------------------------------------------------------------------------------
1 | create table product(
2 | name varchar(20),
3 | price int);
4 |
5 | create table member(
6 | member_id int,
7 | name varchar(20));
8 |
9 | create table facility(
10 | name varchar(20),
11 | address varchar(20));
--------------------------------------------------------------------------------
/batch-basic/.classpath:
--------------------------------------------------------------------------------
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 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/batch-basic/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/batch-basic/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | batch-basic
4 | This plugin is an archetype that creates a command line batch sample from Spring Batch. Once installed you can create the archetype project using<br/><pre>$ mvn archetype:create -DgroupId=com.first -DartifactId=batch \ -DarchetypeGroupId=org.springframework.batch \ -DarchetypeArtifactId=spring-batch-cli -DarchetypeVersion=1.0-m3-SNAPSHOT</pre><br/> Then you should be able to "cd batch; mvn package exec:exec", and see the app run.
5 |
6 |
7 |
8 |
9 |
10 | org.eclipse.jdt.core.javabuilder
11 |
12 |
13 |
14 |
15 | org.springframework.ide.eclipse.core.springbuilder
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Builder
21 |
22 |
23 |
24 |
25 |
26 | org.springframework.ide.eclipse.core.springnature
27 | org.eclipse.jdt.core.javanature
28 | org.eclipse.m2e.core.maven2Nature
29 |
30 |
31 |
--------------------------------------------------------------------------------
/batch-basic/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 | org.eclipse.jdt.core.compiler.compliance=1.5
4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 | org.eclipse.jdt.core.compiler.source=1.5
6 |
--------------------------------------------------------------------------------
/batch-basic/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 | src/main/resources/batch-context.xml
11 | src/main/resources/META-INF/spring/job-context.xml
12 |
13 |
14 |
15 |
16 |
17 |
18 | true
19 | false
20 |
21 | src/main/resources/batch-context.xml
22 | src/main/resources/META-INF/spring/job-context.xml
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/batch-basic/ReadMe:
--------------------------------------------------------------------------------
1 | ***예제의 실행 방법***
2 | [HSQLDB의 실행]
3 | 1.HSQLDB 실행하기.
4 | 1-1. HSQLDB(1.8.0)를 다운로드 한다.
5 | 1−2. %HSQLDB_HOME%¥lib폴더에 이동. 이하의 커맨드로 HSQLDB를 서버 모드로 실행한다.
6 | ・java -cp hsqldb.jar org.hsqldb.Server -database db/test
7 | 1−2. 동일하게 lib폴더에서 이하의 커맨드로 DatabaseManager를 실행한다.
8 | ・java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
9 | ・다이어로그가 표시되면 Type에서 "HSQL Database Engine Server"를 선택
10 |
11 | [Eclipse에서의 실행 방법]
12 | 1.batch-advanced프로젝트를 선택한 다음, 우클릭으로 [Run as > Run Configurations...]를 선택
13 | 2.다이어로그가 표시되면 main탭의 프로젝트에 [batch-basic]를, main클래스에는 [org.springframework.batch.core.launch.support.CommandLineJobRunner]를 설정
14 | 3.Argument탭을 선택해 Program arguments에 [classpath:/batch-context.xml job1 inputFile=classpath:/product_csv/1.csv]를 설정
15 | 4.Run버튼을 클릭하면 배치가 실행됩니다.
16 | 5.DatabaseManager에서 배치를 실행하여 테이블이 변경된 것을 확인한다.(필요하다면 DatabaseManager에서 View>Reflesh Tree를 실행)
17 |
--------------------------------------------------------------------------------
/batch-basic/src/main/java/sample/batch/listener/SampleChunkListener.java:
--------------------------------------------------------------------------------
1 | package sample.batch.listener;
2 |
3 | import org.springframework.batch.core.annotation.AfterChunk;
4 | import org.springframework.batch.core.annotation.BeforeChunk;
5 | import org.springframework.stereotype.Component;
6 |
7 | @Component
8 | public class SampleChunkListener {
9 |
10 | @BeforeChunk
11 | public void beforeChunk() {
12 | System.out.println("*** before Chunk");
13 | }
14 |
15 | @AfterChunk
16 | public void afterChunk() {
17 | System.out.println("*** after Chunk");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/batch-basic/src/main/java/sample/batch/listener/SampleStepExecutionListener.java:
--------------------------------------------------------------------------------
1 | package sample.batch.listener;
2 |
3 | import org.springframework.batch.core.ExitStatus;
4 | import org.springframework.batch.core.StepExecution;
5 | import org.springframework.batch.core.annotation.AfterStep;
6 | import org.springframework.batch.core.annotation.BeforeStep;
7 | import org.springframework.stereotype.Component;
8 |
9 | @Component("sampleStepExecutionListener")
10 | public class SampleStepExecutionListener {
11 |
12 | @BeforeStep
13 | public void beforeStep(StepExecution stepExecution) {
14 | System.out.println("*** Before Step :Start Time " + stepExecution.getStartTime());
15 | }
16 |
17 | @AfterStep
18 | public ExitStatus afterStep(StepExecution stepExecution) {
19 | System.out.println("*** After Step :Commit Count " + stepExecution.getCommitCount());
20 | return ExitStatus.COMPLETED;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/batch-basic/src/main/java/sample/business/domain/Product.java:
--------------------------------------------------------------------------------
1 | package sample.business.domain;
2 |
3 | import javax.validation.constraints.NotNull;
4 | import javax.validation.constraints.Size;
5 |
6 | import org.hibernate.validator.constraints.Range;
7 |
8 |
9 | public class Product {
10 | @NotNull
11 | @Size(max=10)
12 | private String name;
13 |
14 | @NotNull
15 | @Range(min=50, max=900)
16 | private int price;
17 |
18 | public void setName(String name) {
19 | this.name = name;
20 | }
21 |
22 | public void setPrice(int price) {
23 | this.price = price;
24 | }
25 |
26 | public String getName() {
27 | return name;
28 | }
29 |
30 | public int getPrice() {
31 | return price;
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "Product [name=" + name + ", price=" + price + "]";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/batch-basic/src/main/resources/META-INF/jdbc.properties:
--------------------------------------------------------------------------------
1 | # HSQLDB
2 | batch.jdbc.driver=org.hsqldb.jdbcDriver
3 | batch.jdbc.url=jdbc:hsqldb:hsql://localhost/
4 | batch.jdbc.user=sa
5 | batch.jdbc.password=
6 | batch.schema=
7 | batch.schema.init.script=classpath:/META-INF/schema-init-hsqldb.sql
8 | #batch.schema.init.script=classpath:/org/springframework/batch/core/schema-hsqldb.sql
9 | #batch.schema.drop.script=classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql
10 |
--------------------------------------------------------------------------------
/batch-basic/src/main/resources/META-INF/spring/job-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/batch-basic/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootCategory=ERROR, stdout
2 |
3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
6 |
7 | log4j.logger.org.apache.activemq=ERROR
8 | # log4j.logger.org.springframework.batch=DEBUG
9 | # log4j.logger.org.springframework.transaction=INFO
10 |
11 | log4j.logger.test.jdbc=DEBUG
12 | # for debugging datasource initialization
13 | # log4j.category.test.jdbc=DEBUG
14 |
--------------------------------------------------------------------------------
/batch-basic/src/main/resources/product_csv/1.csv:
--------------------------------------------------------------------------------
1 | name,price
2 | Pen,100
3 | Apple,200
4 |
--------------------------------------------------------------------------------
/batch-basic/src/site/site.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Spring Batch: ${project.name}
6 | index.html
7 |
8 |
9 |
10 | org.springframework.maven.skins
11 | maven-spring-skin
12 | 1.0.5
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/batch-basic/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/batch-basic/src/test/java/.gitignore
--------------------------------------------------------------------------------
/batch-basic/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minsoojun/Spring4/d10a868d76e73e863f82b5c5c2fb5af940d3d6fa/batch-basic/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/batch-basic/src/test/resources/sample.sql:
--------------------------------------------------------------------------------
1 | create table product(
2 | name varchar(20),
3 | price int);
--------------------------------------------------------------------------------
/batch-entry/.classpath:
--------------------------------------------------------------------------------
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 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/batch-entry/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/batch-entry/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | batch-entry
4 | This plugin is an archetype that creates a command line batch sample from Spring Batch. Once installed you can create the archetype project using<br/><pre>$ mvn archetype:create -DgroupId=com.first -DartifactId=batch \ -DarchetypeGroupId=org.springframework.batch \ -DarchetypeArtifactId=spring-batch-cli -DarchetypeVersion=1.0-m3-SNAPSHOT</pre><br/> Then you should be able to "cd batch; mvn package exec:exec", and see the app run.
5 |
6 |
7 |
8 |
9 |
10 | org.eclipse.jdt.core.javabuilder
11 |
12 |
13 |
14 |
15 | org.springframework.ide.eclipse.core.springbuilder
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Builder
21 |
22 |
23 |
24 |
25 |
26 | org.springframework.ide.eclipse.core.springnature
27 | org.eclipse.jdt.core.javanature
28 | org.eclipse.m2e.core.maven2Nature
29 |
30 |
31 |
--------------------------------------------------------------------------------
/batch-entry/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 | org.eclipse.jdt.core.compiler.compliance=1.5
4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 | org.eclipse.jdt.core.compiler.source=1.5
6 |
--------------------------------------------------------------------------------
/batch-entry/.springBeans:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1
4 |
5 |
6 |
7 |
8 |
9 |
10 | src/main/resources/batch-context.xml
11 | src/main/resources/META-INF/spring/job-context.xml
12 |
13 |
14 |
15 |
16 |
17 |
18 | true
19 | false
20 |
21 | src/main/resources/batch-context.xml
22 | src/main/resources/META-INF/spring/job-context.xml
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/batch-entry/ReadMe:
--------------------------------------------------------------------------------
1 | ***예제의 실행 방법***
2 | [HSQLDB의 실행]
3 | 1.HSQLDB가 실행되어 있지 않다면 HSQLDB를 인메모리 모드로 실행한다.
4 | 1-1. HSQLDB(1.8.0)를 다운로드하여 lib폴더에서 이하의 커맨드를 사용하여 실행한다.(이 예제에서는 인 메모리)
5 | ・java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
6 |
7 | [Eclipse에서의 실행 방법]
8 | 1.batch-entry프로젝트를 선택한 다음, 우클릭으로 [Run as > Run Configurations...]를 선택
9 | 2.다이어로그가 표시되면 main탭의 프로젝트에 [batch-entry]를, main클래스에는 [org.springframework.batch.core.launch.support.CommandLineJobRunner]를 설정
10 | 3.Argument탭을 선택해 Program arguments에 [classpath:/batch-context.xml job1]를 설정
11 | 4.Run버튼을 클릭하면 배치가 실행됩니다.(콘솔 뷰에서 실행을 확인 가능)
12 |
13 | [에러 처리의 확인]
14 | EntryItemReader클래스의 input을 다음과 같이 변경해서 에러를 확인할 수 있음
15 | private String[] input = {"Hello World", "hoge", "hoge", null};
--------------------------------------------------------------------------------
/batch-entry/src/main/java/sample/batch/exception/BatchSkipException.java:
--------------------------------------------------------------------------------
1 | package sample.batch.exception;
2 |
3 | public class BatchSkipException extends RuntimeException {
4 | private static final long serialVersionUID = 1L;
5 |
6 | public BatchSkipException() {
7 | }
8 |
9 | public BatchSkipException(String msg) {
10 | super(msg);
11 | }
12 |
13 | public BatchSkipException(Throwable th) {
14 | super(th);
15 | }
16 |
17 | public BatchSkipException(String msg, Throwable th) {
18 | super(msg, th);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/batch-entry/src/main/java/sample/batch/step/EntryItemProcessor.java:
--------------------------------------------------------------------------------
1 | package sample.batch.step;
2 |
3 | import org.springframework.batch.item.ItemProcessor;
4 | import org.springframework.stereotype.Component;
5 |
6 | @Component("itemProcessor")
7 | public class EntryItemProcessor implements
8 | ItemProcessor {
9 |
10 | public String process(String message)
11 | throws Exception {
12 | return message + "!!";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/batch-entry/src/main/java/sample/batch/step/EntryItemReader.java:
--------------------------------------------------------------------------------
1 | package sample.batch.step;
2 |
3 | import org.springframework.batch.item.ItemReader;
4 | import org.springframework.stereotype.Component;
5 |
6 | import sample.batch.exception.BatchSkipException;
7 |
8 | @Component("itemReader")
9 | public class EntryItemReader implements ItemReader {
10 |
11 | private String[] input = {"Hello World", "hoge", "안녕하세요", null};
12 |
13 | private int index = 0;
14 |
15 | /**
16 | * Reads next record from input
17 | */
18 | public String read() throws Exception {
19 |
20 | String message = input[index++];
21 |
22 | if(message == null) {
23 | return null;
24 | }
25 | if (message.equals("hoge")) {
26 | throw new BatchSkipException("데이터 에러"
27 | + message + "]");
28 | }
29 | return message;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/batch-entry/src/main/java/sample/batch/step/EntryItemWriter.java:
--------------------------------------------------------------------------------
1 | package sample.batch.step;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.batch.item.ItemWriter;
6 | import org.springframework.stereotype.Component;
7 |
8 |
9 | @Component("itemWriter")
10 | public class EntryItemWriter implements ItemWriter