├── contents
├── 20160924-cli-script
│ ├── elasticsearch
│ │ ├── .gitignore
│ │ ├── elasticsearch.groovy
│ │ ├── application.yml
│ │ └── README.md
│ ├── .gitignore
│ ├── esexport
│ │ ├── .gitignore
│ │ ├── application.yml
│ │ └── README.md
│ ├── eshealth
│ │ ├── application.yml
│ │ └── eshealth.groovy
│ ├── hello
│ │ ├── README.md
│ │ └── hello.groovy
│ ├── hello2
│ │ ├── application.yml
│ │ ├── README.md
│ │ └── hello2.groovy
│ ├── .editorconfig
│ └── README.md
├── 20160221-web-resource
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ └── .editorconfig
├── 20150622-db
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── schema.sql
│ │ │ │ ├── data.sql
│ │ │ │ ├── application.yml
│ │ │ │ └── templates
│ │ │ │ │ └── index.html
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── repository
│ │ │ │ └── OsRepository.java
│ │ │ │ ├── App.java
│ │ │ │ ├── domain
│ │ │ │ └── Os.java
│ │ │ │ ├── service
│ │ │ │ └── OsService.java
│ │ │ │ └── web
│ │ │ │ └── IndexController.java
│ │ └── test
│ │ │ ├── resources
│ │ │ └── fixture.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ └── service
│ │ │ └── OsServiceTests.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ └── .editorconfig
├── 20150911-test-jdbc
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── schema.sql
│ │ │ │ ├── application.yml
│ │ │ │ ├── templates
│ │ │ │ │ └── index.html
│ │ │ │ └── data.sql
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── repository
│ │ │ │ └── PermissionRepository.java
│ │ │ │ ├── App.java
│ │ │ │ ├── domain
│ │ │ │ └── Permission.java
│ │ │ │ └── web
│ │ │ │ └── IndexController.java
│ │ └── test
│ │ │ └── resources
│ │ │ ├── application-test.yml
│ │ │ └── data-test.sql
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ └── .editorconfig
├── 20151208-properties
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── group
│ │ │ │ └── test.properties
│ │ │ ├── messages.properties
│ │ │ ├── application.yml
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ └── .editorconfig
├── 20160405-javassist
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── META-INF
│ │ │ │ │ └── spring.factories
│ │ │ │ ├── data.sql
│ │ │ │ ├── templates
│ │ │ │ │ └── index.html
│ │ │ │ ├── application.yml
│ │ │ │ └── schema.sql
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── repository
│ │ │ │ └── OsRepository.java
│ │ │ │ ├── App.java
│ │ │ │ ├── annotation
│ │ │ │ └── PersistentConditionallyOnProperty.java
│ │ │ │ ├── domain
│ │ │ │ ├── Foo.java
│ │ │ │ └── Os.java
│ │ │ │ ├── service
│ │ │ │ └── OsService.java
│ │ │ │ └── web
│ │ │ │ └── IndexController.java
│ │ └── test
│ │ │ ├── resources
│ │ │ └── fixture.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ └── service
│ │ │ ├── EmptyContextConfiguration.java
│ │ │ ├── EmptySpringApplicationTests.java
│ │ │ ├── EmptySpringApplicationConfiguration.java
│ │ │ └── NormalTests.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20150622-hello-world
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ ├── .editorconfig
│ └── build.gradle
├── 20160321-fixed-version
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ └── main
│ │ │ ├── less
│ │ │ └── app.less
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── App.java
│ │ │ │ ├── web
│ │ │ │ └── IndexController.java
│ │ │ │ └── config
│ │ │ │ ├── GitProperties.java
│ │ │ │ └── PrefixAndFixedVersionStrategy.java
│ │ │ └── resources
│ │ │ ├── application.yml
│ │ │ └── templates
│ │ │ ├── index.html
│ │ │ └── login.html
│ └── .editorconfig
├── 20161012-native-query
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── application.yml
│ │ │ │ ├── schema.sql
│ │ │ │ ├── data.sql
│ │ │ │ └── templates
│ │ │ │ │ └── index.html
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── App.java
│ │ │ │ ├── domain
│ │ │ │ ├── Employee.java
│ │ │ │ └── Department.java
│ │ │ │ ├── entity
│ │ │ │ ├── ExtendedEmployee.java
│ │ │ │ └── ExtendedEmployee2.java
│ │ │ │ ├── web
│ │ │ │ └── IndexController.java
│ │ │ │ ├── service
│ │ │ │ └── EmployeeService.java
│ │ │ │ └── repository
│ │ │ │ └── ExtendedEmployeeRepository.java
│ │ └── test
│ │ │ └── resources
│ │ │ └── data-test.sql
│ ├── README.md
│ ├── .editorconfig
│ └── build.gradle
├── 20150829-join-manytomany
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ └── Permission.java
│ │ │ ├── repository
│ │ │ └── PermissionRepository.java
│ │ │ ├── service
│ │ │ └── PermissionService.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── README.md
│ └── .editorconfig
├── 20150829-join-manytomany2
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── RolePermission.java
│ │ │ └── Permission.java
│ │ │ ├── repository
│ │ │ └── PermissionRepository.java
│ │ │ ├── service
│ │ │ └── PermissionService.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── README.md
│ └── .editorconfig
├── 20150829-join-manytomany3
│ ├── .gitignore
│ ├── src
│ │ ├── test
│ │ │ └── resources
│ │ │ │ └── application.yml
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── Permission.java
│ │ │ └── RolePermission.java
│ │ │ ├── service
│ │ │ └── PermissionService.java
│ │ │ ├── repository
│ │ │ └── PermissionRepository.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20150901-join-manytomany4
│ ├── .gitignore
│ ├── src
│ │ ├── test
│ │ │ └── resources
│ │ │ │ └── application.yml
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── Permission.java
│ │ │ └── RolePermission.java
│ │ │ ├── service
│ │ │ └── PermissionService.java
│ │ │ ├── web
│ │ │ └── IndexController.java
│ │ │ └── repository
│ │ │ └── PermissionRepository.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20150908-join-manytomany8
│ ├── .gitignore
│ ├── src
│ │ ├── test
│ │ │ └── resources
│ │ │ │ └── application.yml
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── Permission.java
│ │ │ └── RolePermission.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20150910-thymeleaf-helper
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ └── web
│ │ │ ├── IndexController.java
│ │ │ └── Helper.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ ├── .editorconfig
│ └── build.gradle
├── 20160720-query-validation
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── data.sql
│ │ │ │ ├── application.yml
│ │ │ │ ├── data-sample.sql
│ │ │ │ ├── templates
│ │ │ │ │ └── index.html
│ │ │ │ └── schema.sql
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── App.java
│ │ │ │ ├── domain
│ │ │ │ ├── Department.java
│ │ │ │ └── Employee.java
│ │ │ │ ├── service
│ │ │ │ └── EmployeeService.java
│ │ │ │ └── web
│ │ │ │ └── IndexController.java
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ └── SampleTests.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ ├── .editorconfig
│ └── build.gradle
├── 20161016-logging
│ ├── .gitignore
│ ├── README.md
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── templates
│ │ │ │ ├── index.html
│ │ │ │ ├── error.html
│ │ │ │ ├── projects
│ │ │ │ │ └── list.html
│ │ │ │ └── list.html
│ │ │ ├── ValidationMessages.properties
│ │ │ ├── application.yml
│ │ │ └── messages.properties
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── form
│ │ │ └── ProjectCreateForm.java
│ │ │ ├── App.java
│ │ │ ├── service
│ │ │ └── ProjectService.java
│ │ │ ├── util
│ │ │ └── LogHandler.java
│ │ │ └── web
│ │ │ └── CustomErrorController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ └── .editorconfig
├── 20151109-test-mysql
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── schema.sql
│ │ │ │ ├── application.yml
│ │ │ │ ├── templates
│ │ │ │ │ └── index.html
│ │ │ │ └── data.sql
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── repository
│ │ │ │ └── PermissionRepository.java
│ │ │ │ ├── App.java
│ │ │ │ ├── domain
│ │ │ │ └── Permission.java
│ │ │ │ └── web
│ │ │ │ └── IndexController.java
│ │ └── test
│ │ │ └── resources
│ │ │ ├── application-test.yml
│ │ │ └── data-test.sql
│ ├── README.md
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── Vagrantfile
├── 20161225-es
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ └── main
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── form
│ │ │ │ └── AccountSearchForm.java
│ │ │ │ ├── repository
│ │ │ │ └── AccountRepository.java
│ │ │ │ ├── App.java
│ │ │ │ ├── entity
│ │ │ │ └── Account.java
│ │ │ │ └── service
│ │ │ │ └── AccountService.java
│ │ │ └── resources
│ │ │ ├── templates
│ │ │ └── accounts
│ │ │ │ └── list.html
│ │ │ └── application.yml
│ └── .editorconfig
├── 20160307-test-controllers
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── templates
│ │ │ │ ├── index.html
│ │ │ │ ├── users
│ │ │ │ └── list.html
│ │ │ │ └── projects
│ │ │ │ └── list.html
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ └── web
│ │ │ ├── UserController.java
│ │ │ └── ProjectController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ ├── .editorconfig
│ └── build.gradle
├── 20151210-git-sha-to-profile
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── banner.txt
│ │ │ ├── messages.properties
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── application.yml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ └── .editorconfig
├── 20160821-querydsl-join
│ ├── .gitignore
│ ├── README.md
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── static
│ │ │ │ └── css
│ │ │ │ │ └── style.css
│ │ │ ├── schema.sql
│ │ │ ├── data.sql
│ │ │ └── templates
│ │ │ │ ├── index.html
│ │ │ │ └── department.html
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Employee.java
│ │ │ └── Department.java
│ │ │ └── service
│ │ │ └── sql
│ │ │ ├── MySQLSQLTemplatesServiceImpl.java
│ │ │ ├── H2SQLTemplatesServiceImpl.java
│ │ │ └── SQLTemplatesService.java
│ └── .editorconfig
├── 20150903-join-manytomany5
│ ├── .gitignore
│ ├── src
│ │ ├── test
│ │ │ └── resources
│ │ │ │ └── application.yml
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── Permission.java
│ │ │ └── RolePermission.java
│ │ │ ├── web
│ │ │ └── IndexController.java
│ │ │ └── service
│ │ │ └── PermissionService.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20150903-join-manytomany6
│ ├── .gitignore
│ ├── src
│ │ ├── test
│ │ │ └── resources
│ │ │ │ └── application.yml
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── Permission.java
│ │ │ └── RolePermission.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20150906-join-manytomany7
│ ├── .gitignore
│ ├── src
│ │ ├── test
│ │ │ └── resources
│ │ │ │ └── application.yml
│ │ └── main
│ │ │ ├── resources
│ │ │ ├── application.yml
│ │ │ ├── templates
│ │ │ │ └── index.html
│ │ │ └── schema.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ ├── App.java
│ │ │ ├── domain
│ │ │ ├── Role.java
│ │ │ ├── Permission.java
│ │ │ └── RolePermission.java
│ │ │ └── web
│ │ │ └── IndexController.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── .editorconfig
│ └── README.md
├── 20160927-mock-controller-tests
│ ├── .gitignore
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ ├── templates
│ │ │ │ │ ├── index.html
│ │ │ │ │ ├── users
│ │ │ │ │ │ └── list.html
│ │ │ │ │ ├── error.html
│ │ │ │ │ └── projects
│ │ │ │ │ │ └── list.html
│ │ │ │ ├── data-h2.sql
│ │ │ │ ├── application.yml
│ │ │ │ └── schema-h2.sql
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── spring
│ │ │ │ ├── repository
│ │ │ │ ├── UserRepository.java
│ │ │ │ ├── ProjectRepository.java
│ │ │ │ └── elasticsearch
│ │ │ │ │ └── LogRepository.java
│ │ │ │ ├── App.java
│ │ │ │ ├── annotation
│ │ │ │ ├── ElasticsearchDependentService.java
│ │ │ │ └── ElasticsearchDependentController.java
│ │ │ │ ├── domain
│ │ │ │ ├── User.java
│ │ │ │ ├── elasticsearch
│ │ │ │ │ └── Log.java
│ │ │ │ └── Project.java
│ │ │ │ ├── service
│ │ │ │ ├── UserService.java
│ │ │ │ ├── LogService.java
│ │ │ │ └── ProjectService.java
│ │ │ │ └── web
│ │ │ │ ├── foo
│ │ │ │ ├── Foo1Controller.java
│ │ │ │ ├── Foo2Controller.java
│ │ │ │ ├── Foo3Controller.java
│ │ │ │ ├── Foo4Controller.java
│ │ │ │ ├── Foo5Controller.java
│ │ │ │ ├── Foo6Controller.java
│ │ │ │ ├── Foo7Controller.java
│ │ │ │ ├── Foo8Controller.java
│ │ │ │ └── Foo9Controller.java
│ │ │ │ ├── UserController.java
│ │ │ │ ├── AppErrorController.java
│ │ │ │ └── ProjectController.java
│ │ └── test
│ │ │ ├── resources
│ │ │ ├── data-empty.sql
│ │ │ └── data-project.sql
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── spring
│ │ │ └── web
│ │ │ ├── NoElasticsearchTestApp.java
│ │ │ ├── DefaultStandaloneControllerConfig.java
│ │ │ ├── AbstractControllerTests.java
│ │ │ └── NoElasticsearchAutoConfigurationConfiguration.java
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── README.md
│ └── .editorconfig
└── 20161011-querydsl-native-sql-join
│ ├── .gitignore
│ ├── README.md
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── src
│ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ ├── data.sql
│ │ └── schema.sql
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── spring
│ │ ├── service
│ │ └── sql
│ │ │ ├── SQLTemplatesService.java
│ │ │ ├── MySQLSQLTemplatesServiceImpl.java
│ │ │ └── H2SQLTemplatesServiceImpl.java
│ │ ├── domain
│ │ ├── C.java
│ │ ├── D.java
│ │ ├── B.java
│ │ ├── A.java
│ │ └── E.java
│ │ ├── App.java
│ │ └── entity
│ │ └── ExtendedA.java
│ └── .editorconfig
├── .travis.yml
└── .travis.sh
/contents/20160924-cli-script/elasticsearch/.gitignore:
--------------------------------------------------------------------------------
1 | data/
2 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/.gitignore:
--------------------------------------------------------------------------------
1 | *.jar*
2 | .idea/
3 | *.iml
4 |
--------------------------------------------------------------------------------
/contents/20150622-db/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/esexport/.gitignore:
--------------------------------------------------------------------------------
1 | *.json
2 | !accounts.json
3 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20151208-properties/src/main/resources/group/test.properties:
--------------------------------------------------------------------------------
1 | x.y.z=テスト
2 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 |
--------------------------------------------------------------------------------
/contents/20161016-logging/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | *.swp
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk8
4 | script:
5 | - ./.travis.sh
6 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | .vagrant/
6 |
--------------------------------------------------------------------------------
/contents/20151208-properties/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | .vagrant/
6 |
--------------------------------------------------------------------------------
/contents/20161225-es/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | data/
5 | *.iml
6 | *.swp
7 |
--------------------------------------------------------------------------------
/contents/20151208-properties/src/main/resources/messages.properties:
--------------------------------------------------------------------------------
1 | msg.hello=こんにちは
2 | msg.hoge=世界
3 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | *.swp
6 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | .vagrant/
6 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | Revision: ${application.revision}
2 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/src/main/resources/messages.properties:
--------------------------------------------------------------------------------
1 | msg.hello=こんにちは
2 | msg.hoge=世界
3 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | src/main/generated/
3 | .gradle/
4 | .idea/
5 | *.iml
6 |
--------------------------------------------------------------------------------
/contents/20161016-logging/README.md:
--------------------------------------------------------------------------------
1 | # logging
2 |
3 | ## Launch
4 |
5 | ```
6 | ./gradlew bootRun
7 | ```
8 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | src/main/generated/
6 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | src/main/generated/
6 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | src/main/generated/
6 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | data/
4 | .idea/
5 | *.iml
6 | *.swp
7 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .gradle/
3 | .idea/
4 | *.iml
5 | src/main/generated/
6 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | It works!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | It works!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | It works!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/test/resources/data-empty.sql:
--------------------------------------------------------------------------------
1 | -- Real empty SQL file causes error, so put a meaningless SQL
2 | select 1;
3 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table os (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 |
--------------------------------------------------------------------------------
/contents/20151208-properties/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 | messages:
5 | cache-seconds: 0
6 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/elasticsearch/elasticsearch.groovy:
--------------------------------------------------------------------------------
1 | @Grab('spring-boot-starter-data-elasticsearch')
2 | @RestController
3 | class Elasticsearch {
4 | }
5 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/esexport/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | banner-mode: "off"
4 | logging:
5 | level:
6 | org.springframework: WARN
7 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/eshealth/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | banner-mode: "off"
4 | logging:
5 | level:
6 | org.springframework: WARN
7 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/test/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/test/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/test/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/test/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/test/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/test/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table permission (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table permission (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into `department` values (1, 'foo');
2 |
3 | insert into `employee` values (1, 1, 0, 'e1', 0, 0);
4 |
--------------------------------------------------------------------------------
/contents/20150622-db/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150622-db/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/README.md:
--------------------------------------------------------------------------------
1 | # Using subquery in native SQL join clause with Querydsl
2 |
3 | ## Launch
4 |
5 | ```
6 | ./gradlew bootRun
7 | ```
8 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/ValidationMessages.properties:
--------------------------------------------------------------------------------
1 | org.hibernate.validator.constraints.NotEmpty.message=\u306F\u5165\u529B\u5FC5\u9808\u3067\u3059
2 |
--------------------------------------------------------------------------------
/contents/20161225-es/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20161225-es/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into os (name) values ('Windows');
2 | insert into os (name) values ('OS X');
3 | insert into os (name) values ('CentOS');
4 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.context.ApplicationListener=\
2 | com.example.spring.javassist.ClassDefinitionModifier
3 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150911-test-jdbc/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/resources/templates/users/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Users
4 |
5 |
6 | Users list
7 |
8 |
9 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160405-javassist/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20161016-logging/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20161016-logging/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150622-hello-world/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150622-hello-world/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/README.md:
--------------------------------------------------------------------------------
1 | # Testing with MySQL
2 |
3 | ## About
4 |
5 | Test code example for MySQL.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20151109-test-mysql/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20151208-properties/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20151208-properties/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into os (name) values ('Windows');
2 | insert into os (name) values ('OS X');
3 | insert into os (name) values ('CentOS');
4 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/README.md:
--------------------------------------------------------------------------------
1 | # Querydsl join
2 |
3 | ## About
4 |
5 | Join tables using Querydsl.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/templates/users/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Users
4 |
5 |
6 | Users list
7 |
8 |
9 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160221-web-resource/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/resources/templates/projects/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Projects
4 |
5 |
6 | Projects list
7 |
8 |
9 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160321-fixed-version/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/less/app.less:
--------------------------------------------------------------------------------
1 | @import (reference) '../../../build/webResource/bower_components/bootstrap/less/bootstrap.less';
2 |
3 | .main {
4 | .jumbotron;
5 | }
6 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160821-querydsl-join/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20161012-native-query/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20161012-native-query/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 | server:
5 | error:
6 | whitelabel:
7 | enabled: false
8 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150829-join-manytomany/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150829-join-manytomany2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150829-join-manytomany3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150901-join-manytomany4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150903-join-manytomany5/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150903-join-manytomany6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150906-join-manytomany7/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150908-join-manytomany8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20150910-thymeleaf-helper/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/README.md:
--------------------------------------------------------------------------------
1 | # JDBC/JPA testing example
2 |
3 | ## About
4 |
5 | Test code example for JDBC/JPA.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160307-test-controllers/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20160720-query-validation/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160720-query-validation/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/templates/error.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Error
4 |
5 |
6 | Custom error page
7 |
8 |
9 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/test/resources/data-project.sql:
--------------------------------------------------------------------------------
1 | truncate table `project`;
2 |
3 | insert into `project` (id, name) values
4 | (1, 'a'),
5 | (2, 'b'),
6 | (3, 'c');
7 |
--------------------------------------------------------------------------------
/contents/20151208-properties/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20151210-git-sha-to-profile/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/README.md:
--------------------------------------------------------------------------------
1 | # test controllers
2 |
3 | ## About
4 |
5 | Tests for controllers using MockMvc.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/java/com/example/spring/form/AccountSearchForm.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.form;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class AccountSearchForm {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20160927-mock-controller-tests/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/spring-boot-practice/HEAD/contents/20161011-querydsl-native-sql-join/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/contents/20161012-native-query/README.md:
--------------------------------------------------------------------------------
1 | # Result set mapping for native queries
2 |
3 | ## Launch
4 |
5 | ```
6 | ./gradlew bootRun
7 | ```
8 |
9 | ## Test
10 |
11 | ```
12 | ./gradlew test
13 | ```
14 |
--------------------------------------------------------------------------------
/contents/20150622-db/README.md:
--------------------------------------------------------------------------------
1 | # Database connection example
2 |
3 | ## About
4 |
5 | Simple example to show how to use database connection.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/README.md:
--------------------------------------------------------------------------------
1 | # thymeleaf-helper
2 |
3 | ## About
4 |
5 | Example of registering a Bean for Thymeleaf template.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20151208-properties/README.md:
--------------------------------------------------------------------------------
1 | # properties
2 |
3 | ## About
4 |
5 | Manage properties with multibyte and convert to ascii on build.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: false
4 | messages:
5 | cache-seconds: 0
6 | application:
7 | revision: ${gitSha}
8 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/hello/README.md:
--------------------------------------------------------------------------------
1 | # CLI script
2 |
3 | ## Run
4 |
5 | ```
6 | spring run hello.groovy
7 | ```
8 |
9 | ## Create jar
10 |
11 | ```
12 | spring jar hello.jar hello.groovy
13 | ```
14 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/hello/hello.groovy:
--------------------------------------------------------------------------------
1 | @Component
2 | class Hello implements CommandLineRunner {
3 | @Override
4 | public void run(String... args) {
5 | println "Hello, world!"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany)
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/README.md:
--------------------------------------------------------------------------------
1 | # properties
2 |
3 | ## About
4 |
5 | Manage properties with multibyte and convert to ascii on build.
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/README.md:
--------------------------------------------------------------------------------
1 | # Query Validation for Repositories
2 |
3 | ## About
4 |
5 | Investigate how the query validation works.
6 |
7 | ## Test
8 |
9 | ```
10 | ./gradlew test
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/elasticsearch/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | data:
3 | elasticsearch:
4 | properties:
5 | # Enable access via http://localhost:9200/
6 | http:
7 | enabled: true
8 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/hello2/application.yml:
--------------------------------------------------------------------------------
1 | # Suppress banner
2 | spring:
3 | main:
4 | banner-mode: "off"
5 | # All default logs can be suppressed
6 | logging:
7 | level:
8 | org.springframework: WARN
9 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/test/java/com/example/spring/web/NoElasticsearchTestApp.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | @NoElasticsearchConfiguration
4 | public class NoElasticsearchTestApp {
5 | }
6 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/hello2/README.md:
--------------------------------------------------------------------------------
1 | # CLI script
2 |
3 | ## Run
4 |
5 | ```
6 | spring run hello2.groovy a b c
7 | ```
8 |
9 | ## Create jar
10 |
11 | ```
12 | spring jar hello2.jar hello2.groovy
13 | ```
14 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/README.md:
--------------------------------------------------------------------------------
1 | # mock controller tests
2 |
3 | ## About
4 |
5 | Tests for controllers using MockMvc, standaloneSetup().
6 |
7 | ## Launch
8 |
9 | ```
10 | ./gradlew bootRun
11 | ```
12 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/README.md:
--------------------------------------------------------------------------------
1 | # hello-world
2 |
3 | ## About
4 |
5 | Simple Spring Boot application, using
6 |
7 | * Web functionality
8 | * Thymeleaf
9 |
10 | ## Launch
11 |
12 | ```
13 | ./gradlew bootRun
14 | ```
15 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/messages.properties:
--------------------------------------------------------------------------------
1 | message.error=\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059
2 | message.error.param=\u30D1\u30E9\u30E1\u30FC\u30BF{0}\u3092\u6301\u3064\u30E1\u30C3\u30BB\u30FC\u30B8\u3067\u3059
3 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/resources/data-sample.sql:
--------------------------------------------------------------------------------
1 | truncate table `department`;
2 | truncate table `employee`;
3 |
4 | insert into `department` values (2, 'bar');
5 |
6 | insert into `employee` values (2, 2, 0, 'John Doe', 1, 2);
7 |
--------------------------------------------------------------------------------
/.travis.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | for i in $(find ./contents -type d -maxdepth 1); do
4 | pushd ${i} > /dev/null 2>&1
5 | if [ -f gradlew ]; then
6 | echo "Build ${i}"
7 | ./gradlew build
8 | fi
9 | popd > /dev/null 2>&1
10 | done
11 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/resources/static/css/style.css:
--------------------------------------------------------------------------------
1 | table {
2 | border-collapse: collapse;
3 | }
4 | table, th, td {
5 | border: 1px solid #000;
6 | }
7 | th {
8 | background: #ccc;
9 | }
10 | th, td {
11 | padding: 8px;
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20161225-es/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
6 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20161016-logging/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
6 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
6 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | thymeleaf:
7 | cache: false
8 | application:
9 | persistent-conditionally:
10 | os-foo: true
11 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/test/resources/fixture.sql:
--------------------------------------------------------------------------------
1 | truncate table os;
2 |
3 | insert into os (name) values ('Windows');
4 | insert into os (name) values ('OS X');
5 | insert into os (name) values ('CentOS');
6 | insert into os (name) values ('Android');
7 | insert into os (name) values ('iOS');
8 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
6 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 2
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`).
8 |
9 | ## Launch
10 |
11 | ```
12 | ./gradlew bootRun
13 | ```
14 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/test/resources/fixture.sql:
--------------------------------------------------------------------------------
1 | truncate table os;
2 |
3 | insert into os (name) values ('Windows');
4 | insert into os (name) values ('OS X');
5 | insert into os (name) values ('CentOS');
6 | insert into os (name) values ('Android');
7 | insert into os (name) values ('iOS');
8 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 | indent_style = space
7 | indent_size = 4
8 | trim_trailing_whitespace = true
9 |
10 | [*.yml]
11 | indent_size = 2
12 |
13 | [*.md]
14 | trim_trailing_whitespace = false
15 |
--------------------------------------------------------------------------------
/contents/20150622-db/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/java/com/example/spring/repository/OsRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Os;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | public interface OsRepository extends JpaRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20151208-properties/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150622-db/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Feb 21 17:59:30 JST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Feb 21 17:59:30 JST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/repository/OsRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Os;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | public interface OsRepository extends JpaRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/java/com/example/spring/form/ProjectCreateForm.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.form;
2 |
3 | import lombok.Data;
4 | import org.hibernate.validator.constraints.NotEmpty;
5 |
6 | @Data
7 | public class ProjectCreateForm {
8 | @NotEmpty
9 | private String name;
10 | }
11 |
--------------------------------------------------------------------------------
/contents/20161225-es/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20151208-properties/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/test/java/com/example/spring/service/EmptyContextConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | /**
4 | * Empty context configuration that does nothing.
5 | * It just exists to set to SpringApplicationConfiguration.
6 | */
7 | public class EmptyContextConfiguration {
8 | }
9 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20161016-logging/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 | VAGRANTFILE_API_VERSION = "2"
6 |
7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8 | config.vm.box = "ubuntu/trusty64"
9 | end
10 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 22 22:12:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
7 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 4
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`) and
8 | join tables with JPA Specification.
9 |
10 | ## Launch
11 |
12 | ```
13 | ./gradlew bootRun
14 | ```
15 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 5
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`) and
8 | construct query using Querydsl.
9 |
10 | ## Launch
11 |
12 | ```
13 | ./gradlew bootRun
14 | ```
15 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 8
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`) and
8 | join tables with JPA Criteria API.
9 |
10 | ## Launch
11 |
12 | ```
13 | ./gradlew bootRun
14 | ```
15 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table os (
2 | id int primary key auto_increment,
3 | foo varchar(255),
4 | name varchar(255) not null
5 | );
6 |
7 | create table foo (
8 | id int primary key auto_increment,
9 | -- bar varchar(255),
10 | name varchar(255) not null
11 | );
12 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/repository/UserRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.User;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | public interface UserRepository extends JpaRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.json]
12 | indent_size = 2
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table `department` (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 |
6 | create table `employee` (
7 | id int primary key auto_increment,
8 | department_id int not null,
9 | name varchar(255) not null
10 | );
11 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into `department` values (1, 'foo');
2 | insert into `department` values (2, 'bar');
3 |
4 | insert into `employee` values (1, 1, 'e1');
5 | insert into `employee` values (2, 2, 'e2');
6 | insert into `employee` values (3, 1, 'e3');
7 | insert into `employee` values (4, 2, 'e4');
8 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/java/com/example/spring/repository/PermissionRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Permission;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | public interface PermissionRepository extends JpaRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | logging:
7 | level:
8 | org.springframework.test: DEBUG
9 | org.springframework.transaction: DEBUG
10 | org.springframework.jdbc.core: DEBUG
11 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/test/resources/data-test.sql:
--------------------------------------------------------------------------------
1 | truncate table permission;
2 |
3 | insert into permission (id, name) values (1, 'CREATE_USER');
4 | insert into permission (id, name) values (2, 'READ_USER');
5 | insert into permission (id, name) values (3, 'UPDATE_USER');
6 | insert into permission (id, name) values (4, 'DELETE_USER');
7 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | jpa:
3 | show-sql: true
4 | hibernate:
5 | ddl-auto: ''
6 | logging:
7 | level:
8 | org.springframework.test: DEBUG
9 | org.springframework.transaction: DEBUG
10 | org.springframework.jdbc.core: DEBUG
11 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/test/resources/data-test.sql:
--------------------------------------------------------------------------------
1 | truncate table permission;
2 |
3 | insert into permission (id, name) values (1, 'CREATE_USER');
4 | insert into permission (id, name) values (2, 'READ_USER');
5 | insert into permission (id, name) values (3, 'UPDATE_USER');
6 | insert into permission (id, name) values (4, 'DELETE_USER');
7 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/repository/ProjectRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Project;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | public interface ProjectRepository extends JpaRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/java/com/example/spring/repository/PermissionRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Permission;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | public interface PermissionRepository extends JpaRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/hello2/hello2.groovy:
--------------------------------------------------------------------------------
1 | @Component
2 | class Hello implements CommandLineRunner {
3 | @Override
4 | public void run(String... args) {
5 | println "Hello, world!"
6 | if (args) {
7 | for (def arg : args) {
8 | println arg
9 | }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/templates/projects/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Projects
4 |
5 |
6 | Projects list
7 |
8 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/java/com/example/spring/repository/AccountRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.entity.Account;
4 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
5 |
6 | public interface AccountRepository extends ElasticsearchRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/templates/error.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Error
4 |
5 |
6 | Error
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 | 1
10 | 2
11 |
12 |
13 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 | 1
10 | 2
11 |
12 |
13 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 3
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`) and
8 | execute INNER JOIN with association table (though it's usually not necessary).
9 |
10 | ## Launch
11 |
12 | ```
13 | ./gradlew bootRun
14 | ```
15 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table `department` (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 |
6 | create table `employee` (
7 | id int primary key auto_increment,
8 | department_id int not null,
9 | manager tinyint(1) not null default 0,
10 | name varchar(255) not null
11 | );
12 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 6
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`) and
8 | construct query using Querydsl.
9 | In this example, pagination is also available.
10 |
11 | ## Launch
12 |
13 | ```
14 | ./gradlew bootRun
15 | ```
16 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/service/sql/SQLTemplatesService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service.sql;
2 |
3 | import com.mysema.query.sql.SQLTemplates;
4 |
5 | /**
6 | * Interface to handle multiple database platform for QuerydslSQL.
7 | */
8 | public interface SQLTemplatesService {
9 | SQLTemplates getTemplates();
10 | }
11 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/README.md:
--------------------------------------------------------------------------------
1 | # CLI script
2 |
3 | These examples require `spring` command.
4 |
5 | ## Install
6 |
7 | If you don't have sdkman:
8 |
9 | ```
10 | curl -s "https://get.sdkman.io" | bash
11 | ```
12 |
13 | Then,
14 |
15 | ```
16 | sdk install springboot
17 | # or
18 | sdk install springboot v1.3.2.RELEASE
19 | ```
20 |
21 | See each directory for details.
22 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/repository/elasticsearch/LogRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository.elasticsearch;
2 |
3 | import com.example.spring.domain.elasticsearch.Log;
4 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
5 |
6 | public interface LogRepository extends ElasticsearchRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/java/com/example/spring/domain/Os.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class Os {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20151208-properties/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/README.md:
--------------------------------------------------------------------------------
1 | # Table join example (ManyToMany) 7
2 |
3 | ## About
4 |
5 | N:N table join example using Spring Data JPA.
6 |
7 | This example has association table entity (`RolePermission`) and
8 | construct query using Querydsl.
9 | In this example, all of the tables have `deleted_at` column (soft delete).
10 |
11 | ## Launch
12 |
13 | ```
14 | ./gradlew bootRun
15 | ```
16 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | public class IndexController {
8 | @RequestMapping("/")
9 | public String index() {
10 | return "index";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | thymeleaf:
3 | cache: true
4 | messages:
5 | cache-seconds: -1
6 | resources:
7 | cache-period: 604800
8 | #logging:
9 | # level:
10 | # org.springframework.web.servlet: DEBUG
11 | # org.springframework.web.servlet: TRACE
12 | security:
13 | basic:
14 | enabled: false
15 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/domain/C.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Entity
8 | @Data
9 | public class C {
10 | @Id
11 | @GeneratedValue
12 | private Integer id;
13 | private String name;
14 |
15 | @ManyToOne(fetch = FetchType.LAZY)
16 | private B b;
17 | }
18 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/annotation/ElasticsearchDependentService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.annotation;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | import java.lang.annotation.*;
6 |
7 | @Target(ElementType.TYPE)
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Inherited
10 | @Service
11 | public @interface ElasticsearchDependentService {
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/App.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class App {
8 | public static void main(String[] args) {
9 | SpringApplication.run(App.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/test/resources/data-test.sql:
--------------------------------------------------------------------------------
1 | truncate table `department`;
2 | truncate table `employee`;
3 |
4 | insert into `department` values (1, 'foo');
5 | insert into `department` values (2, 'bar');
6 |
7 | insert into `employee` values (1, 1, 'e1');
8 | insert into `employee` values (2, 2, 'e2');
9 | insert into `employee` values (3, 1, 'e3');
10 | insert into `employee` values (4, 2, 'e4');
11 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/java/com/example/spring/service/ProjectService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | @Service
6 | public class ProjectService {
7 | public void create(String name) {
8 | if ("bar".equals(name)) {
9 | throw new IllegalStateException("Service throws exception");
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class Role {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20151208-properties/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | @RequestMapping
8 | public class IndexController {
9 | @RequestMapping("/")
10 | public String index() {
11 | return "index";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/domain/D.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class D {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | @RequestMapping
8 | public class IndexController {
9 | @RequestMapping("/")
10 | public String index() {
11 | return "index";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class Permission {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class Permission {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/data-h2.sql:
--------------------------------------------------------------------------------
1 | truncate table `user`;
2 | truncate table `project`;
3 | truncate table `project_user`;
4 |
5 | insert into `user` (id, name) values
6 | (1, 'foo'),
7 | (2, 'bar');
8 |
9 | insert into `project` (id, name) values
10 | (1, 'a'),
11 | (2, 'b');
12 |
13 | insert into `project_user` (id, user_id, project_id) values
14 | (1, 1, 1),
15 | (2, 1, 2);
16 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 | create table role_permission (
6 | id int primary key auto_increment,
7 | role_id int not null,
8 | permission_id int not null
9 | );
10 | create table permission (
11 | id int primary key auto_increment,
12 | name varchar(255) not null
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 | create table role_permission (
6 | id int primary key auto_increment,
7 | role_id int not null,
8 | permission_id int not null
9 | );
10 | create table permission (
11 | id int primary key auto_increment,
12 | name varchar(255) not null
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class Permission {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 | create table role_permission (
6 | id int primary key auto_increment,
7 | role_id int not null,
8 | permission_id int not null
9 | );
10 | create table permission (
11 | id int primary key auto_increment,
12 | name varchar(255) not null
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 | create table role_permission (
6 | id int primary key auto_increment,
7 | role_id int not null,
8 | permission_id int not null
9 | );
10 | create table permission (
11 | id int primary key auto_increment,
12 | name varchar(255) not null
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 | create table role_permission (
6 | id int primary key auto_increment,
7 | role_id int not null,
8 | permission_id int not null
9 | );
10 | create table permission (
11 | id int primary key auto_increment,
12 | name varchar(255) not null
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 | create table role_permission (
6 | id int primary key auto_increment,
7 | role_id int not null,
8 | permission_id int not null
9 | );
10 | create table permission (
11 | id int primary key auto_increment,
12 | name varchar(255) not null
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | @RequestMapping
8 | public class IndexController {
9 | @RequestMapping("/")
10 | public String index() {
11 | return "index";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Data
8 | @Entity
9 | public class User {
10 | @Id
11 | @GeneratedValue
12 | private Integer id;
13 |
14 | private String name;
15 |
16 | @ManyToOne(fetch = FetchType.LAZY)
17 | private Project project;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Service;
6 |
7 | @Service
8 | public class UserService {
9 | @Autowired
10 | private UserRepository userRepository;
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/java/com/example/spring/web/UserController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | @RequestMapping("/users")
8 | public class UserController {
9 | @RequestMapping
10 | public String list() {
11 | return "users/list";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table `department` (
2 | id int primary key auto_increment,
3 | name varchar(255) not null
4 | );
5 |
6 | create table `employee` (
7 | id int primary key auto_increment,
8 | department_id int not null,
9 | manager tinyint(1) not null default 0,
10 | name varchar(255) not null,
11 | defined_column int,
12 | undefined_column int
13 | );
14 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Role {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany
17 | private List rolePermission;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Role {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany
17 | private List rolePermission;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Role {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany
17 | private List rolePermission;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/resources/templates/accounts/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Accounts
4 |
5 |
6 |
7 |
8 |
9 | |
10 | |
11 | |
12 | |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/src/main/java/com/example/spring/web/ProjectController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | @RequestMapping("/projects")
8 | public class ProjectController {
9 | @RequestMapping
10 | public String list() {
11 | return "projects/list";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into `department` values
2 | (1, 'd1'),
3 | (2, 'd2'),
4 | (3, 'd3'),
5 | (4, 'd4');
6 |
7 | insert into `employee` values
8 | (1, 1, 0, 'e1'),
9 | (2, 1, 0, 'e2'),
10 | (3, 2, 0, 'e3'),
11 | (4, 1, 0, 'e4'),
12 | (5, 1, 0, 'e5'),
13 | (6, 2, 0, 'e6'),
14 | (7, 2, 0, 'e7'),
15 | (8, 3, 0, 'e8'),
16 | (9, 2, 0, 'e9'),
17 | (10, 4, 0, 'e10'),
18 | (11, 2, 0, 'e11');
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/domain/elasticsearch/Log.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain.elasticsearch;
2 |
3 | import lombok.Data;
4 | import org.springframework.data.annotation.Id;
5 | import org.springframework.data.elasticsearch.annotations.Document;
6 |
7 | @Document(indexName = "log")
8 | @Data
9 | public class Log {
10 | @Id
11 | private Integer id;
12 |
13 | private String description;
14 | }
15 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | @RequestMapping
9 | public class IndexController {
10 | @RequestMapping("/")
11 | public String index(Model model) {
12 | return "index";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | @RequestMapping
9 | public class IndexController {
10 | @RequestMapping("/")
11 | public String index(Model model) {
12 | return "index";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/annotation/ElasticsearchDependentController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.annotation;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.stereotype.Service;
5 |
6 | import java.lang.annotation.*;
7 |
8 | @Target(ElementType.TYPE)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | @Inherited
11 | @Controller
12 | public @interface ElasticsearchDependentController {
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/templates/projects/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Projects
4 |
5 |
6 |
7 |
8 | Error message
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Permission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany(mappedBy = "permission")
17 | private List rolePermission;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Permission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany(mappedBy = "permission")
17 | private List rolePermission;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Permission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany(mappedBy = "permission")
17 | private List rolePermission;
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/service/LogService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.annotation.ElasticsearchDependentService;
4 | import com.example.spring.repository.elasticsearch.LogRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 |
7 | @ElasticsearchDependentService
8 | public class LogService {
9 | @Autowired
10 | private LogRepository logRepository;
11 | }
12 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class RolePermission {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 |
16 | private Integer roleId;
17 |
18 | private Integer permissionId;
19 | }
20 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Entity
8 | @Data
9 | public class RolePermission {
10 | @Id
11 | @GeneratedValue
12 | private Integer id;
13 |
14 | @ManyToOne
15 | private Role role;
16 |
17 | @ManyToOne
18 | @JoinColumn(name = "permission_id")
19 | private Permission permission;
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Entity
8 | @Data
9 | public class RolePermission {
10 | @Id
11 | @GeneratedValue
12 | private Integer id;
13 |
14 | @ManyToOne
15 | private Role role;
16 |
17 | @ManyToOne
18 | @JoinColumn(name = "permission_id")
19 | private Permission permission;
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Entity
8 | @Data
9 | public class RolePermission {
10 | @Id
11 | @GeneratedValue
12 | private Integer id;
13 |
14 | @ManyToOne
15 | private Role role;
16 |
17 | @ManyToOne
18 | @JoinColumn(name = "permission_id")
19 | private Permission permission;
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/annotation/PersistentConditionallyOnProperty.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.FIELD)
10 | public @interface PersistentConditionallyOnProperty {
11 | String value();
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | datasource:
3 | platform: h2
4 | jpa:
5 | show-sql: true
6 | hibernate:
7 | ddl-auto: ''
8 | server:
9 | error:
10 | whitelabel:
11 | enabled: false
12 | logging:
13 | level:
14 | # These packages contain logs for @Bean registration
15 | org.springframework.core.io.support: DEBUG
16 | org.springframework.context.annotation: DEBUG
17 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/resources/schema-h2.sql:
--------------------------------------------------------------------------------
1 | create table if not exists `user` (
2 | `id` int primary key auto_increment,
3 | `name` varchar(255) not null
4 | );
5 |
6 | create table if not exists `project` (
7 | `id` int primary key auto_increment,
8 | `name` varchar(255) not null
9 | );
10 |
11 | create table if not exists `project_user` (
12 | `id` int primary key auto_increment,
13 | `project_id` int not null,
14 | `user_id` int not null
15 | );
16 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 | import java.util.List;
8 |
9 | @Entity
10 | @Data
11 | public class Role {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 |
17 | @OneToMany
18 | private List rolePermission;
19 |
20 | private Date deletedAt;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 | import java.util.List;
8 |
9 | @Entity
10 | @Data
11 | public class Role {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 |
17 | @OneToMany
18 | private List rolePermission;
19 |
20 | private Date deletedAt;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/domain/Foo.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import com.example.spring.annotation.PersistentConditionallyOnProperty;
4 | import lombok.Data;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | @Data
11 | public class Foo {
12 | @Id
13 | private Integer id;
14 |
15 | @PersistentConditionallyOnProperty("application.persistent-conditionally.foo-bar")
16 | private String bar;
17 | }
18 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/eshealth/eshealth.groovy:
--------------------------------------------------------------------------------
1 | @ConfigurationProperties(prefix = 'es')
2 | class EsHealthConfigProperties {
3 | String host = 'localhost'
4 | int port = 9200
5 | }
6 |
7 | @Component
8 | class EsHealth implements CommandLineRunner {
9 | @Autowired
10 | EsHealthConfigProperties esConfig
11 |
12 | @Override
13 | void run(String... args) {
14 | println "curl http://${esConfig.host}:${esConfig.port}/_cluster/health?pretty=true".execute().text
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/domain/B.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class B {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @ManyToOne(fetch = FetchType.LAZY)
17 | private A a;
18 |
19 | @OneToMany(mappedBy = "b")
20 | private List cList;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null,
4 | deleted_at datetime
5 | );
6 | create table role_permission (
7 | id int primary key auto_increment,
8 | role_id int not null,
9 | permission_id int not null,
10 | deleted_at datetime
11 | );
12 | create table permission (
13 | id int primary key auto_increment,
14 | name varchar(255) not null,
15 | deleted_at datetime
16 | );
17 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table role (
2 | id int primary key auto_increment,
3 | name varchar(255) not null,
4 | deleted_at datetime
5 | );
6 | create table role_permission (
7 | id int primary key auto_increment,
8 | role_id int not null,
9 | permission_id int not null,
10 | deleted_at datetime
11 | );
12 | create table permission (
13 | id int primary key auto_increment,
14 | name varchar(255) not null,
15 | deleted_at datetime
16 | );
17 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | public class IndexController {
8 | @RequestMapping("/")
9 | public String index() {
10 | return "index";
11 | }
12 |
13 | @RequestMapping("/login")
14 | public String login() {
15 | return "login";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | data:
3 | elasticsearch:
4 | properties:
5 | http:
6 | enabled: true
7 | index:
8 | search:
9 | slowlog:
10 | threshold:
11 | query:
12 | info: "0s"
13 | logging:
14 | level:
15 | org.elasticsearch.cluster.routing.allocation.decider: ERROR
16 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/domain/Employee.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.ManyToOne;
9 |
10 | @Data
11 | @Entity
12 | public class Employee {
13 | @Id
14 | @GeneratedValue
15 | private Integer id;
16 |
17 | private String name;
18 |
19 | @ManyToOne
20 | private Department department;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 | import java.util.List;
8 |
9 | @Entity
10 | @Data
11 | public class Permission {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 |
17 | @OneToMany(mappedBy = "permission")
18 | private List rolePermission;
19 |
20 | private Date deletedAt;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 | import java.util.List;
8 |
9 | @Entity
10 | @Data
11 | public class Permission {
12 | @Id
13 | @GeneratedValue
14 | private Integer id;
15 | private String name;
16 |
17 | @OneToMany(mappedBy = "permission")
18 | private List rolePermission;
19 |
20 | private Date deletedAt;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150911-test-jdbc/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into permission (id, name) values (1, 'CREATE_USER');
2 | insert into permission (id, name) values (2, 'READ_USER');
3 | insert into permission (id, name) values (3, 'UPDATE_USER');
4 | insert into permission (id, name) values (4, 'DELETE_USER');
5 | insert into permission (id, name) values (5, 'CREATE_TEAM');
6 | insert into permission (id, name) values (6, 'READ_TEAM');
7 | insert into permission (id, name) values (7, 'UPDATE_TEAM');
8 | insert into permission (id, name) values (8, 'DELETE_TEAM');
9 |
--------------------------------------------------------------------------------
/contents/20151109-test-mysql/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into permission (id, name) values (1, 'CREATE_USER');
2 | insert into permission (id, name) values (2, 'READ_USER');
3 | insert into permission (id, name) values (3, 'UPDATE_USER');
4 | insert into permission (id, name) values (4, 'DELETE_USER');
5 | insert into permission (id, name) values (5, 'CREATE_TEAM');
6 | insert into permission (id, name) values (6, 'READ_TEAM');
7 | insert into permission (id, name) values (7, 'UPDATE_TEAM');
8 | insert into permission (id, name) values (8, 'DELETE_TEAM');
9 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/elasticsearch/README.md:
--------------------------------------------------------------------------------
1 | # Elasticsearch server
2 |
3 | If you want to use Elasticsearch for test purpose, this would be one of the easiest way to do it.
4 |
5 | ## Run
6 |
7 | ```
8 | spring run elasticsearch.groovy
9 | ```
10 |
11 | If you want another cluster on the same machine:
12 |
13 | ```
14 | spring run elasticsearch.groovy -- --server.port=8081 --spring.data.elasticsearch.cluster-name=elasticsearch2
15 | ```
16 |
17 | ## Create jar
18 |
19 | ```
20 | spring jar elasticsearch.jar elasticsearch.groovy
21 | ```
22 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 |
8 | @Entity
9 | @Data
10 | public class RolePermission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 |
15 | @ManyToOne
16 | private Role role;
17 |
18 | @ManyToOne
19 | @JoinColumn(name = "permission_id")
20 | private Permission permission;
21 |
22 | private Date deletedAt;
23 | }
24 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 |
8 | @Entity
9 | @Data
10 | public class RolePermission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 |
15 | @ManyToOne
16 | private Role role;
17 |
18 | @ManyToOne
19 | @JoinColumn(name = "permission_id")
20 | private Permission permission;
21 |
22 | private Date deletedAt;
23 | }
24 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.ManyToMany;
9 | import java.util.List;
10 |
11 | @Entity
12 | @Data
13 | public class Role {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 | private String name;
18 |
19 | @ManyToMany
20 | private List permissions;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/domain/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.OneToMany;
9 | import java.util.List;
10 |
11 | @Entity
12 | @Data
13 | public class Role {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 | private String name;
18 |
19 | @OneToMany
20 | private List permissions;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/domain/A.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.OneToMany;
9 | import java.util.List;
10 |
11 | @Entity
12 | @Data
13 | public class A {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 | private String name;
18 |
19 | @OneToMany(mappedBy = "a")
20 | private List bList;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/entity/ExtendedA.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.entity;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Data
8 | @AllArgsConstructor
9 | @NoArgsConstructor
10 | public class ExtendedA {
11 | private Integer id;
12 | private String name;
13 | private String bName;
14 | private String cName;
15 | private String dName;
16 | private String e1;
17 | private String e2;
18 | private String e3;
19 | }
20 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/domain/RolePermission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.ManyToOne;
9 |
10 | @Entity
11 | @Data
12 | public class RolePermission {
13 | @Id
14 | @GeneratedValue
15 | private Integer id;
16 |
17 | @ManyToOne
18 | private Role role;
19 |
20 | @ManyToOne
21 | private Permission permission;
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/domain/E.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | import javax.persistence.*;
8 |
9 | @Entity
10 | @Data
11 | @AllArgsConstructor
12 | @NoArgsConstructor
13 | public class E {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 | private String name;
18 |
19 | @ManyToOne(fetch = FetchType.LAZY)
20 | private D d;
21 |
22 | private Integer subId;
23 | }
24 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/java/com/example/spring/service/OsService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Os;
4 | import com.example.spring.repository.OsRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class OsService {
12 | @Autowired
13 | private OsRepository osRepository;
14 |
15 | public List findAll() {
16 | return osRepository.findAll();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/java/com/example/spring/domain/Employee.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.ManyToOne;
9 |
10 | @Data
11 | @Entity
12 | public class Employee {
13 | @Id
14 | @GeneratedValue
15 | private Integer id;
16 |
17 | private String name;
18 |
19 | private boolean manager;
20 |
21 | @ManyToOne
22 | private Department department;
23 | }
24 |
--------------------------------------------------------------------------------
/contents/20160221-web-resource/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Example
7 |
8 |
9 |
10 |
11 |
12 |
It works!
13 |
Bootstrap is enabled.
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/service/OsService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Os;
4 | import com.example.spring.repository.OsRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class OsService {
12 | @Autowired
13 | private OsRepository osRepository;
14 |
15 | public List findAll() {
16 | return osRepository.findAll();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/java/com/example/spring/repository/PermissionRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Permission;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.List;
8 |
9 | public interface PermissionRepository extends JpaRepository {
10 | @Query("select p from #{#entityName} p inner join p.roles r where r.id = ?1")
11 | List findAllByRoleId(Integer id);
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/repository/PermissionRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Permission;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.List;
8 |
9 | public interface PermissionRepository extends JpaRepository {
10 | @Query("select p from #{#entityName} p inner join p.roles r where r.id = ?1")
11 | List findAllByRoleId(Integer id);
12 | }
13 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/domain/Project.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.OneToMany;
9 | import java.util.List;
10 |
11 | @Data
12 | @Entity
13 | public class Project {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 |
18 | private String name;
19 |
20 | @OneToMany(mappedBy = "project")
21 | private List users;
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/domain/Department.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.OneToMany;
9 | import java.util.List;
10 |
11 | @Data
12 | @Entity
13 | public class Department {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 |
18 | private String name;
19 |
20 | @OneToMany(mappedBy = "department")
21 | private List employees;
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/java/com/example/spring/domain/Department.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.OneToMany;
9 | import java.util.List;
10 |
11 | @Data
12 | @Entity
13 | public class Department {
14 | @Id
15 | @GeneratedValue
16 | private Integer id;
17 |
18 | private String name;
19 |
20 | @OneToMany(mappedBy = "department")
21 | private List employees;
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/domain/Os.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import com.example.spring.annotation.PersistentConditionallyOnProperty;
4 | import lombok.Data;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.Id;
9 |
10 | @Entity
11 | @Data
12 | public class Os {
13 | @Id
14 | @GeneratedValue
15 | private Integer id;
16 | private String name;
17 |
18 | @PersistentConditionallyOnProperty("application.persistent-conditionally.os-foo")
19 | private String foo;
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/java/com/example/spring/util/LogHandler.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.util;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Component;
5 |
6 | import javax.servlet.http.HttpServletRequest;
7 |
8 | @Component
9 | public class LogHandler {
10 | public static String CAUGHT_ERROR_ATTRIBUTE_NAME = "error";
11 |
12 | @Autowired
13 | private HttpServletRequest request;
14 |
15 | public void handle(Throwable e) {
16 | request.setAttribute(CAUGHT_ERROR_ATTRIBUTE_NAME, e);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Permission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @ManyToMany
17 | @JoinTable(name = "role_permission",
18 | joinColumns = @JoinColumn(name = "permission_id"),
19 | inverseJoinColumns = @JoinColumn(name = "role_id"))
20 | private List roles;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/domain/Permission.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.List;
7 |
8 | @Entity
9 | @Data
10 | public class Permission {
11 | @Id
12 | @GeneratedValue
13 | private Integer id;
14 | private String name;
15 |
16 | @OneToMany
17 | @JoinTable(name = "RolePermission",
18 | joinColumns = @JoinColumn(name = "permission_id"),
19 | inverseJoinColumns = @JoinColumn(name = "role_id"))
20 | private List roles;
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/java/com/example/spring/domain/Employee.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 | import javax.persistence.ManyToOne;
9 |
10 | @Data
11 | @Entity
12 | public class Employee {
13 | @Id
14 | @GeneratedValue
15 | private Integer id;
16 |
17 | private String name;
18 |
19 | private boolean manager;
20 |
21 | @ManyToOne
22 | private Department department;
23 |
24 | private Integer definedColumn;
25 | }
26 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/resources/data.sql:
--------------------------------------------------------------------------------
1 | insert into `a` values
2 | (1, 'a1'),
3 | (2, 'a2'),
4 | (3, 'a3');
5 |
6 | insert into `b` values
7 | (1, 1, 'b1'),
8 | (2, 2, 'b2'),
9 | (3, 3, 'b3');
10 |
11 | insert into `c` values
12 | (1, 1, 1, 'c1'),
13 | (2, 2, 2, 'c2'),
14 | (3, 3, 3, 'c3');
15 |
16 | insert into `d` values
17 | (1, 'd1'),
18 | (2, 'd2'),
19 | (3, 'd3');
20 |
21 | insert into `e` values
22 | (1, 1, 1, 'e1'),
23 | (2, 1, 2, 'e2'),
24 | (3, 1, 3, 'e3'),
25 | (4, 2, 1, 'e4'),
26 | (5, 2, 2, 'e5'),
27 | (6, 3, 1, 'e6'),
28 | (7, 3, 3, 'e7');
29 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/test/java/com/example/spring/web/DefaultStandaloneControllerConfig.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
4 | import org.springframework.boot.autoconfigure.web.ErrorAttributes;
5 | import org.springframework.context.annotation.Bean;
6 |
7 | public class DefaultStandaloneControllerConfig {
8 | // Without @WebAppConfiguration and @SpringBootApplication, this definition is required
9 | @Bean
10 | ErrorAttributes errorAttributes() {
11 | return new DefaultErrorAttributes();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo1Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo1")
10 | public class Foo1Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo2Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo2")
10 | public class Foo2Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo3Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo3")
10 | public class Foo3Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo4Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo4")
10 | public class Foo4Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo5Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo5")
10 | public class Foo5Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo6Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo6")
10 | public class Foo6Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo7Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo7")
10 | public class Foo7Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo8Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo8")
10 | public class Foo8Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/foo/Foo9Controller.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web.foo;
2 |
3 | import com.example.spring.repository.UserRepository;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping("/foo9")
10 | public class Foo9Controller {
11 | @Autowired
12 | private UserRepository userRepository;
13 |
14 | @RequestMapping
15 | public String list() {
16 | return "users/list";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/java/com/example/spring/config/GitProperties.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.config;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.context.annotation.PropertySource;
5 | import org.springframework.core.env.Environment;
6 | import org.springframework.stereotype.Component;
7 |
8 | @Component
9 | @PropertySource("classpath:/git.properties")
10 | public class GitProperties {
11 | @Autowired
12 | private Environment environment;
13 |
14 | public String getCommitId() {
15 | return environment.getProperty("git.commit.id");
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/test/java/com/example/spring/service/EmptySpringApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import org.junit.ClassRule;
4 | import org.junit.Rule;
5 | import org.springframework.test.context.junit4.rules.SpringClassRule;
6 | import org.springframework.test.context.junit4.rules.SpringMethodRule;
7 |
8 | @EmptySpringApplicationConfiguration
9 | public abstract class EmptySpringApplicationTests {
10 | @ClassRule
11 | public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule();
12 |
13 | @Rule
14 | public final SpringMethodRule springMethodRule = new SpringMethodRule();
15 | }
16 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/java/com/example/spring/domain/Department.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.domain;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | import javax.persistence.Entity;
8 | import javax.persistence.GeneratedValue;
9 | import javax.persistence.Id;
10 | import javax.persistence.Transient;
11 |
12 | @Data
13 | @Entity
14 | @NoArgsConstructor
15 | @AllArgsConstructor
16 | public class Department {
17 | @Id
18 | @GeneratedValue
19 | private Integer id;
20 |
21 | private String name;
22 |
23 | @Transient
24 | private String employeesList;
25 | }
26 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/java/com/example/spring/service/PermissionService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Permission;
4 | import com.example.spring.repository.PermissionRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class PermissionService {
12 | @Autowired
13 | private PermissionRepository permissionRepository;
14 |
15 | public List findAllByRoleId(Integer id) {
16 | return permissionRepository.findAllByRoleId(id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/service/PermissionService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Permission;
4 | import com.example.spring.repository.PermissionRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class PermissionService {
12 | @Autowired
13 | private PermissionRepository permissionRepository;
14 |
15 | public List findAllByRoleId(Integer id) {
16 | return permissionRepository.findAllByRoleId(id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/service/PermissionService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Permission;
4 | import com.example.spring.repository.PermissionRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class PermissionService {
12 | @Autowired
13 | private PermissionRepository permissionRepository;
14 |
15 | public List findAllByRoleId(Integer id) {
16 | return permissionRepository.findAllByRoleId(id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/service/PermissionService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Permission;
4 | import com.example.spring.repository.PermissionRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class PermissionService {
12 | @Autowired
13 | private PermissionRepository permissionRepository;
14 |
15 | public List findAllByRoleId(Integer id) {
16 | return permissionRepository.findAllByRoleId(id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20151210-git-sha-to-profile/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.ui.Model;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 |
8 | @Controller
9 | @RequestMapping
10 | public class IndexController {
11 | @Value("${application.revision}")
12 | private String revision;
13 |
14 | @RequestMapping("/")
15 | public String index(Model model) {
16 | model.addAttribute("revision", revision);
17 | return "index";
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/java/com/example/spring/service/sql/MySQLSQLTemplatesServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service.sql;
2 |
3 | import com.mysema.query.sql.MySQLTemplates;
4 | import com.mysema.query.sql.SQLTemplates;
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6 | import org.springframework.stereotype.Service;
7 |
8 | @ConditionalOnProperty(name = "spring.datasource.platform", havingValue = "mysql")
9 | @Service
10 | public class MySQLSQLTemplatesServiceImpl implements SQLTemplatesService {
11 | @Override
12 | public SQLTemplates getTemplates() {
13 | return new MySQLTemplates();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/java/com/example/spring/service/sql/H2SQLTemplatesServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service.sql;
2 |
3 | import com.mysema.query.sql.H2Templates;
4 | import com.mysema.query.sql.SQLTemplates;
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6 | import org.springframework.stereotype.Service;
7 |
8 | @ConditionalOnProperty(name = "spring.datasource.platform", havingValue = "h2", matchIfMissing = true)
9 | @Service
10 | public class H2SQLTemplatesServiceImpl implements SQLTemplatesService {
11 | @Override
12 | public SQLTemplates getTemplates() {
13 | return new H2Templates();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/service/sql/MySQLSQLTemplatesServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service.sql;
2 |
3 | import com.mysema.query.sql.MySQLTemplates;
4 | import com.mysema.query.sql.SQLTemplates;
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6 | import org.springframework.stereotype.Service;
7 |
8 | @ConditionalOnProperty(name = "spring.datasource.platform", havingValue = "mysql")
9 | @Service
10 | public class MySQLSQLTemplatesServiceImpl implements SQLTemplatesService {
11 | @Override
12 | public SQLTemplates getTemplates() {
13 | return new MySQLTemplates();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/java/com/example/spring/service/sql/H2SQLTemplatesServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service.sql;
2 |
3 | import com.mysema.query.sql.H2Templates;
4 | import com.mysema.query.sql.SQLTemplates;
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6 | import org.springframework.stereotype.Service;
7 |
8 | @ConditionalOnProperty(name = "spring.datasource.platform", havingValue = "h2", matchIfMissing = true)
9 | @Service
10 | public class H2SQLTemplatesServiceImpl implements SQLTemplatesService {
11 | @Override
12 | public SQLTemplates getTemplates() {
13 | return new H2Templates();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Example
7 |
8 |
9 |
10 |
11 |
12 |
13 |
It works!
14 |
Bootstrap is enabled.
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.OsService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private OsService osService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("osList", osService.findAll());
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/resources/templates/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Example
7 |
8 |
9 |
10 |
11 |
12 |
13 |
Login
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/test/java/com/example/spring/service/EmptySpringApplicationConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import org.springframework.boot.test.SpringApplicationConfiguration;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Annotation to launch Spring boot without any auto-configuration for tests.
12 | */
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Target(ElementType.TYPE)
15 | @SpringApplicationConfiguration(EmptyContextConfiguration.class)
16 | public @interface EmptySpringApplicationConfiguration {
17 | }
18 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/test/java/com/example/spring/web/AbstractControllerTests.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.junit.ClassRule;
4 | import org.junit.Rule;
5 | import org.springframework.test.context.junit4.rules.SpringClassRule;
6 | import org.springframework.test.context.junit4.rules.SpringMethodRule;
7 | import org.springframework.test.web.servlet.MockMvc;
8 |
9 | public abstract class AbstractControllerTests {
10 | @ClassRule
11 | public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule();
12 |
13 | @Rule
14 | public final SpringMethodRule springMethodRule = new SpringMethodRule();
15 |
16 | protected MockMvc mockMvc;
17 | }
18 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/src/main/java/com/example/spring/web/Helper.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.context.annotation.Scope;
5 | import org.springframework.stereotype.Component;
6 |
7 | import javax.servlet.http.HttpServletRequest;
8 |
9 | @Component
10 | @Scope("request")
11 | public class Helper {
12 | @Autowired
13 | private HttpServletRequest httpServletRequest;
14 |
15 | /**
16 | * You can call this method like {@code ${@helper.something()}}.
17 | */
18 | public String something() {
19 | return "Hello! " + httpServletRequest.getHeader("Host");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/entity/ExtendedEmployee.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.entity;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 |
6 | /**
7 | * This is not a managed entity class.
8 | * To instantiate with returning {@code Object[]} from repository,
9 | * this class defines a constructor that takes {@code Object[]}.
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | public class ExtendedEmployee {
14 | private Integer id;
15 | private String name;
16 | private String departmentName;
17 |
18 | public ExtendedEmployee(Object[] objects) {
19 | this((Integer) objects[0], (String) objects[1], (String) objects[2]);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/contents/20160321-fixed-version/src/main/java/com/example/spring/config/PrefixAndFixedVersionStrategy.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.config;
2 |
3 | import org.springframework.core.io.Resource;
4 | import org.springframework.web.servlet.resource.AbstractVersionStrategy;
5 |
6 | public class PrefixAndFixedVersionStrategy extends AbstractVersionStrategy {
7 | private final String version;
8 |
9 | public PrefixAndFixedVersionStrategy(String prefix, String version) {
10 | super(new MiddleVersionPathStrategy(prefix, version));
11 | this.version = version;
12 | }
13 |
14 | @Override
15 | public String getResourceVersion(Resource resource) {
16 | return this.version;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/repository/PermissionRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Permission;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.List;
8 |
9 | public interface PermissionRepository extends JpaRepository {
10 | @Query(value = "select * from permission p "
11 | + " inner join role_permission rp on rp.permission_id = p.id "
12 | + " inner join role r on r.id = rp.role_id "
13 | + " where r.id = ?1",
14 | nativeQuery = true)
15 | List findAllByRoleId(Integer id);
16 | }
17 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/java/com/example/spring/service/EmployeeService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Employee;
4 | import com.example.spring.repository.EmployeeRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | @Service
11 | public class EmployeeService {
12 | @Autowired
13 | private EmployeeRepository employeeRepository;
14 |
15 | public List findAll() {
16 | return employeeRepository.findAll();
17 | }
18 |
19 | public Employee findByFoo(String foo) {
20 | return employeeRepository.findByFoo(foo);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Employees
7 |
8 |
9 |
10 | | ID |
11 | Name |
12 |
13 |
14 |
15 |
16 | |
17 | |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private PermissionService permissionService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2));
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany2/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private PermissionService permissionService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2));
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150829-join-manytomany3/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private PermissionService permissionService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2));
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private PermissionService permissionService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2));
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private PermissionService permissionService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2));
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20150908-join-manytomany8/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @Controller
10 | @RequestMapping
11 | public class IndexController {
12 | @Autowired
13 | private PermissionService permissionService;
14 |
15 | @RequestMapping("/")
16 | public String index(Model model) {
17 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2));
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20161011-querydsl-native-sql-join/src/main/resources/schema.sql:
--------------------------------------------------------------------------------
1 | create table `a` (
2 | `id` int primary key auto_increment,
3 | `name` varchar(255) not null
4 | );
5 | create table `b` (
6 | `id` int primary key auto_increment,
7 | `a_id` int not null,
8 | `name` varchar(255) not null
9 | );
10 | create table `c` (
11 | `id` int primary key auto_increment,
12 | `b_id` int not null,
13 | `d_id` int,
14 | `name` varchar(255) not null
15 | );
16 | create table `d` (
17 | `id` int primary key auto_increment,
18 | `name` varchar(255) not null
19 | );
20 | create table `e` (
21 | `id` int primary key auto_increment,
22 | `d_id` int not null,
23 | `sub_id` int not null,
24 | `name` varchar(255) not null
25 | );
26 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/java/com/example/spring/service/sql/SQLTemplatesService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service.sql;
2 |
3 | import com.mysema.query.sql.SQLTemplates;
4 | import com.mysema.query.types.OrderSpecifier;
5 | import com.mysema.query.types.expr.StringExpression;
6 | import com.mysema.query.types.path.StringPath;
7 | import com.mysema.query.types.template.StringTemplate;
8 |
9 | /**
10 | * Interface to handle multiple database platform for QuerydslSQL.
11 | */
12 | public interface SQLTemplatesService {
13 | SQLTemplates getTemplates();
14 |
15 | default StringExpression groupConcat(StringPath path, OrderSpecifier orderSpecifier) {
16 | return StringTemplate.create("GROUP_CONCAT({0} order by {1})", path, orderSpecifier);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/UserController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.annotation.ElasticsearchDependentController;
4 | import com.example.spring.repository.UserRepository;
5 | import com.example.spring.service.LogService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | @ElasticsearchDependentController
10 | @RequestMapping("/users")
11 | public class UserController {
12 | @Autowired
13 | private UserRepository userRepository;
14 |
15 | @Autowired
16 | private LogService logService;
17 |
18 | @RequestMapping
19 | public String list() {
20 | return "users/list";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/resources/templates/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.EmployeeService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.ui.Model;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 |
10 | @Controller
11 | @RequestMapping
12 | @Slf4j
13 | public class IndexController {
14 | @Autowired
15 | private EmployeeService employeeService;
16 |
17 | @RequestMapping("/")
18 | public String index(Model model) throws NoSuchFieldException {
19 | model.addAttribute("list", employeeService.findAll());
20 | return "index";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/java/com/example/spring/entity/Account.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.entity;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.Data;
5 | import org.springframework.data.annotation.Id;
6 | import org.springframework.data.elasticsearch.annotations.Document;
7 |
8 | @Document(indexName = "bank", type = "account")
9 | @Data
10 | public class Account {
11 | @Id
12 | @JsonProperty("account_number")
13 | private Integer accountNumber;
14 | private Integer balance;
15 | private String firstname;
16 | private String lastname;
17 | private Integer age;
18 | private String gender;
19 | private String address;
20 | private String employer;
21 | private String email;
22 | private String city;
23 | private String state;
24 | }
25 |
--------------------------------------------------------------------------------
/contents/20160821-querydsl-join/src/main/resources/templates/department.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Departments
7 |
8 |
9 |
10 | | ID |
11 | Name |
12 | Employees |
13 |
14 |
15 |
16 |
17 | |
18 | |
19 | |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.EmployeeService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.ui.Model;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 |
10 | @Controller
11 | @RequestMapping
12 | @Slf4j
13 | public class IndexController {
14 | @Autowired
15 | private EmployeeService employeeService;
16 |
17 | @RequestMapping("/")
18 | public String index(Model model) throws NoSuchFieldException {
19 | model.addAttribute("list", employeeService.findByDepartmentName("foo"));
20 | model.addAttribute("list2", employeeService.findByDepartmentName2("bar"));
21 | return "index";
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany6/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.web.PageableDefault;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.ui.Model;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 |
11 | @Controller
12 | @RequestMapping
13 | public class IndexController {
14 | @Autowired
15 | private PermissionService permissionService;
16 |
17 | @RequestMapping("/")
18 | public String index(Model model, @PageableDefault(size = 3) Pageable pageable) {
19 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2, pageable));
20 | return "index";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20150906-join-manytomany7/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.PermissionService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.web.PageableDefault;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.ui.Model;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 |
11 | @Controller
12 | @RequestMapping
13 | public class IndexController {
14 | @Autowired
15 | private PermissionService permissionService;
16 |
17 | @RequestMapping("/")
18 | public String index(Model model, @PageableDefault(size = 3) Pageable pageable) {
19 | model.addAttribute("permissionList", permissionService.findAllByRoleId(2, pageable));
20 | return "index";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/contents/20150901-join-manytomany4/src/main/java/com/example/spring/repository/PermissionRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.domain.Permission;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 |
7 | import javax.persistence.criteria.Join;
8 | import java.util.List;
9 |
10 | public interface PermissionRepository extends JpaRepository, JpaSpecificationExecutor {
11 | default List findAllByRoleId(Integer id) {
12 | return findAll((root, query, cb) -> {
13 | // In this pattern, you can set restriction conditions to association table rolePermission.
14 | Join rp = root.join("rolePermission");
15 | Join r = rp.join("role");
16 | return cb.equal(r.get("id"), id);
17 | });
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/entity/ExtendedEmployee2.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.entity;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | import javax.persistence.Entity;
8 | import javax.persistence.Id;
9 |
10 | /**
11 | * This class is annotated with {@code @Entity} but it's not really a persistent class.
12 | * NativeJpaQuery in Spring Data JPA checks if the returning value
13 | * of the query methods is the given Entity class, so if we want to return
14 | * non-managed class in query methods of repositories,
15 | * we have to define the class with {@code @Entity}.
16 | */
17 | @Data
18 | @AllArgsConstructor
19 | @NoArgsConstructor
20 | @Entity
21 | public class ExtendedEmployee2 {
22 | // Entity class requires @Id
23 | @Id
24 | private Integer id;
25 | private String name;
26 | private String departmentName;
27 | }
28 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/README.md:
--------------------------------------------------------------------------------
1 | # Class definition modification example using Javassist
2 |
3 | ## About
4 |
5 | Toggle that some `@Entity` class fields' are persistent or not with annotation and property.
6 | Whether a field is persistent or not is judged by Hibernate using `@Transient`,
7 | and if we'd like to treat a field persistent on development and transient on production,
8 | `@Transient` should be given after checking Spring properties.
9 | To achieve this, we listen Spring application loaded event,
10 | checking all `@Entity` classes and modify class definition using Javassist.
11 |
12 | ## Launch
13 |
14 | ```
15 | ./gradlew bootRun
16 | ```
17 |
18 | Change property:
19 |
20 | ```
21 | ./gradlew bootRun -Dapplication.persistent-conditionally.os-foo=false
22 | ```
23 |
24 | ## Test
25 |
26 | ```
27 | ./gradlew test
28 | ```
29 |
30 | Change property:
31 |
32 | ```
33 | ./gradlew test -Dapplication.persistent-conditionally.os-foo=false
34 | ```
35 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/AppErrorController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.boot.autoconfigure.web.ErrorAttributes;
6 | import org.springframework.boot.autoconfigure.web.ErrorController;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 |
10 | @Controller
11 | @Slf4j
12 | public class AppErrorController implements ErrorController {
13 | // Usually this requires WebAppConfiguration
14 | @Autowired
15 | private ErrorAttributes errorAttributes;
16 |
17 | @Override
18 | public String getErrorPath() {
19 | return "/error";
20 | }
21 |
22 | @RequestMapping("/error")
23 | public String error() {
24 | log.info("error");
25 | return "error";
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/service/ProjectService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Project;
4 | import com.example.spring.repository.ProjectRepository;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.data.domain.Page;
8 | import org.springframework.data.domain.PageImpl;
9 | import org.springframework.data.domain.Pageable;
10 | import org.springframework.stereotype.Service;
11 |
12 | import java.util.List;
13 |
14 | @Service
15 | @Slf4j
16 | public class ProjectService {
17 | @Autowired
18 | private ProjectRepository projectRepository;
19 |
20 | public List findAll() {
21 | return projectRepository.findAll();
22 | }
23 |
24 | public Page findAll(Pageable pageable) {
25 | return new PageImpl(projectRepository.findAll());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/test/java/com/example/spring/web/NoElasticsearchAutoConfigurationConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4 | import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import java.lang.annotation.*;
9 |
10 | /**
11 | * This composite annotation is like {@code SpringBootApplication},
12 | * but it excludes Elasticsearch auto configuration.
13 | */
14 | @Target(ElementType.TYPE)
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Inherited
17 | @Configuration
18 | @EnableAutoConfiguration(exclude={ElasticsearchAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class})
19 | public @interface NoElasticsearchAutoConfigurationConfiguration {
20 | }
21 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/main/java/com/example/spring/web/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.domain.Os;
4 | import com.example.spring.service.OsService;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.ui.Model;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 |
11 | import java.lang.annotation.Annotation;
12 |
13 | @Controller
14 | @RequestMapping
15 | @Slf4j
16 | public class IndexController {
17 | @Autowired
18 | private OsService osService;
19 |
20 | @RequestMapping("/")
21 | public String index(Model model) throws NoSuchFieldException {
22 | for (Annotation a : Os.class.getDeclaredField("foo").getAnnotations()) {
23 | log.info("Annotation of Os.foo: {}", a.annotationType().getCanonicalName());
24 | }
25 | model.addAttribute("osList", osService.findAll());
26 | return "index";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/contents/20150622-db/src/test/java/com/example/spring/service/OsServiceTests.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.App;
4 | import com.example.spring.domain.Os;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.boot.test.SpringApplicationConfiguration;
9 | import org.springframework.test.context.jdbc.Sql;
10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
11 |
12 | import java.util.List;
13 |
14 | import static org.junit.Assert.assertEquals;
15 | import static org.junit.Assert.assertNotNull;
16 |
17 | @RunWith(SpringJUnit4ClassRunner.class)
18 | @SpringApplicationConfiguration(classes = App.class)
19 | @Sql("/fixture.sql")
20 | public class OsServiceTests {
21 | @Autowired
22 | private OsService osService;
23 |
24 | @Test
25 | public void findAll() {
26 | List result = osService.findAll();
27 | assertNotNull(result);
28 | assertEquals(5, result.size());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/contents/20160927-mock-controller-tests/src/main/java/com/example/spring/web/ProjectController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import com.example.spring.service.ProjectService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.data.domain.Pageable;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.ui.Model;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 |
11 | @Controller
12 | @RequestMapping("/projects")
13 | @Slf4j
14 | public class ProjectController {
15 | @Autowired
16 | private ProjectService projectService;
17 |
18 | // Usually Pageable requires WebAppConfiguration in tests
19 | @RequestMapping
20 | public String list(Model model, Pageable pageable) {
21 | model.addAttribute("list", projectService.findAll(pageable));
22 | return "projects/list";
23 | }
24 |
25 | @RequestMapping("/foo")
26 | public String foo() {
27 | throw new RuntimeException("This is test");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/service/EmployeeService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.entity.ExtendedEmployee;
4 | import com.example.spring.entity.ExtendedEmployee2;
5 | import com.example.spring.repository.EmployeeRepository;
6 | import com.example.spring.repository.ExtendedEmployeeRepository;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.List;
11 |
12 | @Service
13 | public class EmployeeService {
14 | @Autowired
15 | private EmployeeRepository employeeRepository;
16 |
17 | @Autowired
18 | private ExtendedEmployeeRepository extendedEmployeeRepository;
19 |
20 | public List findByDepartmentName(String departmentName) {
21 | return employeeRepository.findByDepartmentName(departmentName);
22 | }
23 |
24 | public List findByDepartmentName2(String departmentName) {
25 | return extendedEmployeeRepository.findByDepartmentName(departmentName);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/contents/20160924-cli-script/esexport/README.md:
--------------------------------------------------------------------------------
1 | ## Elasticsearch Export
2 |
3 | This example exports data from Elasticsearch with filter
4 | and output JSON file for bulk API.
5 |
6 | The file `accounts.json` is copied from [the official Elasticsearch documents](https://www.elastic.co/guide/en/elasticsearch/reference/current/_exploring_your_data.html).
7 |
8 | ## Prepare: import sample data set
9 |
10 | ```
11 | curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary "@accounts.json"
12 | ```
13 |
14 | ## Run
15 |
16 | Using curl for HTTP client:
17 |
18 | ```
19 | spring run esexport.groovy -- --es.balanceFrom=20000 --es.balanceTo=30000 > export.json
20 | ```
21 |
22 | No dependencies to external commands:
23 |
24 | ```
25 | spring run esexport2.groovy -- --es.balanceFrom=20000 --es.balanceTo=30000 > export.json
26 | ```
27 |
28 | Shell script with [jq](https://stedolan.github.io/jq/):
29 |
30 | ```
31 | ./esexport.sh 20000 30000 > export.json
32 | ```
33 |
34 | ## Import to another Elasticsearch cluster
35 |
36 | ```
37 | curl -XPOST http://localhost:9201/bank/account/_bulk --data-binary "@export.json"
38 | ```
39 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/src/test/java/com/example/spring/SampleTests.java:
--------------------------------------------------------------------------------
1 | package com.example.spring;
2 |
3 | import com.example.spring.service.EmployeeService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.boot.test.SpringApplicationConfiguration;
9 | import org.springframework.test.context.jdbc.Sql;
10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
11 |
12 | import static org.junit.Assert.assertTrue;
13 |
14 | @RunWith(SpringJUnit4ClassRunner.class)
15 | @SpringApplicationConfiguration(App.class)
16 | @Sql("/data-sample.sql")
17 | @Slf4j
18 | public class SampleTests {
19 | @Autowired
20 | private EmployeeService employeeService;
21 |
22 | @Test
23 | public void test() {
24 | log.info("This is test");
25 | }
26 |
27 | @Test
28 | public void testFindByFoo() {
29 | assertTrue(employeeService.findByFoo("John Doe") != null);
30 | assertTrue(employeeService.findByFoo("baz") == null);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/java/com/example/spring/repository/ExtendedEmployeeRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.repository;
2 |
3 | import com.example.spring.entity.ExtendedEmployee2;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.List;
8 |
9 | public interface ExtendedEmployeeRepository extends JpaRepository {
10 | /**
11 | *
12 | * - The alias "department_name" corresponds to ExtendedEmployee2.departmentName.
13 | * - Returning value "ExtendedEmployee2" must match the first type parameter of JpaRepository,
14 | * or it is returned as Object[].
15 | *
16 | */
17 | @Query(value = "select e.id as id, e.name as name, d.name as department_name "
18 | + "from employee e "
19 | + "left join department d on d.id = e.department_id "
20 | + "where d.name = ?1 "
21 | + "order by e.id ",
22 | nativeQuery = true)
23 | List findByDepartmentName(String departmentName);
24 | }
25 |
--------------------------------------------------------------------------------
/contents/20161225-es/src/main/java/com/example/spring/service/AccountService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.entity.Account;
4 | import org.elasticsearch.index.query.QueryBuilders;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.data.domain.PageRequest;
7 | import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
8 | import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
9 | import org.springframework.data.elasticsearch.core.query.SearchQuery;
10 | import org.springframework.stereotype.Service;
11 |
12 | import java.util.List;
13 |
14 | @Service
15 | public class AccountService {
16 | @Autowired
17 | private ElasticsearchTemplate elasticsearchTemplate;
18 |
19 | public List findAll() {
20 | SearchQuery query = new NativeSearchQueryBuilder()
21 | .withQuery(QueryBuilders.matchAllQuery())
22 | .withPageable(new PageRequest(0, Integer.MAX_VALUE))
23 | .build();
24 | return elasticsearchTemplate.queryForList(query, Account.class);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
14 |
15 | Method 1
16 |
17 |
18 |
19 | | ID |
20 | Name |
21 | Department |
22 |
23 |
24 |
25 |
26 | |
27 | |
28 | |
29 |
30 |
31 |
32 |
33 | Method 2
34 |
35 |
36 |
37 | | ID |
38 | Name |
39 | Department |
40 |
41 |
42 |
43 |
44 | |
45 | |
46 | |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/contents/20150903-join-manytomany5/src/main/java/com/example/spring/service/PermissionService.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Permission;
4 | import com.example.spring.domain.QPermission;
5 | import com.example.spring.domain.QRole;
6 | import com.example.spring.domain.QRolePermission;
7 | import com.querydsl.jpa.impl.JPAQueryFactory;
8 | import org.springframework.stereotype.Service;
9 |
10 | import javax.persistence.EntityManager;
11 | import javax.persistence.PersistenceContext;
12 | import java.util.List;
13 |
14 | @Service
15 | public class PermissionService {
16 | @PersistenceContext
17 | private EntityManager em;
18 |
19 | public List findAllByRoleId(Integer id) {
20 | QPermission permission = QPermission.permission;
21 | QRolePermission rolePermission = QRolePermission.rolePermission;
22 | QRole role = QRole.role;
23 | return new JPAQueryFactory(em)
24 | .selectFrom(permission)
25 | .leftJoin(permission.rolePermission, rolePermission)
26 | .leftJoin(rolePermission.role, role)
27 | .where(role.id.eq(id))
28 | .fetch();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/contents/20161016-logging/src/main/java/com/example/spring/web/CustomErrorController.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.web;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.boot.autoconfigure.web.ErrorAttributes;
5 | import org.springframework.boot.autoconfigure.web.ErrorController;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.ui.Model;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.context.request.ServletRequestAttributes;
10 |
11 | import javax.servlet.http.HttpServletRequest;
12 | import java.util.Map;
13 |
14 | @Controller
15 | public class CustomErrorController implements ErrorController {
16 | @Autowired
17 | private ErrorAttributes errorAttributes;
18 |
19 | @Override
20 | public String getErrorPath() {
21 | return "/error";
22 | }
23 |
24 | @RequestMapping("/error")
25 | public String error(HttpServletRequest servletRequest, Model model) {
26 | Map attrs = errorAttributes.getErrorAttributes(new ServletRequestAttributes(servletRequest), false);
27 | model.addAttribute("attrs", attrs);
28 | return "error";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/contents/20150622-hello-world/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE"
7 | classpath "org.springframework:springloaded:1.2.4.RELEASE"
8 | }
9 | }
10 |
11 | def vJavaLang = 1.8
12 |
13 | apply plugin: 'java'
14 | apply plugin: 'idea'
15 | apply plugin: 'spring-boot'
16 |
17 | repositories {
18 | jcenter()
19 | }
20 |
21 | dependencies {
22 | compile "org.projectlombok:lombok:1.16.2"
23 | compile "org.springframework.boot:spring-boot-starter-web"
24 | compile "org.springframework.boot:spring-boot-starter-thymeleaf"
25 | compile "com.h2database:h2"
26 | }
27 |
28 | idea {
29 | module {
30 | inheritOutputDirs = false
31 | outputDir = file("${buildDir}/classes/main")
32 | }
33 | project {
34 | languageLevel = vJavaLang
35 | ipr {
36 | withXml { provider ->
37 | def mapping = provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping
38 | mapping.@vcs = 'Git'
39 | mapping.@directory = '$PROJECT_DIR$'
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/contents/20150910-thymeleaf-helper/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE"
7 | classpath "org.springframework:springloaded:1.2.4.RELEASE"
8 | }
9 | }
10 |
11 | def vJavaLang = 1.8
12 |
13 | apply plugin: 'java'
14 | apply plugin: 'idea'
15 | apply plugin: 'spring-boot'
16 |
17 | repositories {
18 | jcenter()
19 | }
20 |
21 | dependencies {
22 | compile "org.projectlombok:lombok:1.16.2"
23 | compile "org.springframework.boot:spring-boot-starter-web"
24 | compile "org.springframework.boot:spring-boot-starter-thymeleaf"
25 | compile "com.h2database:h2"
26 | }
27 |
28 | idea {
29 | module {
30 | inheritOutputDirs = false
31 | outputDir = file("${buildDir}/classes/main")
32 | }
33 | project {
34 | languageLevel = vJavaLang
35 | ipr {
36 | withXml { provider ->
37 | def mapping = provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping
38 | mapping.@vcs = 'Git'
39 | mapping.@directory = '$PROJECT_DIR$'
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/contents/20160307-test-controllers/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE"
7 | }
8 | }
9 |
10 | def vJavaLang = 1.8
11 |
12 | apply plugin: 'java'
13 | apply plugin: 'idea'
14 | apply plugin: 'spring-boot'
15 |
16 | repositories {
17 | jcenter()
18 | }
19 |
20 | dependencies {
21 | compile "org.projectlombok:lombok:1.16.2"
22 | compile "org.springframework.boot:spring-boot-starter-web"
23 | compile "org.springframework.boot:spring-boot-starter-thymeleaf"
24 | compile "com.h2database:h2"
25 | testCompile "org.springframework.boot:spring-boot-starter-test"
26 | }
27 |
28 | idea {
29 | module {
30 | inheritOutputDirs = false
31 | outputDir = file("${buildDir}/classes/main")
32 | }
33 | project {
34 | languageLevel = vJavaLang
35 | ipr {
36 | withXml { provider ->
37 | def mapping = provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping
38 | mapping.@vcs = 'Git'
39 | mapping.@directory = '$PROJECT_DIR$'
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/contents/20161012-native-query/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE"
7 | }
8 | }
9 |
10 | def vJavaLang = 1.8
11 |
12 | apply plugin: 'java'
13 | apply plugin: 'idea'
14 | apply plugin: 'spring-boot'
15 |
16 | repositories {
17 | jcenter()
18 | }
19 |
20 | dependencies {
21 | compile "org.projectlombok:lombok:1.16.2"
22 | compile "org.springframework.boot:spring-boot-starter-web"
23 | compile "org.springframework.boot:spring-boot-starter-thymeleaf"
24 | compile "org.springframework.boot:spring-boot-starter-data-jpa"
25 | compile "com.h2database:h2"
26 | testCompile "org.springframework.boot:spring-boot-starter-test"
27 | }
28 |
29 | idea {
30 | module {
31 | inheritOutputDirs = false
32 | }
33 | project {
34 | languageLevel = vJavaLang
35 | ipr {
36 | withXml { provider ->
37 | def mapping = provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping
38 | mapping.@vcs = 'Git'
39 | mapping.@directory = '$PROJECT_DIR$'
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/contents/20160405-javassist/src/test/java/com/example/spring/service/NormalTests.java:
--------------------------------------------------------------------------------
1 | package com.example.spring.service;
2 |
3 | import com.example.spring.domain.Os;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.junit.Test;
6 |
7 | import java.lang.annotation.Annotation;
8 | import java.lang.reflect.Field;
9 |
10 | /*
11 | * Os class is modified by ClassDefinitionModifier when Spring Context is prepared,
12 | * so any test case classes using modified classes should launch after that.
13 | * When this class is run as a pure JUnit test case, the tests will fail due to javassist.CannotCompileException.
14 | * To avoid this issue, this class extends a custom base test class EmptySpringApplicationTests
15 | * which is annotated with SpringApplicationConfiguration and has no auto-configuration to be launched quickly.
16 | */
17 | @Slf4j
18 | public class NormalTests extends EmptySpringApplicationTests {
19 | @Test
20 | public void test() throws Exception {
21 | Os os = new Os();
22 |
23 | Field field = Os.class.getDeclaredField("foo");
24 | for (Annotation annotation : field.getDeclaredAnnotations()) {
25 | log.info("foo: annotated with: {}", annotation.annotationType().getCanonicalName());
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/contents/20160720-query-validation/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE"
7 | }
8 | }
9 |
10 | def vJavaLang = 1.8
11 |
12 | apply plugin: 'java'
13 | apply plugin: 'idea'
14 | apply plugin: 'spring-boot'
15 |
16 | repositories {
17 | jcenter()
18 | }
19 |
20 | dependencies {
21 | compile "org.projectlombok:lombok:1.16.2"
22 | compile "org.springframework.boot:spring-boot-starter-web"
23 | compile "org.springframework.boot:spring-boot-starter-thymeleaf"
24 | compile "org.springframework.boot:spring-boot-starter-data-jpa"
25 | compile "com.h2database:h2"
26 | testCompile "org.springframework.boot:spring-boot-starter-test"
27 | }
28 |
29 | idea {
30 | module {
31 | inheritOutputDirs = false
32 | }
33 | project {
34 | languageLevel = vJavaLang
35 | ipr {
36 | withXml { provider ->
37 | def mapping = provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping
38 | mapping.@vcs = 'Git'
39 | mapping.@directory = '$PROJECT_DIR$'
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------