├── web-service
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── webservice
│ │ │ ├── services
│ │ │ ├── HelloWebService.java
│ │ │ └── impl
│ │ │ │ └── HelloWebServiceImpl.java
│ │ │ └── WebServiceApplication.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── webservice
│ │ └── WebServiceApplicationTests.java
└── pom.xml
├── .gitignore
├── aop
├── src
│ └── main
│ │ ├── resources
│ │ └── application.properties
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── aop
│ │ ├── AopApplication.java
│ │ ├── controller
│ │ └── AopController.java
│ │ └── aop
│ │ └── BrokerAspect.java
└── pom.xml
├── release-getting-started
├── src
│ └── main
│ │ ├── resources
│ │ └── application.properties
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasegettingstarted
│ │ ├── ReleaseGettingStartedApplication.java
│ │ └── controller
│ │ └── HelloRestController.java
└── pom.xml
├── actuator
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── actuator
│ │ │ └── ActuatorApplication.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── actuator
│ │ └── ActuatorApplicationTests.java
└── pom.xml
├── helloworld
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ └── templates
│ │ │ │ └── greeting.html
│ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── davidji80
│ │ │ └── springboot
│ │ │ └── helloworld
│ │ │ ├── HelloworldApplication.java
│ │ │ ├── controller
│ │ │ ├── HelloJsonController.java
│ │ │ ├── ThymeleafController.java
│ │ │ └── HelloWorldController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ └── config
│ │ │ └── WebConfiguration.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── davidji80
│ │ └── springboot
│ │ └── helloworld
│ │ ├── HelloworldApplicationTests.java
│ │ └── controller
│ │ └── HelloWorldControlerTests.java
└── pom.xml
├── neo4j
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── davidji80
│ │ └── springboot
│ │ └── neo4j
│ │ ├── dao
│ │ ├── MovieRepository.java
│ │ ├── PersonRepository.java
│ │ ├── ActedInRepository.java
│ │ └── DirectedRepository.java
│ │ ├── Neo4jApplication.java
│ │ ├── service
│ │ ├── MovieServer.java
│ │ └── impl
│ │ │ └── MovieServiceImpl.java
│ │ ├── model
│ │ ├── Person.java
│ │ ├── Directed.java
│ │ ├── Movie.java
│ │ └── ActedIn.java
│ │ └── controller
│ │ └── MovieController.java
└── pom.xml
├── release-webmvc
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.properties
│ │ ├── static
│ │ │ └── springboot.jpg
│ │ └── templates
│ │ │ ├── index.html
│ │ │ └── freemarker
│ │ │ └── index.ftl
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasewebmvc
│ │ ├── configurer
│ │ ├── RMWebMvcConfigurer.java
│ │ ├── HessianServiceConfigurer.java
│ │ └── HttpInvokerServerConfigurer.java
│ │ ├── ReleaseWebmvcApplication.java
│ │ ├── controllers
│ │ ├── freemarker
│ │ │ └── HelloFreeMarkerController.java
│ │ └── UserRestController.java
│ │ ├── dto
│ │ └── User.java
│ │ └── services
│ │ └── impl
│ │ └── AccountServiceImpl.java
└── pom.xml
├── release-atomikos
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releaseatomikos
│ │ │ ├── services
│ │ │ ├── AccountService.java
│ │ │ └── impl
│ │ │ │ └── AccountServiceImpl.java
│ │ │ ├── ReleaseAtomikosApplication.java
│ │ │ ├── entities
│ │ │ └── Account.java
│ │ │ ├── controllers
│ │ │ └── AccountController.java
│ │ │ └── config
│ │ │ ├── JdbcTemplateDataSourceConfig.java
│ │ │ └── DataSourceConfig.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releaseatomikos
│ │ └── ReleaseAtomikosApplicationTests.java
└── pom.xml
├── release-nosql-mongodb
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── mongodb
│ │ │ ├── repository
│ │ │ └── AccountRepository.java
│ │ │ ├── MongodbApplication.java
│ │ │ ├── dto
│ │ │ └── Account.java
│ │ │ └── controllers
│ │ │ ├── AccountController.java
│ │ │ └── AccountRepositoryController.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── mongodb
│ │ └── MongodbApplicationTests.java
└── pom.xml
├── release-quartz
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releasequartz
│ │ │ ├── ReleaseQuartzApplication.java
│ │ │ └── schedulers
│ │ │ └── RandomJob.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasequartz
│ │ └── ReleaseQuartzApplicationTests.java
└── pom.xml
├── release-cache
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── davidji80
│ │ └── springboot
│ │ └── redis
│ │ ├── CacheApplication.java
│ │ ├── controller
│ │ └── CacheController.java
│ │ └── service
│ │ └── CacheService.java
└── pom.xml
├── release-session
├── src
│ └── main
│ │ ├── resources
│ │ └── application.properties
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasesession
│ │ ├── ReleaseSessionApplication.java
│ │ └── controllers
│ │ └── IndexController.java
└── pom.xml
├── release-ms-kafka
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releasekafka
│ │ │ ├── ReleaseKafkaApplication.java
│ │ │ ├── kafkabeans
│ │ │ ├── KafkaListenerBean.java
│ │ │ └── KafkaProducerBean.java
│ │ │ ├── controllers
│ │ │ └── SendMessageController.java
│ │ │ └── config
│ │ │ └── KafkaStreamsExampleConfiguration.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasekafka
│ │ └── ReleaseKafkaApplicationTests.java
└── pom.xml
├── release-ms-rabbitmq
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releaserabbitmq
│ │ │ ├── amqp
│ │ │ ├── AmqpConsumer.java
│ │ │ └── AmqpProducer.java
│ │ │ ├── ReleaseRabbitmqApplication.java
│ │ │ └── controllers
│ │ │ └── RabbitMQController.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releaserabbitmq
│ │ └── ReleaseRabbitmqApplicationTests.java
└── pom.xml
├── release-ms-activemq
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releaseactivemq
│ │ │ ├── jms
│ │ │ ├── JmsConsumer.java
│ │ │ └── JmsProducer.java
│ │ │ ├── ReleaseActivemqApplication.java
│ │ │ ├── config
│ │ │ └── ActiveMQConfig.java
│ │ │ └── controllers
│ │ │ └── JmsController.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releaseactivemq
│ │ └── ReleaseActivemqApplicationTests.java
└── pom.xml
├── rabbitmq
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── davidji80
│ │ └── springboot
│ │ └── rabbitmq
│ │ ├── config
│ │ └── RabbitMQConfig.java
│ │ ├── RabbitmqApplication.java
│ │ ├── consumer
│ │ └── MqReceiver.java
│ │ ├── producer
│ │ └── MqSender.java
│ │ └── controller
│ │ └── MqController.java
└── pom.xml
├── release-sql-jdbc
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releasesqljdbc
│ │ │ ├── services
│ │ │ ├── AccountService.java
│ │ │ └── impl
│ │ │ │ └── AccountServiceImpl.java
│ │ │ ├── ReleaseSqlJdbcApplication.java
│ │ │ ├── entities
│ │ │ └── Account.java
│ │ │ └── controllers
│ │ │ └── AccountController.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasesqljdbc
│ │ └── ReleaseSqlJdbcApplicationTests.java
└── pom.xml
├── release-sql-jooq
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.properties
│ │ └── generator
│ │ │ └── JooqConfig.xml
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasesqljooq
│ │ ├── ReleaseSqlJooqApplication.java
│ │ ├── services
│ │ ├── AccountService.java
│ │ └── impl
│ │ │ └── AccountServiceImpl.java
│ │ ├── generated
│ │ ├── Tables.java
│ │ ├── DefaultCatalog.java
│ │ ├── Test01.java
│ │ ├── tables
│ │ │ ├── pojos
│ │ │ │ └── Account.java
│ │ │ ├── daos
│ │ │ │ └── AccountDao.java
│ │ │ ├── records
│ │ │ │ └── AccountRecord.java
│ │ │ └── TAccount.java
│ │ └── Keys.java
│ │ └── controllers
│ │ └── AccountController.java
└── pom.xml
├── release-sql-jpa
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── net
│ │ │ └── tongark
│ │ │ └── springboot
│ │ │ └── releasesqljpa
│ │ │ ├── services
│ │ │ └── AccountRepository.java
│ │ │ ├── ReleaseSqlJpaApplication.java
│ │ │ ├── entities
│ │ │ └── Account.java
│ │ │ └── controllers
│ │ │ └── AccountController.java
│ └── test
│ │ └── java
│ │ └── net
│ │ └── tongark
│ │ └── springboot
│ │ └── releasesqljpa
│ │ └── ReleaseSqlJpaApplicationTests.java
└── pom.xml
├── release-nosql-elasticsearch
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── github
│ │ └── davidji80
│ │ └── springboot
│ │ └── elasticsearch
│ │ ├── dao
│ │ └── EmployeeRepository.java
│ │ ├── ElasticsearchApplication.java
│ │ ├── entity
│ │ └── Employee.java
│ │ └── controller
│ │ └── EmployeeController.java
└── pom.xml
├── mahout
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── github
│ │ └── davidji80
│ │ └── springboot
│ │ └── mahout
│ │ ├── service
│ │ ├── UserService.java
│ │ ├── MovieService.java
│ │ └── impl
│ │ │ ├── UserServiceImpl.java
│ │ │ └── MovieServiceImpl.java
│ │ ├── MahoutApplication.java
│ │ ├── mapper
│ │ ├── UserMapper.java
│ │ └── MovieMapper.java
│ │ ├── model
│ │ ├── Movie.java
│ │ └── User.java
│ │ ├── config
│ │ └── MahoutConfig.java
│ │ ├── controller
│ │ └── MovieRecommenderController.java
│ │ └── recommender
│ │ └── MovieRecommender.java
│ └── resources
│ ├── application.yml
│ ├── templates
│ ├── userlist.html
│ └── recommendlist.html
│ ├── mybatisgenerator
│ └── generatorConfig.xml
│ └── mapping
│ ├── MovieMapper.xml
│ └── UserMapper.xml
├── mybatis
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── davidji80
│ │ │ └── springboot
│ │ │ └── mybatis
│ │ │ ├── esdao
│ │ │ └── UserRepository.java
│ │ │ ├── service
│ │ │ ├── UserService.java
│ │ │ └── impl
│ │ │ │ └── UserServiceImpl.java
│ │ │ ├── mapper
│ │ │ ├── AccountMapper.java
│ │ │ └── UserMapper.java
│ │ │ ├── model
│ │ │ ├── Account.java
│ │ │ └── User.java
│ │ │ ├── MybatisApplication.java
│ │ │ └── controller
│ │ │ └── UserController.java
│ │ └── resources
│ │ ├── application.yml
│ │ ├── generator
│ │ └── generatorConfig.xml
│ │ └── mapping
│ │ ├── AccountMapper.xml
│ │ └── UserMapper.xml
└── pom.xml
└── pom.xml
/web-service/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /*.iml
2 | /*/*.iml
3 | /*/target/*
4 | /.idea/*
5 |
--------------------------------------------------------------------------------
/aop/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=3201
2 |
--------------------------------------------------------------------------------
/release-getting-started/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=11001
--------------------------------------------------------------------------------
/actuator/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavidJi80/springboot/HEAD/actuator/src/main/resources/application.properties
--------------------------------------------------------------------------------
/helloworld/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavidJi80/springboot/HEAD/helloworld/src/main/resources/application.properties
--------------------------------------------------------------------------------
/neo4j/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | data:
3 | neo4j:
4 | uri: bolt://192.168.1.8:7687
5 | username: neo4j
6 | password: 123456
--------------------------------------------------------------------------------
/release-webmvc/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavidJi80/springboot/HEAD/release-webmvc/src/main/resources/application.properties
--------------------------------------------------------------------------------
/release-webmvc/src/main/resources/static/springboot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavidJi80/springboot/HEAD/release-webmvc/src/main/resources/static/springboot.jpg
--------------------------------------------------------------------------------
/release-atomikos/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavidJi80/springboot/HEAD/release-atomikos/src/main/resources/application.properties
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavidJi80/springboot/HEAD/release-nosql-mongodb/src/main/resources/application.properties
--------------------------------------------------------------------------------
/release-quartz/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.task.execution.pool.core-size=16
2 | spring.task.execution.pool.queue-capacity=100
3 | spring.task.execution.pool.keep-alive=10s
--------------------------------------------------------------------------------
/release-cache/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cache:
3 | type: redis
4 | redis:
5 | database: 10
6 | host: 192.168.1.8
7 | port: 6379
8 | server:
9 | port: 13000
--------------------------------------------------------------------------------
/release-session/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=24000
2 |
3 | spring.session.store-type=redis
4 |
5 | spring.redis.host=192.168.1.8
6 | spring.redis.port=6379
7 | spring.redis.database=8
--------------------------------------------------------------------------------
/release-ms-kafka/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.application.name=Boot Kafka
2 | server.port=16300
3 | #Kafkaf
4 | spring.kafka.bootstrap-servers=192.168.1.7:9092
5 | spring.kafka.consumer.group-id=myGroup
--------------------------------------------------------------------------------
/release-ms-rabbitmq/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.rabbitmq.host=192.168.1.8
2 | spring.rabbitmq.port=5672
3 | spring.rabbitmq.username=rabbitadmin
4 | spring.rabbitmq.password=123456
5 |
6 | server.port=16200
--------------------------------------------------------------------------------
/release-webmvc/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Title
6 |
7 |
8 | Welcome Page
9 |
10 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=16100
2 |
3 | spring.activemq.broker-url=tcp://192.168.1.7:61616
4 | spring.activemq.user=admin
5 | spring.activemq.password=admin
6 |
7 | spring.jms.cache.session-cache-size=5
--------------------------------------------------------------------------------
/rabbitmq/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: spring-boot-rabbitmq
4 | rabbitmq:
5 | host: 192.168.1.8
6 | port: 5672
7 | username: rabbitadmin
8 | password: 123456
9 | virtual-host: demo
10 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/resources/templates/freemarker/index.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | hello,${var},with java config
9 |
10 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://192.168.1.7:3306/test01
2 | spring.datasource.username=xhsit
3 | spring.datasource.password=sit1818
4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver
5 |
6 | server.port=15100
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://192.168.1.7:3306/test01
2 | spring.datasource.username=xhsit
3 | spring.datasource.password=sit1818
4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver
5 |
6 | server.port=15300
--------------------------------------------------------------------------------
/release-sql-jpa/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.datasource.url=jdbc:mysql://192.168.1.7:3306/test01
2 | spring.datasource.username=xhsit
3 | spring.datasource.password=sit1818
4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver
5 |
6 | server.port=15200
7 |
--------------------------------------------------------------------------------
/release-nosql-elasticsearch/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | data:
3 | elasticsearch:
4 | cluster-name: docker-cluster
5 | #必须和ES服务器配置文件config\elasticsearch.yml中的cluster.name一致
6 | cluster-nodes: 192.168.1.8:19300
7 | repositories:
8 | enabled: true
9 | server:
10 | port: 14500
--------------------------------------------------------------------------------
/web-service/src/main/java/net/tongark/springboot/webservice/services/HelloWebService.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.webservice.services;
2 |
3 | import javax.jws.WebMethod;
4 | import javax.jws.WebService;
5 |
6 | @WebService
7 | public interface HelloWebService {
8 | @WebMethod
9 | String sayHello(String name);
10 | }
11 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.service;
2 |
3 | import com.github.davidji80.springboot.mahout.model.User;
4 |
5 | import java.util.List;
6 |
7 | public interface UserService {
8 | List queryUsersBySql(int currPage, int pageSize);
9 | }
10 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/dao/MovieRepository.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.dao;
2 |
3 | import com.github.davidji80.springboot.neo4j.model.Movie;
4 | import org.springframework.data.neo4j.repository.Neo4jRepository;
5 |
6 | public interface MovieRepository extends Neo4jRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/dao/PersonRepository.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.dao;
2 |
3 | import com.github.davidji80.springboot.neo4j.model.Person;
4 | import org.springframework.data.neo4j.repository.Neo4jRepository;
5 |
6 | public interface PersonRepository extends Neo4jRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/dao/ActedInRepository.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.dao;
2 |
3 | import com.github.davidji80.springboot.neo4j.model.ActedIn;
4 | import org.springframework.data.neo4j.repository.Neo4jRepository;
5 |
6 | public interface ActedInRepository extends Neo4jRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/main/java/net/tongark/springboot/mongodb/repository/AccountRepository.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.mongodb.repository;
2 |
3 | import net.tongark.springboot.mongodb.dto.Account;
4 | import org.springframework.data.mongodb.repository.MongoRepository;
5 |
6 | public interface AccountRepository extends MongoRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/actuator/src/test/java/net/tongark/springboot/actuator/ActuatorApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.actuator;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ActuatorApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/main/java/net/tongark/springboot/releasesqljdbc/services/AccountService.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljdbc.services;
2 |
3 | import net.tongark.springboot.releasesqljdbc.entities.Account;
4 |
5 | import java.util.List;
6 |
7 | public interface AccountService {
8 | List findAll();
9 | void addAccount(Account account);
10 | }
11 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/dao/DirectedRepository.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.dao;
2 |
3 | import com.github.davidji80.springboot.neo4j.model.Directed;
4 | import org.springframework.data.neo4j.repository.Neo4jRepository;
5 |
6 | public interface DirectedRepository extends Neo4jRepository {
7 |
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/test/java/net/tongark/springboot/mongodb/MongodbApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.mongodb;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class MongodbApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/services/AccountService.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos.services;
2 |
3 |
4 | import net.tongark.springboot.releaseatomikos.entities.Account;
5 |
6 | import java.util.List;
7 |
8 | public interface AccountService {
9 | List findAll();
10 | void addAccount(Account account);
11 | }
12 |
--------------------------------------------------------------------------------
/web-service/src/test/java/net/tongark/springboot/webservice/WebServiceApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.webservice;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class WebServiceApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/helloworld/src/main/resources/templates/greeting.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Getting Started: Serving Web Content
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/release-ms-kafka/src/test/java/net/tongark/springboot/releasekafka/ReleaseKafkaApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasekafka;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseKafkaApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/configurer/RMWebMvcConfigurer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.configurer;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
5 |
6 | @Configuration
7 | public class RMWebMvcConfigurer implements WebMvcConfigurer {
8 | }
9 |
--------------------------------------------------------------------------------
/release-quartz/src/test/java/net/tongark/springboot/releasequartz/ReleaseQuartzApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasequartz;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseQuartzApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-sql-jpa/src/test/java/net/tongark/springboot/releasesqljpa/ReleaseSqlJpaApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljpa;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseSqlJpaApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/test/java/net/tongark/springboot/releasesqljdbc/ReleaseSqlJdbcApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljdbc;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseSqlJdbcApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-atomikos/src/test/java/net/tongark/springboot/releaseatomikos/ReleaseAtomikosApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseAtomikosApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/test/java/net/tongark/springboot/releaseactivemq/ReleaseActivemqApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseactivemq;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseActivemqApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-ms-rabbitmq/src/test/java/net/tongark/springboot/releaserabbitmq/ReleaseRabbitmqApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaserabbitmq;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ReleaseRabbitmqApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/aop/src/main/java/net/tongark/springboot/aop/AopApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.aop;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class AopApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(AopApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/esdao/UserRepository.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.esdao;
2 |
3 | import com.github.davidji80.springboot.mybatis.model.User;
4 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
5 | import org.springframework.stereotype.Component;
6 |
7 | @Component
8 | public interface UserRepository extends ElasticsearchRepository {
9 | }
10 |
--------------------------------------------------------------------------------
/actuator/src/main/java/net/tongark/springboot/actuator/ActuatorApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.actuator;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ActuatorApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ActuatorApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.github.davidji80
8 | springboot
9 | 1.0-SNAPSHOT
10 |
--------------------------------------------------------------------------------
/release-sql-jpa/src/main/java/net/tongark/springboot/releasesqljpa/services/AccountRepository.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljpa.services;
2 |
3 | import net.tongark.springboot.releasesqljpa.entities.Account;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | /**
7 | * 继承了JpaRepository,
8 | * 由于只是介绍了jpa的简单功能,所以JpaRepository中内置的方法已经足够使用
9 | */
10 | public interface AccountRepository extends JpaRepository {
11 | }
12 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.service;
2 |
3 | import com.github.davidji80.springboot.mybatis.model.User;
4 |
5 | public interface UserService {
6 | User addUser(User user);
7 |
8 | User findUserByID(int id);
9 |
10 | User findUserByPhone(String phone);
11 |
12 | User updateUserByID(User user);
13 |
14 | void deleteUserByID(int id);
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/release-nosql-elasticsearch/src/main/java/com/github/davidji80/springboot/elasticsearch/dao/EmployeeRepository.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.elasticsearch.dao;
2 |
3 | import com.github.davidji80.springboot.elasticsearch.entity.Employee;
4 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
5 |
6 | public interface EmployeeRepository extends ElasticsearchRepository {
7 | Employee queryEmployeeById(String id);
8 | }
9 |
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/main/java/net/tongark/springboot/mongodb/MongodbApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.mongodb;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class MongodbApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(MongodbApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/service/MovieService.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.service;
2 |
3 | import com.github.davidji80.springboot.mahout.model.Movie;
4 |
5 | import java.util.List;
6 |
7 | public interface MovieService {
8 | List queryLookedMoviesByUser(int userID);
9 | List recommendMoviesBasedUser(int userID,int size);
10 | List recommendMoviesBasedItem(int userID,int size);
11 | }
12 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/main/java/net/tongark/springboot/releaseactivemq/jms/JmsConsumer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseactivemq.jms;
2 |
3 | import org.springframework.jms.annotation.JmsListener;
4 | import org.springframework.stereotype.Component;
5 |
6 | @Component
7 | public class JmsConsumer {
8 | @JmsListener(destination = "test")
9 | public void processMessage(String content) {
10 | System.out.println("Consumer:"+content);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/com/github/davidji80/springboot/rabbitmq/config/RabbitMQConfig.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.rabbitmq.config;
2 |
3 | import org.springframework.amqp.core.Queue;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | @Configuration
8 | public class RabbitMQConfig {
9 | @Bean
10 | public Queue helloQueue() {
11 | return new Queue("queue-demo");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/release-ms-rabbitmq/src/main/java/net/tongark/springboot/releaserabbitmq/amqp/AmqpConsumer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaserabbitmq.amqp;
2 |
3 | import org.springframework.amqp.rabbit.annotation.RabbitListener;
4 | import org.springframework.stereotype.Component;
5 |
6 | @Component
7 | public class AmqpConsumer {
8 | @RabbitListener(queues = "789")
9 | public void processMessage(String content) {
10 | System.out.println("Consumer:"+content);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/release-sql-jpa/src/main/java/net/tongark/springboot/releasesqljpa/ReleaseSqlJpaApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljpa;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ReleaseSqlJpaApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ReleaseSqlJpaApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/ReleaseWebmvcApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ReleaseWebmvcApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ReleaseWebmvcApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/ReleaseSqlJooqApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljooq;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ReleaseSqlJooqApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ReleaseSqlJooqApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/helloworld/src/main/java/com/github/davidji80/springboot/helloworld/HelloworldApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld;
2 |
3 |
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 | @SpringBootApplication
8 | public class HelloworldApplication {
9 |
10 |
11 | public static void main(String[] args) {
12 |
13 | SpringApplication.run(HelloworldApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/main/java/net/tongark/springboot/releaseactivemq/ReleaseActivemqApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseactivemq;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ReleaseActivemqApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ReleaseActivemqApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-ms-rabbitmq/src/main/java/net/tongark/springboot/releaserabbitmq/ReleaseRabbitmqApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaserabbitmq;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ReleaseRabbitmqApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ReleaseRabbitmqApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/release-nosql-elasticsearch/src/main/java/com/github/davidji80/springboot/elasticsearch/ElasticsearchApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.elasticsearch;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ElasticsearchApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ElasticsearchApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/helloworld/src/test/java/com/github/davidji80/springboot/helloworld/HelloworldApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class HelloworldApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/main/java/net/tongark/springboot/releaseactivemq/config/ActiveMQConfig.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseactivemq.config;
2 |
3 | import javax.jms.Queue;
4 |
5 | import org.apache.activemq.command.ActiveMQQueue;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | @Configuration
10 | public class ActiveMQConfig {
11 | @Bean
12 | public Queue testQueue(){
13 | return new ActiveMQQueue("test");
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/web-service/src/main/java/net/tongark/springboot/webservice/services/impl/HelloWebServiceImpl.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.webservice.services.impl;
2 |
3 | import net.tongark.springboot.webservice.services.HelloWebService;
4 |
5 | import javax.jws.WebService;
6 |
7 | @WebService
8 | public class HelloWebServiceImpl implements HelloWebService {
9 | @Override
10 | public String sayHello(String name) {
11 | String said = name + ",Hello~~";
12 | System.out.println(said);
13 | return said;
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/release-ms-kafka/src/main/java/net/tongark/springboot/releasekafka/ReleaseKafkaApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasekafka;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.kafka.annotation.EnableKafka;
6 |
7 | @SpringBootApplication
8 | public class ReleaseKafkaApplication {
9 |
10 | public static void main(String[] args) {
11 | SpringApplication.run(ReleaseKafkaApplication.class, args);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/services/AccountService.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljooq.services;
2 |
3 | import net.tongark.springboot.releasesqljooq.generated.tables.pojos.Account;
4 |
5 | import java.util.List;
6 |
7 | public interface AccountService {
8 | //C
9 | public void add(Account account);
10 |
11 | //R
12 | public List findAll();
13 |
14 | //U
15 | public int update(Account account);
16 |
17 | //D
18 | public void delete(int id);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/mapper/AccountMapper.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.mapper;
2 |
3 | import com.github.davidji80.springboot.mybatis.model.Account;
4 |
5 | public interface AccountMapper {
6 | int deleteByPrimaryKey(Integer id);
7 |
8 | int insert(Account record);
9 |
10 | int insertSelective(Account record);
11 |
12 | Account selectByPrimaryKey(Integer id);
13 |
14 | int updateByPrimaryKeySelective(Account record);
15 |
16 | int updateByPrimaryKey(Account record);
17 | }
--------------------------------------------------------------------------------
/release-cache/src/main/java/com/github/davidji80/springboot/redis/CacheApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.redis;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cache.annotation.EnableCaching;
6 |
7 | @SpringBootApplication
8 | @EnableCaching //启用缓存
9 | public class CacheApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(CacheApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/Neo4jApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
6 |
7 | @SpringBootApplication
8 | @EnableNeo4jRepositories
9 | public class Neo4jApplication {
10 | public static void main(String[] args) {
11 | SpringApplication.run(Neo4jApplication.class, args);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/model/Account.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.model;
2 |
3 | public class Account {
4 | private Integer id;
5 |
6 | private String name;
7 |
8 | public Integer getId() {
9 | return id;
10 | }
11 |
12 | public void setId(Integer id) {
13 | this.id = id;
14 | }
15 |
16 | public String getName() {
17 | return name;
18 | }
19 |
20 | public void setName(String name) {
21 | this.name = name == null ? null : name.trim();
22 | }
23 | }
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/MahoutApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 | @SpringBootApplication
8 | @MapperScan("com.github.davidji80.springboot.mahout.mapper")
9 | public class MahoutApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(MahoutApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/release-quartz/src/main/java/net/tongark/springboot/releasequartz/ReleaseQuartzApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasequartz;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.scheduling.annotation.EnableScheduling;
6 |
7 | @SpringBootApplication
8 | @EnableScheduling
9 | public class ReleaseQuartzApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(ReleaseQuartzApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/Tables.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated;
5 |
6 |
7 | import net.tongark.springboot.releasesqljooq.generated.tables.TAccount;
8 |
9 |
10 | /**
11 | * Convenience access to all tables in test01
12 | */
13 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
14 | public class Tables {
15 |
16 | /**
17 | * The table test01.t_account.
18 | */
19 | public static final TAccount T_ACCOUNT = TAccount.T_ACCOUNT;
20 | }
21 |
--------------------------------------------------------------------------------
/release-getting-started/src/main/java/net/tongark/springboot/releasegettingstarted/ReleaseGettingStartedApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasegettingstarted;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ReleaseGettingStartedApplication {
8 |
9 | //main方法,委托Spring Boot的SpringApplication类调用run方法来启动本Application
10 | public static void main(String[] args) {
11 | SpringApplication.run(ReleaseGettingStartedApplication.class, args);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/main/java/net/tongark/springboot/releasesqljdbc/ReleaseSqlJdbcApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljdbc;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.transaction.annotation.EnableTransactionManagement;
6 |
7 | @SpringBootApplication
8 | @EnableTransactionManagement
9 | public class ReleaseSqlJdbcApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(ReleaseSqlJdbcApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/mahout/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 |
4 | spring:
5 | thymeleaf:
6 | prefix: classpath:/templates/
7 | suffix: .html
8 | mode: HTML5
9 | encoding: utf-8
10 | cache: false
11 | datasource:
12 | name: test
13 | url: jdbc:mysql://192.168.1.7:3306/mahout?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
14 | username: xhsit
15 | password: sit1818
16 | driver-class-name: com.mysql.jdbc.Driver
17 |
18 | mybatis:
19 | type-aliases-package: com.github.davidji80.springboot.mahout.model
20 | mapper-locations: classpath:mapping/**/*.xml
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/com/github/davidji80/springboot/rabbitmq/RabbitmqApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.rabbitmq;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.context.annotation.ComponentScan;
6 |
7 | @SpringBootApplication
8 | @ComponentScan(basePackages = {"com.github.davidji80.springboot.rabbitmq"})
9 | public class RabbitmqApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(RabbitmqApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/com/github/davidji80/springboot/rabbitmq/consumer/MqReceiver.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.rabbitmq.consumer;
2 |
3 | import org.springframework.amqp.rabbit.annotation.RabbitHandler;
4 | import org.springframework.amqp.rabbit.annotation.RabbitListener;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.Date;
8 |
9 | @Component
10 | @RabbitListener(queues = "queue-demo")
11 | public class MqReceiver {
12 |
13 | @RabbitHandler
14 | public void process(String hello) {
15 | System.out.println("Receiver:"+new Date()+" "+hello);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/ReleaseAtomikosApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.transaction.annotation.EnableTransactionManagement;
6 |
7 | @SpringBootApplication
8 | @EnableTransactionManagement
9 | public class ReleaseAtomikosApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(ReleaseAtomikosApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/release-session/src/main/java/net/tongark/springboot/releasesession/ReleaseSessionApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesession;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
6 |
7 | @SpringBootApplication
8 | @EnableRedisHttpSession
9 | public class ReleaseSessionApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(ReleaseSessionApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/main/java/net/tongark/springboot/releaseactivemq/jms/JmsProducer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseactivemq.jms;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.jms.core.JmsTemplate;
5 | import org.springframework.stereotype.Component;
6 |
7 | import javax.jms.Queue;
8 |
9 | @Component
10 | public class JmsProducer {
11 | @Autowired
12 | private JmsTemplate jmsTemplate;
13 |
14 | @Autowired
15 | private Queue queue;
16 |
17 | public void send(String message){
18 | jmsTemplate.convertAndSend(queue,message);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/release-ms-kafka/src/main/java/net/tongark/springboot/releasekafka/kafkabeans/KafkaListenerBean.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasekafka.kafkabeans;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.kafka.annotation.KafkaListener;
6 | import org.springframework.stereotype.Component;
7 |
8 | @Component
9 | public class KafkaListenerBean {
10 | protected final Logger logger = LoggerFactory.getLogger(this.getClass());
11 |
12 | @KafkaListener(topics = "test")
13 | public void processMessage(String content) {
14 | logger.info("kafka message: " + content);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.mapper;
2 |
3 | import com.github.davidji80.springboot.mybatis.model.User;
4 | import org.springframework.cache.annotation.CachePut;
5 |
6 | public interface UserMapper {
7 | int deleteByPrimaryKey(Integer userId);
8 |
9 | int insert(User record);
10 |
11 | int insertSelective(User record);
12 |
13 | User selectByPrimaryKey(Integer userId);
14 |
15 | int updateByPrimaryKeySelective(User record);
16 |
17 | int updateByPrimaryKey(User record);
18 |
19 | User selectByMobile(String phone);
20 | }
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/controllers/freemarker/HelloFreeMarkerController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.controllers.freemarker;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | @RequestMapping("/freemarker")
9 | public class HelloFreeMarkerController {
10 |
11 | @RequestMapping("/hello")
12 | public String index(ModelMap modelMap){
13 | modelMap.addAttribute("var","FreeMarker");
14 | return "freemarker/index";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/helloworld/src/main/java/com/github/davidji80/springboot/helloworld/controller/HelloJsonController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld.controller;
2 |
3 | import com.github.davidji80.springboot.helloworld.domain.User;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | @RestController
8 | public class HelloJsonController {
9 |
10 | @RequestMapping("/getUser")
11 | public User getUser() {
12 |
13 | User user=new User();
14 | user.setUserName("小明");
15 | user.setPassword("xxxx");
16 | return user;
17 | }
18 | }
--------------------------------------------------------------------------------
/helloworld/src/main/java/com/github/davidji80/springboot/helloworld/controller/ThymeleafController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 | import org.springframework.web.servlet.ModelAndView;
6 |
7 | @RestController
8 | public class ThymeleafController {
9 |
10 | @RequestMapping(value = "/greeting")
11 | public ModelAndView test(ModelAndView mv) {
12 | mv.setViewName("/greeting");
13 | mv.addObject("title","欢迎使用Thymeleaf!");
14 | return mv;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.mapper;
2 |
3 | import com.github.davidji80.springboot.mahout.model.User;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | public interface UserMapper {
9 | int deleteByPrimaryKey(Integer id);
10 |
11 | int insert(User record);
12 |
13 | int insertSelective(User record);
14 |
15 | User selectByPrimaryKey(Integer id);
16 |
17 | int updateByPrimaryKeySelective(User record);
18 |
19 | int updateByPrimaryKey(User record);
20 |
21 | List queryUsersBySql(Map data);
22 | }
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/dto/User.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.dto;
2 |
3 | public class User {
4 | private String name;
5 | private int age;
6 |
7 | public User(String name, int age) {
8 | this.name = name;
9 | this.age = age;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public void setName(String name) {
17 | this.name = name;
18 | }
19 |
20 | public int getAge() {
21 | return age;
22 | }
23 |
24 | public void setAge(int age) {
25 | this.age = age;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/main/java/net/tongark/springboot/releasesqljdbc/entities/Account.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljdbc.entities;
2 |
3 | public class Account {
4 | private int id;
5 | private String name;
6 |
7 | public Account() {
8 | }
9 |
10 | public Account(int id, String name) {
11 | this.id = id;
12 | this.name = name;
13 | }
14 |
15 | public int getId() {
16 | return id;
17 | }
18 |
19 | public void setId(int id) {
20 | this.id = id;
21 | }
22 |
23 | public String getName() {
24 | return name;
25 | }
26 |
27 | public void setName(String name) {
28 | this.name = name;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/entities/Account.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos.entities;
2 |
3 | public class Account {
4 | private int id;
5 | private String name;
6 |
7 | public Account() {
8 | }
9 |
10 | public Account(int id, String name) {
11 | this.id = id;
12 | this.name = name;
13 | }
14 |
15 | public int getId() {
16 | return id;
17 | }
18 |
19 | public void setId(int id) {
20 | this.id = id;
21 | }
22 |
23 | public String getName() {
24 | return name;
25 | }
26 |
27 | public void setName(String name) {
28 | this.name = name;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/release-ms-kafka/src/main/java/net/tongark/springboot/releasekafka/kafkabeans/KafkaProducerBean.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasekafka.kafkabeans;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.kafka.core.KafkaTemplate;
5 | import org.springframework.stereotype.Component;
6 |
7 | @Component
8 | public class KafkaProducerBean {
9 | private final KafkaTemplate kafkaTemplate;
10 |
11 | @Autowired
12 | public KafkaProducerBean(KafkaTemplate kafkaTemplate) {
13 | this.kafkaTemplate = kafkaTemplate;
14 | }
15 |
16 | public void send(String topic,String message) {
17 | this.kafkaTemplate.send(topic, message);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/service/MovieServer.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.service;
2 |
3 | import com.github.davidji80.springboot.neo4j.model.ActedIn;
4 | import com.github.davidji80.springboot.neo4j.model.Directed;
5 | import com.github.davidji80.springboot.neo4j.model.Movie;
6 | import com.github.davidji80.springboot.neo4j.model.Person;
7 |
8 | public interface MovieServer {
9 | Person addPerson(Person person);
10 | Person findOnePerson(long id);
11 | void deleteOnePerson(long id);
12 |
13 | Movie addMovie(Movie movie);
14 | Movie findOneMovie(long id);
15 |
16 | Directed directed(Directed directed);
17 | ActedIn actedIn(ActedIn actedIn);
18 | }
19 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/mapper/MovieMapper.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.mapper;
2 |
3 | import com.github.davidji80.springboot.mahout.model.Movie;
4 | import org.apache.ibatis.annotations.Param;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | public interface MovieMapper {
10 | int deleteByPrimaryKey(Integer id);
11 |
12 | int insert(Movie record);
13 |
14 | int insertSelective(Movie record);
15 |
16 | Movie selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(Movie record);
19 |
20 | int updateByPrimaryKey(Movie record);
21 |
22 | List queryMoviesBySql(Integer userid);
23 |
24 | List queryMoviesByIds(List ids);
25 | }
--------------------------------------------------------------------------------
/mybatis/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 13100
3 | spring:
4 | datasource:
5 | name: test
6 | url: jdbc:mysql://192.168.1.7:3306/test01?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
7 | username: xhsit
8 | password: sit1818
9 | driver-class-name: com.mysql.jdbc.Driver
10 | cache:
11 | type: redis
12 | redis:
13 | database: 1
14 | host: 192.168.1.7
15 | port: 6379
16 | data:
17 | elasticsearch:
18 | cluster-name: docker-cluster
19 | cluster-nodes: 192.168.1.8:9300
20 | repositories:
21 | enabled: true
22 |
23 | mybatis:
24 | type-aliases-package: com.github.davidji80.springboot.mybatis.model
25 | mapper-locations: classpath:mapping/**/*.xml
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/com/github/davidji80/springboot/rabbitmq/producer/MqSender.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.rabbitmq.producer;
2 |
3 | import org.springframework.amqp.core.AmqpTemplate;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.Date;
8 |
9 | @Component
10 | public class MqSender {
11 |
12 | @Autowired
13 | private AmqpTemplate rabbitTemplate;
14 |
15 | public String send(String name){
16 | String context="hello " + name + " --"+new Date();
17 | System.out.println("Sender: "+context);
18 | this.rabbitTemplate.convertAndSend("queue-demo",context);
19 | return context;
20 | }
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/release-ms-activemq/src/main/java/net/tongark/springboot/releaseactivemq/controllers/JmsController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseactivemq.controllers;
2 |
3 | import net.tongark.springboot.releaseactivemq.jms.JmsProducer;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.PathVariable;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | public class JmsController {
11 | @Autowired
12 | JmsProducer jmsProducer;
13 |
14 | @GetMapping("/send/{message}")
15 | public void send(@PathVariable String message){
16 | jmsProducer.send(message);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/com/github/davidji80/springboot/rabbitmq/controller/MqController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.rabbitmq.controller;
2 |
3 | import com.github.davidji80.springboot.rabbitmq.producer.MqSender;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | public class MqController {
11 |
12 |
13 | @Autowired
14 | private MqSender mqSender;
15 |
16 | @RequestMapping("/send/{name}")
17 | public String sendMsgToMq(@PathVariable String name) {
18 | return mqSender.send(name);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/release-quartz/src/main/java/net/tongark/springboot/releasequartz/schedulers/RandomJob.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasequartz.schedulers;
2 |
3 | import org.springframework.scheduling.annotation.Scheduled;
4 | import org.springframework.stereotype.Component;
5 |
6 | import java.util.Date;
7 | import java.util.Random;
8 |
9 | @Component
10 | public class RandomJob {
11 |
12 | @Scheduled(cron = "* * * * * ?")
13 | public void printRandomInt() {
14 | Random r = new Random();
15 | System.out.println(Thread.currentThread().getName() + " cron=* * * * * "+r.nextInt()+" --- " + new Date());
16 | try {
17 | Thread.sleep(2000);
18 | } catch (Exception e) {
19 | e.printStackTrace();
20 | }
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/model/Movie.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.model;
2 |
3 | public class Movie {
4 | private Integer id;
5 |
6 | private String title;
7 |
8 | private String genres;
9 |
10 | public Integer getId() {
11 | return id;
12 | }
13 |
14 | public void setId(Integer id) {
15 | this.id = id;
16 | }
17 |
18 | public String getTitle() {
19 | return title;
20 | }
21 |
22 | public void setTitle(String title) {
23 | this.title = title == null ? null : title.trim();
24 | }
25 |
26 | public String getGenres() {
27 | return genres;
28 | }
29 |
30 | public void setGenres(String genres) {
31 | this.genres = genres == null ? null : genres.trim();
32 | }
33 | }
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/MybatisApplication.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cache.annotation.EnableCaching;
7 | import org.springframework.transaction.annotation.EnableTransactionManagement;
8 |
9 | @SpringBootApplication
10 | //将项目中对应的mapper类的路径
11 | @MapperScan("com.github.davidji80.springboot.mybatis.mapper")
12 | //事务管理
13 | @EnableTransactionManagement
14 | //注解驱动的缓存管理功能
15 | @EnableCaching
16 | public class MybatisApplication {
17 |
18 | public static void main(String[] args) {
19 | SpringApplication.run(MybatisApplication.class, args);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aop/src/main/java/net/tongark/springboot/aop/controller/AopController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.aop.controller;
2 |
3 | import org.springframework.web.bind.annotation.PathVariable;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | @RestController
8 | @RequestMapping("/aopController")
9 | public class AopController {
10 | @RequestMapping(value = "/Curry")
11 | public void Curry(){
12 | System.out.println("库里上场打球了!!");
13 | }
14 |
15 | @RequestMapping(value = "/Harden")
16 | public void Harden(){
17 | System.out.println("哈登上场打球了!!");
18 | }
19 |
20 | @RequestMapping(value = "/Durant/{point}")
21 | public void Durant(@PathVariable("point") int point){
22 | System.out.println("杜兰特上场打球了!!");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/release-sql-jpa/src/main/java/net/tongark/springboot/releasesqljpa/entities/Account.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljpa.entities;
2 |
3 | import javax.persistence.*;
4 |
5 | @Entity
6 | @Table(name = "t_account")
7 | public class Account {
8 | @Id
9 | @GeneratedValue(strategy = GenerationType.IDENTITY)
10 | private Long id;
11 |
12 | @Column(nullable = false)
13 | private String name;
14 |
15 | public Account() {
16 | }
17 |
18 | public Account(Long id, String name) {
19 | this.id = id;
20 | this.name = name;
21 | }
22 |
23 | public Long getId() {
24 | return id;
25 | }
26 |
27 | public void setId(Long id) {
28 | this.id = id;
29 | }
30 |
31 | public String getName() {
32 | return name;
33 | }
34 |
35 | public void setName(String name) {
36 | this.name = name;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/services/impl/AccountServiceImpl.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.services.impl;
2 |
3 | import net.tongark.spring.webservice.account.Account;
4 | import net.tongark.spring.webservice.account.AccountService;
5 | import org.springframework.stereotype.Service;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | @Service
11 | public class AccountServiceImpl implements AccountService {
12 |
13 | @Override
14 | public void insertAccount(Account acc) {
15 | // do something...
16 | }
17 |
18 | @Override
19 | public List getAccounts() {
20 | List accounts = new ArrayList<>();
21 | Account account=new Account();
22 | account.setName("Spring Boot:David's Account");
23 | accounts.add(account);
24 | return accounts;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/model/Person.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.model;
2 |
3 | import org.neo4j.ogm.annotation.*;
4 |
5 | @NodeEntity(label = "Person")
6 | public class Person {
7 | @Id
8 | @GeneratedValue
9 | private Long nodeId;
10 |
11 | @Property(name = "name")
12 | private String name;
13 |
14 | @Property(name = "born")
15 | private int born;
16 |
17 | public Long getNodeId() {
18 | return nodeId;
19 | }
20 |
21 | public void setNodeId(Long nodeId) {
22 | this.nodeId = nodeId;
23 | }
24 |
25 |
26 | public String getName() {
27 | return name;
28 | }
29 |
30 | public void setName(String name) {
31 | this.name = name;
32 | }
33 |
34 | public int getBorn() {
35 | return born;
36 | }
37 |
38 | public void setBorn(int born) {
39 | this.born = born;
40 | }
41 | }
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/model/Directed.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.model;
2 |
3 | import org.neo4j.ogm.annotation.*;
4 |
5 | @RelationshipEntity(type = "DIRECTED")
6 | public class Directed {
7 | @Id
8 | @GeneratedValue
9 | private Long id;
10 |
11 | @StartNode
12 | private Person startNode;
13 |
14 | @EndNode
15 | private Movie endNode;
16 |
17 | public Long getId() {
18 | return id;
19 | }
20 |
21 | public void setId(Long id) {
22 | this.id = id;
23 | }
24 |
25 | public Person getStartNode() {
26 | return startNode;
27 | }
28 |
29 | public void setStartNode(Person startNode) {
30 | this.startNode = startNode;
31 | }
32 |
33 | public Movie getEndNode() {
34 | return endNode;
35 | }
36 |
37 | public void setEndNode(Movie endNode) {
38 | this.endNode = endNode;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/release-ms-rabbitmq/src/main/java/net/tongark/springboot/releaserabbitmq/controllers/RabbitMQController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaserabbitmq.controllers;
2 |
3 | import net.tongark.springboot.releaserabbitmq.amqp.AmqpProducer;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.PathVariable;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | public class RabbitMQController {
11 | @Autowired
12 | AmqpProducer amqpProducer;
13 |
14 | @GetMapping("/addQueue/{name}")
15 | public String addQueue(@PathVariable String name){
16 | return amqpProducer.declareQueue(name);
17 | }
18 |
19 | @GetMapping("/send/{queue}/{name}")
20 | public void sendMessage(@PathVariable String queue,@PathVariable String name){
21 | amqpProducer.send(queue,name);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/model/Movie.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.model;
2 |
3 | import org.neo4j.ogm.annotation.*;
4 |
5 | @NodeEntity(label = "Movie")
6 | public class Movie {
7 | @Id
8 | @GeneratedValue
9 | private Long nodeId;
10 |
11 | @Property(name = "title")
12 | private String title;
13 |
14 | @Property(name = "released")
15 | private int released;
16 |
17 | public void setNodeId(Long nodeId) {
18 | this.nodeId = nodeId;
19 | }
20 |
21 | public void setTitle(String title) {
22 | this.title = title;
23 | }
24 |
25 | public void setReleased(int released) {
26 | this.released = released;
27 | }
28 |
29 | public Long getNodeId() {
30 | return nodeId;
31 | }
32 |
33 | public String getTitle() {
34 | return title;
35 | }
36 |
37 | public int getReleased() {
38 | return released;
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/main/java/net/tongark/springboot/mongodb/dto/Account.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.mongodb.dto;
2 |
3 | import org.springframework.data.annotation.Id;
4 | import org.springframework.data.mongodb.core.mapping.Document;
5 |
6 | import java.io.Serializable;
7 |
8 | @Document( collection = "account")
9 | public class Account implements Serializable {
10 |
11 | @Id
12 | private Long id;
13 |
14 | private String name;
15 |
16 | public String getName(){
17 | return name;
18 | }
19 |
20 | public Long getId() {
21 | return id;
22 | }
23 |
24 | public void setId(Long id) {
25 | this.id = id;
26 | }
27 |
28 | public void setName(String name) {
29 | this.name = name;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "Account{" +
35 | "id=" + id +
36 | ", name='" + name + '\'' +
37 | '}';
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/configurer/HessianServiceConfigurer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.configurer;
2 |
3 | import net.tongark.spring.webservice.account.AccountService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.remoting.caucho.HessianServiceExporter;
8 |
9 | @Configuration
10 | public class HessianServiceConfigurer {
11 | @Autowired
12 | private AccountService accountService;
13 |
14 | @Bean("/AccountService")
15 | public HessianServiceExporter exportHelloHessian()
16 | {
17 | HessianServiceExporter exporter = new HessianServiceExporter();
18 | exporter.setService(accountService);
19 | exporter.setServiceInterface(net.tongark.spring.webservice.account.AccountService.class);
20 | return exporter;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/helloworld/src/main/java/com/github/davidji80/springboot/helloworld/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld.domain;
2 |
3 | import com.github.davidji80.springboot.helloworld.controller.HelloWorldController;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | public class User {
8 | private final Logger log = LoggerFactory.getLogger(HelloWorldController.class);
9 |
10 | String userName;
11 | String password;
12 |
13 | public void setUserName(String userName) {
14 |
15 | log.trace("TRACE");
16 | log.debug("DEBUG");
17 | log.info("INFO");
18 | log.warn("WARN");
19 | log.error("ERROR");
20 | this.userName = userName;
21 | }
22 |
23 | public void setPassword(String password) {
24 | this.password = password;
25 | }
26 |
27 | public String getUserName() {
28 | return userName;
29 | }
30 |
31 | public String getPassword() {
32 | return password;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/main/java/net/tongark/springboot/releasesqljdbc/controllers/AccountController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljdbc.controllers;
2 |
3 | import net.tongark.springboot.releasesqljdbc.entities.Account;
4 | import net.tongark.springboot.releasesqljdbc.services.AccountService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.*;
7 |
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/account")
12 | public class AccountController {
13 | @Autowired
14 | private AccountService accountService;
15 |
16 | @GetMapping("/add/{name}")
17 | public void addAccount(@PathVariable String name){
18 | Account account=new Account();
19 | account.setName(name);
20 | accountService.addAccount(account);
21 |
22 | }
23 |
24 | @RequestMapping(value = "/", method = RequestMethod.GET)
25 | public List findAll(){
26 | return accountService.findAll();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/controllers/AccountController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos.controllers;
2 |
3 | import net.tongark.springboot.releaseatomikos.entities.Account;
4 | import net.tongark.springboot.releaseatomikos.services.AccountService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.*;
7 |
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/account")
12 | public class AccountController {
13 | @Autowired
14 | private AccountService accountService;
15 |
16 | @GetMapping("/add/{name}")
17 | public void addAccount(@PathVariable String name){
18 | Account account=new Account();
19 | account.setName(name);
20 | accountService.addAccount(account);
21 |
22 | }
23 |
24 | @RequestMapping(value = "/", method = RequestMethod.GET)
25 | public List findAll(){
26 | return accountService.findAll();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/web-service/src/main/java/net/tongark/springboot/webservice/WebServiceApplication.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.webservice;
2 |
3 | import net.tongark.springboot.webservice.services.impl.HelloWebServiceImpl;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 | import javax.xml.ws.Endpoint;
8 |
9 | @SpringBootApplication
10 | public class WebServiceApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(WebServiceApplication.class, args);
14 | /*
15 | 在服务器端运行WebServicePublish类中的main方法,控制台打印出发布webservice成功!
16 | 在浏览器中输入我们在WebServicePublish类中定义的url?wsdl(注意一定要加wsdl),浏览器显示一个xml文档
17 | 那么我们这个WebService就发布成功了。
18 | */
19 | //定义webService的发布地址,提供给外界使用接口的地址
20 | String url = "http://localhost:8081/wsServeice";
21 | Endpoint.publish(url,new HelloWebServiceImpl());
22 | System.out.println("发布webService成功!");
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/configurer/HttpInvokerServerConfigurer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.configurer;
2 |
3 | import net.tongark.spring.webservice.account.AccountService;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
7 |
8 | import javax.annotation.Resource;
9 |
10 | @Configuration
11 | public class HttpInvokerServerConfigurer {
12 | @Resource
13 | private AccountService accountService;
14 |
15 | @Bean(name = "/HttpInvokerAccountService")
16 | public HttpInvokerServiceExporter httpInvokerServiceExporter(){
17 | HttpInvokerServiceExporter serviceExporter=new HttpInvokerServiceExporter();
18 | serviceExporter.setService(accountService);
19 | serviceExporter.setServiceInterface(net.tongark.spring.webservice.account.AccountService.class);
20 | return serviceExporter;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.service.impl;
2 |
3 | import com.github.davidji80.springboot.mahout.mapper.UserMapper;
4 | import com.github.davidji80.springboot.mahout.model.User;
5 | import com.github.davidji80.springboot.mahout.service.UserService;
6 | import org.apache.commons.collections.map.HashedMap;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | @Service
14 | public class UserServiceImpl implements UserService {
15 |
16 | @Autowired
17 | private UserMapper userMapper;
18 |
19 | @Override
20 | public List queryUsersBySql(int currPage, int pageSize) {
21 | Map data = new HashedMap();
22 | data.put("currIndex", (currPage-1)*pageSize);
23 | data.put("pageSize", pageSize);
24 | return userMapper.queryUsersBySql(data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/helloworld/src/main/java/com/github/davidji80/springboot/helloworld/controller/HelloWorldController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld.controller;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.beans.factory.annotation.Value;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | public class HelloWorldController {
11 | private final Logger log = LoggerFactory.getLogger(HelloWorldController.class);
12 |
13 | @Value("${com.test.title}")
14 | private String title;
15 | @Value("${com.test.description}")
16 | private String description;
17 |
18 | @RequestMapping("/hello")
19 | public String index() {
20 | log.trace("TRACE");
21 | log.debug("DEBUG");
22 | log.info("INFO");
23 | log.warn("WARN");
24 | log.error("ERROR");
25 |
26 | return "Hello World!"+"title:"+title+",description:"+description;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/config/JdbcTemplateDataSourceConfig.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos.config;
2 |
3 | import org.springframework.beans.factory.annotation.Qualifier;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.context.annotation.Primary;
7 | import org.springframework.jdbc.core.JdbcTemplate;
8 |
9 | import javax.sql.DataSource;
10 |
11 | @Configuration
12 | public class JdbcTemplateDataSourceConfig {
13 |
14 | //JdbcTemplate主数据源ds1数据源
15 | @Primary
16 | @Bean(name = "ds1JdbcTemplate")
17 | public JdbcTemplate ds1JdbcTemplate(@Qualifier("ds1DataSource") DataSource dataSource) {
18 | return new JdbcTemplate(dataSource);
19 | }
20 |
21 | //JdbcTemplate第二个ds2数据源
22 | @Bean(name = "ds2JdbcTemplate")
23 | public JdbcTemplate ds2JdbcTemplate(@Qualifier("ds2DataSource") DataSource dataSource) {
24 | return new JdbcTemplate(dataSource);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/release-ms-kafka/src/main/java/net/tongark/springboot/releasekafka/controllers/SendMessageController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasekafka.controllers;
2 |
3 | import net.tongark.springboot.releasekafka.kafkabeans.KafkaProducerBean;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.PathVariable;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | public class SendMessageController {
11 |
12 | /* @Autowired
13 | private KafkaTemplate kafkaTemplate;
14 |
15 | @GetMapping("send/{message}")
16 | public void send(@PathVariable String message) {
17 | this.kafkaTemplate.send("test", message);
18 | }*/
19 |
20 | @Autowired
21 | KafkaProducerBean kafkaProducerBean;
22 |
23 | @GetMapping("send/{topic}/{message}")
24 | public void send(@PathVariable String topic,@PathVariable String message) {
25 | kafkaProducerBean.send(topic,message);
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/release-getting-started/src/main/java/net/tongark/springboot/releasegettingstarted/controller/HelloRestController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasegettingstarted.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RequestMethod;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | @RestController
12 | @RequestMapping(value = "/rest", method = RequestMethod.GET)
13 | public class HelloRestController {
14 |
15 | @GetMapping(path = "hello")
16 | public String testGetStr() {
17 | return "Hello REST Controller!";
18 | }
19 |
20 | /**
21 | * map转json
22 | * spring mvc默认使用的事jackson来转换json,
23 | * 需要添加jackson依赖不然会报错
24 | *
25 | * @return
26 | */
27 | @GetMapping("/map")
28 | public Map testGetMap() {
29 | return new HashMap() {{
30 | put("name", "springboot");
31 | }};
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/release-ms-kafka/src/main/java/net/tongark/springboot/releasekafka/config/KafkaStreamsExampleConfiguration.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasekafka.config;
2 |
3 | import org.apache.kafka.common.serialization.Serdes;
4 | import org.apache.kafka.streams.KeyValue;
5 | import org.apache.kafka.streams.StreamsBuilder;
6 | import org.apache.kafka.streams.kstream.KStream;
7 | import org.apache.kafka.streams.kstream.Produced;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.Configuration;
10 | import org.springframework.kafka.annotation.EnableKafkaStreams;
11 | import org.springframework.kafka.support.serializer.JsonSerde;
12 |
13 | @Configuration(proxyBeanMethods = false)
14 | @EnableKafkaStreams
15 | public class KafkaStreamsExampleConfiguration {
16 | @Bean
17 | public KStream kStream(StreamsBuilder streamsBuilder) {
18 | KStream stream = streamsBuilder.stream("ks1In");
19 | stream.map((k, v) -> new KeyValue<>(k, v.toUpperCase())).to("ks1Out",
20 | Produced.with(Serdes.Integer(), new JsonSerde<>()));
21 | return stream;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/model/ActedIn.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.model;
2 |
3 | import org.neo4j.ogm.annotation.*;
4 |
5 | @RelationshipEntity(type = "ACTED_IN")
6 | public class ActedIn {
7 | @Id @GeneratedValue
8 | private Long id;
9 |
10 | @Property(name = "roles")
11 | private String roles;
12 |
13 | @StartNode
14 | private Person startNode;
15 |
16 | @EndNode
17 | private Movie endNode;
18 |
19 | public Long getId() {
20 | return id;
21 | }
22 |
23 | public void setId(Long id) {
24 | this.id = id;
25 | }
26 |
27 | public String getRoles() {
28 | return roles;
29 | }
30 |
31 | public void setRoles(String roles) {
32 | this.roles = roles;
33 | }
34 |
35 | public Person getStartNode() {
36 | return startNode;
37 | }
38 |
39 | public void setStartNode(Person startNode) {
40 | this.startNode = startNode;
41 | }
42 |
43 | public Movie getEndNode() {
44 | return endNode;
45 | }
46 |
47 | public void setEndNode(Movie endNode) {
48 | this.endNode = endNode;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/DefaultCatalog.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated;
5 |
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | import org.jooq.Schema;
11 | import org.jooq.impl.CatalogImpl;
12 |
13 |
14 | /**
15 | * This class is generated by jOOQ.
16 | */
17 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
18 | public class DefaultCatalog extends CatalogImpl {
19 |
20 | private static final long serialVersionUID = 1471404751;
21 |
22 | /**
23 | * The reference instance of DEFAULT_CATALOG
24 | */
25 | public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog();
26 |
27 | /**
28 | * The schema test01.
29 | */
30 | public final Test01 TEST01 = Test01.TEST01;
31 |
32 | /**
33 | * No further instances allowed
34 | */
35 | private DefaultCatalog() {
36 | super("");
37 | }
38 |
39 | @Override
40 | public final List getSchemas() {
41 | return Arrays.asList(
42 | Test01.TEST01);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/release-sql-jpa/src/main/java/net/tongark/springboot/releasesqljpa/controllers/AccountController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljpa.controllers;
2 |
3 | import net.tongark.springboot.releasesqljpa.entities.Account;
4 | import net.tongark.springboot.releasesqljpa.services.AccountRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.*;
7 |
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/account")
12 | public class AccountController {
13 | @Autowired
14 | private AccountRepository accountRepository;
15 |
16 | @GetMapping("/add/{name}")
17 | public void addAccount(@PathVariable String name){
18 | Account account=new Account();
19 | account.setName(name);
20 | accountRepository.save(account);
21 | }
22 |
23 | @RequestMapping(value = "/", method = RequestMethod.GET)
24 | public List findAll(){
25 | return accountRepository.findAll();
26 | }
27 |
28 | @GetMapping(value = "delete/{id}")
29 | public String deleteCity(@PathVariable Long id){
30 | accountRepository.deleteById(id);
31 | return "success";
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/release-sql-jdbc/src/main/java/net/tongark/springboot/releasesqljdbc/services/impl/AccountServiceImpl.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljdbc.services.impl;
2 |
3 | import net.tongark.springboot.releasesqljdbc.entities.Account;
4 | import net.tongark.springboot.releasesqljdbc.services.AccountService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.jdbc.core.JdbcTemplate;
7 | import org.springframework.stereotype.Service;
8 | import org.springframework.transaction.annotation.Transactional;
9 |
10 | import java.util.List;
11 |
12 | @Service
13 | public class AccountServiceImpl implements AccountService {
14 | @Autowired
15 | private JdbcTemplate jdbcTemplate;
16 |
17 | @Override
18 | public List findAll() {
19 | String sql = "select * from t_account";
20 | List list = jdbcTemplate.queryForList(sql);
21 | return list;
22 | }
23 |
24 | @Override
25 | @Transactional
26 | public void addAccount(Account account) {
27 | String sql = "insert into t_account(name) values(?)";
28 | jdbcTemplate.update(sql, account.getName());
29 | // throw new RuntimeException("事务异常,回滚!");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/mahout/src/main/resources/templates/userlist.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | 用户列表
7 |
8 |
9 |
10 |
11 |
12 | | ID |
13 | 性别 |
14 | 年龄 |
15 | 职业 |
16 | 邮编 |
17 | 推荐 |
18 |
19 |
20 |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | 推荐 |
27 |
28 |
29 |
30 |
上一页
31 |
32 |
下一页
33 |
34 |
35 |
--------------------------------------------------------------------------------
/release-ms-rabbitmq/src/main/java/net/tongark/springboot/releaserabbitmq/amqp/AmqpProducer.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaserabbitmq.amqp;
2 |
3 | import org.springframework.amqp.core.AmqpAdmin;
4 | import org.springframework.amqp.core.AmqpTemplate;
5 | import org.springframework.amqp.core.Queue;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.Date;
10 |
11 | @Component
12 | public class AmqpProducer {
13 | private final AmqpAdmin amqpAdmin;
14 | private final AmqpTemplate amqpTemplate;
15 |
16 | @Autowired
17 | public AmqpProducer(AmqpAdmin amqpAdmin, AmqpTemplate amqpTemplate) {
18 | this.amqpAdmin = amqpAdmin;
19 | this.amqpTemplate = amqpTemplate;
20 | }
21 |
22 | public String send(String queue,String name){
23 | String context="hello " + name + " --"+new Date();
24 | System.out.println("Sender: "+context);
25 | this.amqpTemplate.convertAndSend(queue,context);
26 | return context;
27 | }
28 |
29 | public String declareQueue(String name){
30 | Queue queue=new Queue(name);
31 | return amqpAdmin.declareQueue(queue);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/release-cache/src/main/java/com/github/davidji80/springboot/redis/controller/CacheController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.redis.controller;
2 |
3 | import com.github.davidji80.springboot.redis.service.CacheService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | public class CacheController {
11 | @Autowired
12 | CacheService cacheService;
13 |
14 | @RequestMapping("/CachePut/{value}")
15 | public String cachePut(@PathVariable String value) {
16 | return cacheService.cachePut(value);
17 | }
18 |
19 | @RequestMapping("/Cacheable/{value}")
20 | public String cacheable(@PathVariable String value) {
21 | return cacheService.cacheable(value);
22 | }
23 |
24 | @RequestMapping("/CacheEvict/{value}")
25 | public String cacheEvict(@PathVariable String value) {
26 | return cacheService.cacheEvict(value);
27 | }
28 |
29 | @RequestMapping("/CacheEvictAll")
30 | public void cacheEvictAll() {
31 | cacheService.cacheAllEvict();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/model/User.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.model;
2 |
3 | public class User {
4 | private Integer id;
5 |
6 | private String gender;
7 |
8 | private Integer age;
9 |
10 | private Integer occupation;
11 |
12 | private String zipCode;
13 |
14 | public Integer getId() {
15 | return id;
16 | }
17 |
18 | public void setId(Integer id) {
19 | this.id = id;
20 | }
21 |
22 | public String getGender() {
23 | return gender;
24 | }
25 |
26 | public void setGender(String gender) {
27 | this.gender = gender == null ? null : gender.trim();
28 | }
29 |
30 | public Integer getAge() {
31 | return age;
32 | }
33 |
34 | public void setAge(Integer age) {
35 | this.age = age;
36 | }
37 |
38 | public Integer getOccupation() {
39 | return occupation;
40 | }
41 |
42 | public void setOccupation(Integer occupation) {
43 | this.occupation = occupation;
44 | }
45 |
46 | public String getZipCode() {
47 | return zipCode;
48 | }
49 |
50 | public void setZipCode(String zipCode) {
51 | this.zipCode = zipCode == null ? null : zipCode.trim();
52 | }
53 | }
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/main/java/net/tongark/springboot/mongodb/controllers/AccountController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.mongodb.controllers;
2 |
3 | import net.tongark.springboot.mongodb.dto.Account;
4 | import org.apache.commons.logging.Log;
5 | import org.apache.commons.logging.LogFactory;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.data.mongodb.core.MongoTemplate;
8 | import org.springframework.web.bind.annotation.GetMapping;
9 | import org.springframework.web.bind.annotation.PathVariable;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.RestController;
12 |
13 | @RestController
14 | @RequestMapping("/account")
15 | public class AccountController {
16 | private static final Log log = LogFactory.getLog(AccountController.class);
17 |
18 | @Autowired
19 | private MongoTemplate mongoTemplate;
20 |
21 | @GetMapping("/add/{name}")
22 | public void addAccount(@PathVariable String name){
23 | Account account=new Account();
24 | long radomID = (long) (Math.random()*1000000000);
25 | account.setId(radomID);
26 | account.setName(name);
27 | mongoTemplate.insert(account);
28 | log.info("插入成功!");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/release-cache/src/main/java/com/github/davidji80/springboot/redis/service/CacheService.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.redis.service;
2 |
3 | import org.springframework.cache.annotation.CacheConfig;
4 | import org.springframework.cache.annotation.CacheEvict;
5 | import org.springframework.cache.annotation.CachePut;
6 | import org.springframework.cache.annotation.Cacheable;
7 | import org.springframework.stereotype.Service;
8 |
9 | @Service
10 | @CacheConfig(cacheNames = "redisCache")
11 | public class CacheService {
12 | @Cacheable(
13 | cacheNames = {"redisCache","otherCache"},
14 | key = "#value",
15 | condition = "#value.length()<4",
16 | unless = "#result.length()>=4")
17 | public String cacheable(String value){
18 | return value;
19 | }
20 |
21 | @CachePut(value = "redisCache",key = "#value")
22 | public String cachePut(String value){
23 | return "cachePut:"+value;
24 | }
25 |
26 | @CacheEvict(value = "redisCache",
27 | key = "#value")
28 | public String cacheEvict(String value){
29 | return "cacheEvict:"+value;
30 | }
31 |
32 | @CacheEvict(cacheNames = {"redisCache","otherCache"},
33 | allEntries = true)
34 | public void cacheAllEvict(){
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/aop/src/main/java/net/tongark/springboot/aop/aop/BrokerAspect.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.aop.aop;
2 |
3 | import org.aspectj.lang.annotation.*;
4 | import org.springframework.stereotype.Component;
5 |
6 | @Aspect
7 | @Component
8 | public class BrokerAspect {
9 | /**
10 | * 定义切入点,切入点为*.AopController中的所有函数
11 | *通过@Pointcut注解声明频繁使用的切点表达式
12 | */
13 | @Pointcut("execution(public * net.tongark.springboot.aop.controller.AopController.*(..)))")
14 | public void BrokerAspect(){
15 |
16 | }
17 |
18 | /**
19 | * @description 在连接点执行之前执行的通知
20 | */
21 | @Before("BrokerAspect()")
22 | public void doBeforeGame(){
23 | System.out.println("经纪人正在处理球星赛前事务!");
24 | }
25 |
26 | /**
27 | * @description 在连接点执行之后执行的通知(返回通知和异常通知的异常)
28 | */
29 | @After("BrokerAspect()")
30 | public void doAfterGame(){
31 | System.out.println("经纪人为球星表现疯狂鼓掌!");
32 | }
33 |
34 | /**
35 | * @description 在连接点执行之后执行的通知(返回通知)
36 | */
37 | @AfterReturning("BrokerAspect()")
38 | public void doAfterReturningGame(){
39 | System.out.println("返回通知:经纪人为球星表现疯狂鼓掌!");
40 | }
41 |
42 | /**
43 | * @description 在连接点执行之后执行的通知(异常通知)
44 | */
45 | @AfterThrowing("BrokerAspect()")
46 | public void doAfterThrowingGame(){
47 | System.out.println("异常通知:球迷要求退票!");
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/Test01.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated;
5 |
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | import net.tongark.springboot.releasesqljooq.generated.tables.TAccount;
11 |
12 | import org.jooq.Catalog;
13 | import org.jooq.Table;
14 | import org.jooq.impl.SchemaImpl;
15 |
16 |
17 | /**
18 | * This class is generated by jOOQ.
19 | */
20 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
21 | public class Test01 extends SchemaImpl {
22 |
23 | private static final long serialVersionUID = 834571456;
24 |
25 | /**
26 | * The reference instance of test01
27 | */
28 | public static final Test01 TEST01 = new Test01();
29 |
30 | /**
31 | * The table test01.t_account.
32 | */
33 | public final TAccount T_ACCOUNT = TAccount.T_ACCOUNT;
34 |
35 | /**
36 | * No further instances allowed
37 | */
38 | private Test01() {
39 | super("test01", null);
40 | }
41 |
42 |
43 | @Override
44 | public Catalog getCatalog() {
45 | return DefaultCatalog.DEFAULT_CATALOG;
46 | }
47 |
48 | @Override
49 | public final List> getTables() {
50 | return Arrays.>asList(
51 | TAccount.T_ACCOUNT);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/helloworld/src/test/java/com/github/davidji80/springboot/helloworld/controller/HelloWorldControlerTests.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld.controller;
2 |
3 | import org.junit.Before;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.boot.test.context.SpringBootTest;
7 | import org.springframework.http.MediaType;
8 | import org.springframework.test.context.junit4.SpringRunner;
9 | import org.springframework.test.web.servlet.MockMvc;
10 | import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
11 | import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
12 | import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
13 | import org.springframework.test.web.servlet.setup.MockMvcBuilders;
14 |
15 | @RunWith(SpringRunner.class)
16 | @SpringBootTest
17 |
18 | public class HelloWorldControlerTests {
19 | private MockMvc mvc;
20 | @Before
21 | public void setUp() throws Exception {
22 | mvc = MockMvcBuilders.standaloneSetup(new HelloWorldController()).build();
23 | }
24 | @Test
25 | public void getHello() throws Exception {
26 | mvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON))
27 | .andExpect(MockMvcResultMatchers.status().isOk())
28 | .andDo(MockMvcResultHandlers.print())
29 | .andReturn();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/controllers/AccountController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljooq.controllers;
2 |
3 | import net.tongark.springboot.releasesqljooq.generated.tables.pojos.Account;
4 | import net.tongark.springboot.releasesqljooq.services.AccountService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.*;
7 |
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/account")
12 | public class AccountController {
13 | @Autowired
14 | private AccountService accountService;
15 |
16 | @GetMapping("/add/{name}")
17 | public void addAccount(@PathVariable String name){
18 | Account account=new Account();
19 | account.setName(name);
20 | accountService.add(account);
21 | }
22 |
23 | @RequestMapping(value = "/", method = RequestMethod.GET)
24 | public List findAll(){
25 | return accountService.findAll();
26 | }
27 |
28 | @GetMapping("/update/{id}/{name}")
29 | public int updateAccount(@PathVariable int id,@PathVariable String name){
30 | Account account=new Account();
31 | account.setId(id);
32 | account.setName(name);
33 | return accountService.update(account);
34 | }
35 |
36 | @GetMapping("/delete/{id}")
37 | public void deleteAccount(@PathVariable int id){
38 | accountService.delete(id);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/model/User.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.model;
2 |
3 | import org.springframework.data.annotation.Id;
4 | import org.springframework.data.elasticsearch.annotations.Document;
5 | import org.springframework.data.elasticsearch.annotations.Field;
6 |
7 | import java.io.Serializable;
8 |
9 | @Document(indexName = "user_index",type = "user")
10 | public class User implements Serializable {
11 | @Id
12 | private Integer userId;
13 | @Field
14 | private String userName;
15 | @Field
16 | private String password;
17 | @Field
18 | private String phone;
19 |
20 | public Integer getUserId() {
21 | return userId;
22 | }
23 |
24 | public void setUserId(Integer userId) {
25 | this.userId = userId;
26 | }
27 |
28 | public String getUserName() {
29 | return userName;
30 | }
31 |
32 | public void setUserName(String userName) {
33 | this.userName = userName == null ? null : userName.trim();
34 | }
35 |
36 | public String getPassword() {
37 | return password;
38 | }
39 |
40 | public void setPassword(String password) {
41 | this.password = password == null ? null : password.trim();
42 | }
43 |
44 | public String getPhone() {
45 | return phone;
46 | }
47 |
48 | public void setPhone(String phone) {
49 | this.phone = phone == null ? null : phone.trim();
50 | }
51 | }
--------------------------------------------------------------------------------
/release-getting-started/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
10 |
11 | org.springframework.boot
12 | spring-boot-starter-parent
13 | 2.3.1.RELEASE
14 |
15 |
16 | net.tongark.springboot
17 | release-getting-started
18 | 0.0.1-SNAPSHOT
19 | release-getting-started
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-web
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-maven-plugin
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/services/impl/AccountServiceImpl.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesqljooq.services.impl;
2 |
3 | import net.tongark.springboot.releasesqljooq.generated.tables.TAccount;
4 | import net.tongark.springboot.releasesqljooq.generated.tables.pojos.Account;
5 | import net.tongark.springboot.releasesqljooq.services.AccountService;
6 | import org.jooq.DSLContext;
7 | import org.jooq.Record;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import java.util.List;
12 |
13 | @Service
14 | public class AccountServiceImpl implements AccountService {
15 | @Autowired
16 | DSLContext dsl;
17 |
18 | TAccount ACCOUNT = TAccount.T_ACCOUNT;
19 |
20 | @Override
21 | public void add(Account account) {
22 | dsl.insertInto(ACCOUNT)
23 | .columns(ACCOUNT.NAME)
24 | .values(account.getName())
25 | .execute();
26 | }
27 |
28 | @Override
29 | public List findAll() {
30 | return dsl.select().from(ACCOUNT).fetchInto(Account.class);
31 | }
32 |
33 | @Override
34 | public int update(Account account) {
35 | dsl.update(ACCOUNT).set((Record) account);
36 | return account.getId();
37 | }
38 |
39 | @Override
40 | public void delete(int id) {
41 | dsl.delete(ACCOUNT).where(ACCOUNT.ID.eq(id)).execute();
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/services/impl/AccountServiceImpl.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos.services.impl;
2 |
3 | import net.tongark.springboot.releaseatomikos.entities.Account;
4 | import net.tongark.springboot.releaseatomikos.services.AccountService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.beans.factory.annotation.Qualifier;
7 | import org.springframework.jdbc.core.JdbcTemplate;
8 | import org.springframework.stereotype.Service;
9 | import org.springframework.transaction.annotation.Transactional;
10 |
11 | import javax.annotation.Resource;
12 | import java.util.List;
13 |
14 | @Service
15 | public class AccountServiceImpl implements AccountService {
16 | @Autowired
17 | private JdbcTemplate jdbcTemplate;
18 |
19 | //@Resource(name = "ds2JdbcTemplate")
20 | @Autowired
21 | @Qualifier(value = "ds2JdbcTemplate")
22 | private JdbcTemplate jdbcTemplate2;
23 |
24 | @Override
25 | public List findAll() {
26 | String sql = "select * from t_account";
27 | List list = jdbcTemplate.queryForList(sql);
28 | return list;
29 | }
30 |
31 | @Override
32 | @Transactional
33 | public void addAccount(Account account) {
34 | String sql = "insert into t_account(name) values(?)";
35 | jdbcTemplate.update(sql, account.getName());
36 | jdbcTemplate2.update(sql, account.getName());
37 | // throw new RuntimeException("事务异常,回滚!");
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/release-nosql-elasticsearch/src/main/java/com/github/davidji80/springboot/elasticsearch/entity/Employee.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.elasticsearch.entity;
2 |
3 | import org.springframework.data.annotation.Id;
4 | import org.springframework.data.elasticsearch.annotations.Document;
5 | import org.springframework.data.elasticsearch.annotations.Field;
6 |
7 | @Document(indexName = "employee")
8 | public class Employee {
9 | @Id
10 | private String id;
11 | @Field
12 | private String firstName;
13 | @Field
14 | private String lastName;
15 | @Field
16 | private Integer age = 0;
17 | @Field
18 | private String about;
19 |
20 | public String getId() {
21 | return id;
22 | }
23 |
24 | public void setId(String id) {
25 | this.id = id;
26 | }
27 |
28 | public String getFirstName() {
29 | return firstName;
30 | }
31 |
32 | public void setFirstName(String firstName) {
33 | this.firstName = firstName;
34 | }
35 |
36 | public String getLastName() {
37 | return lastName;
38 | }
39 |
40 | public void setLastName(String lastName) {
41 | this.lastName = lastName;
42 | }
43 |
44 | public Integer getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(Integer age) {
49 | this.age = age;
50 | }
51 |
52 | public String getAbout() {
53 | return about;
54 | }
55 |
56 | public void setAbout(String about) {
57 | this.about = about;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/release-nosql-mongodb/src/main/java/net/tongark/springboot/mongodb/controllers/AccountRepositoryController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.mongodb.controllers;
2 |
3 | import net.tongark.springboot.mongodb.dto.Account;
4 | import net.tongark.springboot.mongodb.repository.AccountRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import java.util.List;
12 |
13 | @RestController
14 | @RequestMapping("/account_repo")
15 | public class AccountRepositoryController {
16 | @Autowired
17 | private AccountRepository accountRepository;
18 |
19 | @GetMapping("/add/{name}")
20 | public Account addAccount(@PathVariable String name){
21 | Account account=new Account();
22 | long radomID = (long) (Math.random()*1000000000);
23 | account.setId(radomID);
24 | account.setName(name);
25 | accountRepository.save(account);
26 | return account;
27 | }
28 |
29 | @GetMapping("accounts")
30 | public List getAccountList(){
31 | List accounts = accountRepository.findAll();
32 | return accounts;
33 | }
34 |
35 | @GetMapping("delete/{id}")
36 | public String delete(@PathVariable Long id){
37 | accountRepository.deleteById(id);
38 | return "success";
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/tables/pojos/Account.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated.tables.pojos;
5 |
6 |
7 | import java.io.Serializable;
8 |
9 |
10 | /**
11 | * This class is generated by jOOQ.
12 | */
13 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
14 | public class Account implements Serializable {
15 |
16 | private static final long serialVersionUID = 1488859479;
17 |
18 | private Integer id;
19 | private String name;
20 |
21 | public Account() {}
22 |
23 | public Account(Account value) {
24 | this.id = value.id;
25 | this.name = value.name;
26 | }
27 |
28 | public Account(
29 | Integer id,
30 | String name
31 | ) {
32 | this.id = id;
33 | this.name = name;
34 | }
35 |
36 | public Integer getId() {
37 | return this.id;
38 | }
39 |
40 | public Account setId(Integer id) {
41 | this.id = id;
42 | return this;
43 | }
44 |
45 | public String getName() {
46 | return this.name;
47 | }
48 |
49 | public Account setName(String name) {
50 | this.name = name;
51 | return this;
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | StringBuilder sb = new StringBuilder("TAccount (");
57 |
58 | sb.append(id);
59 | sb.append(", ").append(name);
60 |
61 | sb.append(")");
62 | return sb.toString();
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/release-session/src/main/java/net/tongark/springboot/releasesession/controllers/IndexController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasesession.controllers;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.ResponseBody;
7 |
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpSession;
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | @Controller
14 | @RequestMapping(value = "/")
15 | public class IndexController {
16 | @ResponseBody
17 | @GetMapping(value = "/session")
18 | public Map getSession(HttpServletRequest request) {
19 | HttpSession httpSession=request.getSession();
20 | // 添加数据到Session
21 | httpSession.setAttribute("username", "admin");
22 | // 添加sessionID到Map
23 | Map map = new HashMap<>();
24 | map.put("sessionId", httpSession.getId());
25 | return map;
26 | }
27 |
28 | @ResponseBody
29 | @GetMapping(value = "/get")
30 | public String get(HttpServletRequest request) {
31 | // 获取Session数据
32 | String userName = (String) request.getSession().getAttribute("username");
33 | return userName;
34 | }
35 |
36 | @ResponseBody
37 | @GetMapping(value = "/logout")
38 | public String logout(HttpServletRequest request) {
39 | // 销毁sessioin
40 | request.getSession().invalidate();
41 | return "ok";
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/release-webmvc/src/main/java/net/tongark/springboot/releasewebmvc/controllers/UserRestController.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releasewebmvc.controllers;
2 |
3 | import net.tongark.springboot.releasewebmvc.dto.User;
4 | import org.springframework.web.bind.annotation.*;
5 |
6 | @RestController
7 | @RequestMapping(value="/users")
8 | public class UserRestController {
9 |
10 | @RequestMapping(value = "/default_user",method = RequestMethod.GET)
11 | public User defaultUser(){
12 | return new User("您好,David",40);
13 | }
14 |
15 | @GetMapping("/t?st.html")
16 | public String uriWithQuestionMark(){
17 | return "带?的,t?st.html";
18 | }
19 |
20 | @GetMapping("/{name:[a-z]+}")
21 | public User uriWithName(@PathVariable String name){
22 | return new User("您好,"+name,40);
23 | }
24 |
25 | @PostMapping(path = "/add_user",consumes = "application/json")
26 | public User addUser(@RequestBody User user){
27 | return user;
28 | }
29 |
30 | /**
31 | * 必须有myParam参数,且必须等于myValue
32 | *
33 | * @param petId
34 | * @return
35 | */
36 | @GetMapping(path = "/petp/{petId}", params = "myParam=myValue")
37 | public User findPet(@PathVariable String petId) {
38 | return new User("find,"+petId,40);
39 | }
40 |
41 | /**
42 | * Headers中必须有myParam参数,且必须等于myValue
43 | *
44 | * @param petId
45 | * @return
46 | */
47 | @GetMapping(path = "/peth/{petId}", headers = "myHeader=myValue")
48 | public User findPetHeaders(@PathVariable String petId) {
49 | return new User("find,"+petId,40);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/config/MahoutConfig.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.config;
2 |
3 | import com.mysql.cj.jdbc.MysqlDataSource;
4 | import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
5 | import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
6 | import org.apache.mahout.cf.taste.model.DataModel;
7 | import org.springframework.beans.factory.annotation.Autowire;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.Configuration;
10 |
11 | import java.io.File;
12 | import java.io.IOException;
13 | import java.net.URL;
14 |
15 | @Configuration
16 | public class MahoutConfig {
17 |
18 | private MysqlDataSource getDataSource(){
19 | MysqlDataSource dataSource=new MysqlDataSource();
20 | dataSource.setServerName("192.168.1.7");
21 | dataSource.setUser("xhsit");
22 | dataSource.setPassword("sit1818");
23 | dataSource.setDatabaseName("mahout");
24 | return dataSource;
25 | }
26 |
27 | @Bean(autowire = Autowire.BY_NAME,value = "mySQLDataModel")
28 | public DataModel getMySQLJDBCDataModel(){
29 | DataModel dataModel=new MySQLJDBCDataModel(getDataSource(),"rating","userid","movieid","rating", "ratetime");
30 | return dataModel;
31 | }
32 |
33 | @Bean(autowire = Autowire.BY_NAME,value = "fileDataModel")
34 | public DataModel getDataModel() throws IOException {
35 | URL url=MahoutConfig.class.getClassLoader().getResource("mahout/ratings-1m.data");
36 | DataModel dataModel = new FileDataModel(new File(url.getFile()));
37 | return dataModel;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/release-atomikos/src/main/java/net/tongark/springboot/releaseatomikos/config/DataSourceConfig.java:
--------------------------------------------------------------------------------
1 | package net.tongark.springboot.releaseatomikos.config;
2 |
3 | import org.springframework.beans.factory.annotation.Qualifier;
4 | import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.context.annotation.Primary;
9 |
10 | import javax.sql.DataSource;
11 |
12 | @Configuration
13 | public class DataSourceConfig {
14 | //主数据源配置 ds1数据源
15 | @Primary
16 | @Bean(name = "ds1DataSourceProperties")
17 | @ConfigurationProperties(prefix = "spring.datasource.test01")
18 | public DataSourceProperties ds1DataSourceProperties() {
19 | return new DataSourceProperties();
20 | }
21 |
22 | //主数据源 ds1数据源
23 | @Primary
24 | @Bean(name = "ds1DataSource")
25 | public DataSource ds1DataSource(@Qualifier("ds1DataSourceProperties") DataSourceProperties dataSourceProperties) {
26 | return dataSourceProperties.initializeDataSourceBuilder().build();
27 | }
28 |
29 | //第二个ds2数据源配置
30 | @Bean(name = "ds2DataSourceProperties")
31 | @ConfigurationProperties(prefix = "spring.datasource.test02")
32 | public DataSourceProperties ds2DataSourceProperties() {
33 | return new DataSourceProperties();
34 | }
35 |
36 | //第二个ds2数据源
37 | @Bean("ds2DataSource")
38 | public DataSource ds2DataSource(@Qualifier("ds2DataSourceProperties") DataSourceProperties dataSourceProperties) {
39 | return dataSourceProperties.initializeDataSourceBuilder().build();
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/release-session/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.2.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-session
13 | 0.0.1-SNAPSHOT
14 | release-session
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-data-redis
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 | org.springframework.session
32 | spring-session-data-redis
33 |
34 |
35 |
36 |
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-maven-plugin
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/release-nosql-elasticsearch/src/main/java/com/github/davidji80/springboot/elasticsearch/controller/EmployeeController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.elasticsearch.controller;
2 |
3 | import com.github.davidji80.springboot.elasticsearch.dao.EmployeeRepository;
4 | import com.github.davidji80.springboot.elasticsearch.entity.Employee;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @RestController
10 | @RequestMapping("es")
11 | public class EmployeeController {
12 | @Autowired
13 | private EmployeeRepository employeeRepository;
14 |
15 | @RequestMapping("add")
16 | public String add() {
17 | Employee employee = new Employee();
18 | employee.setId("1");
19 | employee.setFirstName("ji");
20 | employee.setLastName("zhou");
21 | employee.setAge(26);
22 | employee.setAbout("i am in shanghai");
23 | employeeRepository.save(employee);
24 | return "success";
25 | }
26 |
27 | @RequestMapping("delete")
28 | public String delete() {
29 | Employee employee = employeeRepository.queryEmployeeById("1");
30 | employeeRepository.delete(employee);
31 | return "success";
32 | }
33 |
34 | @RequestMapping("update")
35 | public String update() {
36 | Employee employee = employeeRepository.queryEmployeeById("1");
37 | employee.setFirstName("季");
38 | employeeRepository.save(employee);
39 | return "success";
40 | }
41 |
42 | @RequestMapping("query")
43 | public Employee query() {
44 | Employee accountInfo = employeeRepository.queryEmployeeById("1");
45 | return accountInfo;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/neo4j/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.github.davidji80.springboot
7 | neo4j
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | neo4j
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-data-neo4j
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-web
36 |
37 |
38 |
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-maven-plugin
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/mahout/src/main/resources/templates/recommendlist.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | 电影推荐列表
7 |
8 |
9 |
10 |
已经看过的电影
11 |
12 |
13 | | ID |
14 | 电影名 |
15 | 分类 |
16 |
17 |
18 |
19 | |
20 | |
21 | |
22 |
23 |
24 |
25 |
基于用户的协同过滤算法推荐的电影
26 |
27 |
28 | | ID |
29 | 电影名 |
30 | 分类 |
31 |
32 |
33 |
34 | |
35 | |
36 | |
37 |
38 |
39 |
40 |
基于内容的协同过滤算法推荐的电影
41 |
42 |
43 | | ID |
44 | 电影名 |
45 | 分类 |
46 |
47 |
48 |
49 | |
50 | |
51 | |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/service/impl/MovieServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.service.impl;
2 |
3 | import com.github.davidji80.springboot.mahout.mapper.MovieMapper;
4 | import com.github.davidji80.springboot.mahout.model.Movie;
5 | import com.github.davidji80.springboot.mahout.recommender.MovieRecommender;
6 | import com.github.davidji80.springboot.mahout.service.MovieService;
7 | import org.apache.mahout.cf.taste.common.TasteException;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 | import java.util.List;
11 |
12 | @Service
13 | public class MovieServiceImpl implements MovieService {
14 | @Autowired
15 | private MovieMapper movieMapper;
16 | @Autowired
17 | private MovieRecommender movieRecommender;
18 |
19 | @Override
20 | public List queryLookedMoviesByUser(int userID) {
21 | return movieMapper.queryMoviesBySql(userID);
22 | }
23 |
24 | @Override
25 | public List recommendMoviesBasedUser(int userID, int size) {
26 | List recommendedItems=null;
27 | try {
28 | recommendedItems=movieRecommender.userBasedRecommender(new Integer(userID).longValue(),size);
29 | } catch (TasteException e) {
30 | e.printStackTrace();
31 | }
32 | return movieMapper.queryMoviesByIds(recommendedItems);
33 | }
34 |
35 | @Override
36 | public List recommendMoviesBasedItem(int userID, int size) {
37 | List recommendedItems=null;
38 | try {
39 | recommendedItems=movieRecommender.itemBasedRecommender(new Integer(userID).longValue(),size);
40 | } catch (TasteException e) {
41 | e.printStackTrace();
42 | }
43 | return movieMapper.queryMoviesByIds(recommendedItems);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.controller;
2 |
3 | import com.github.davidji80.springboot.mybatis.esdao.UserRepository;
4 | import com.github.davidji80.springboot.mybatis.model.User;
5 | import com.github.davidji80.springboot.mybatis.service.UserService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.ResponseBody;
11 |
12 | @Controller
13 | @RequestMapping(value = "/user")
14 | public class UserController {
15 | @Autowired
16 | private UserService userService;
17 |
18 | @ResponseBody
19 | @RequestMapping(value = "/add")
20 | public User addUser(User user){
21 | return userService.addUser(user);
22 | }
23 |
24 | @RequestMapping("/get/{id}")
25 | @ResponseBody
26 | public User findById(@PathVariable("id")String id){
27 | User user = this.userService.findUserByID(Integer.parseInt(id));
28 | return user;
29 | }
30 |
31 | @RequestMapping("/getByPhone/{phone}")
32 | @ResponseBody
33 | public User findByPhone(@PathVariable("phone")String phone){
34 | User user = this.userService.findUserByPhone(phone);
35 | return user;
36 | }
37 |
38 | @ResponseBody
39 | @RequestMapping(value = "/update")
40 | public User updateUser(User user){
41 | return userService.updateUserByID(user);
42 | }
43 |
44 | @RequestMapping("/delete/{id}")
45 | @ResponseBody
46 | public String delete(@PathVariable("id")String id){
47 | this.userService.deleteUserByID(Integer.parseInt(id));
48 | return "success";
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/release-nosql-elasticsearch/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.github.davidji80.springboot
7 | elasticsearch
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | elasticsearch
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter-data-elasticsearch
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-web
36 |
37 |
38 |
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-maven-plugin
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/helloworld/src/main/java/com/github/davidji80/springboot/helloworld/config/WebConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.helloworld.config;
2 |
3 | import org.apache.catalina.filters.RemoteIpFilter;
4 | import org.springframework.boot.web.servlet.FilterRegistrationBean;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.servlet.*;
9 | import javax.servlet.http.HttpServletRequest;
10 | import java.io.IOException;
11 |
12 | @Configuration
13 | public class WebConfiguration {
14 | @Bean
15 | public RemoteIpFilter remoteIpFilter() {
16 | return new RemoteIpFilter();
17 | }
18 |
19 | @Bean
20 | public FilterRegistrationBean testFilterRegistration() {
21 |
22 | FilterRegistrationBean registration = new FilterRegistrationBean();
23 | registration.setFilter(new MyFilter());
24 | registration.addUrlPatterns("/*");
25 | registration.addInitParameter("paramName", "paramValue");
26 | registration.setName("MyFilter");
27 | registration.setOrder(1);
28 | return registration;
29 | }
30 |
31 | public class MyFilter implements Filter {
32 | @Override
33 | public void destroy() {
34 | System.out.println("filter destroy...");
35 | }
36 |
37 | @Override
38 | public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain filterChain)
39 | throws IOException, ServletException {
40 | // TODO Auto-generated method stub
41 | HttpServletRequest request = (HttpServletRequest) srequest;
42 | System.out.println("this is MyFilter,url :"+request.getRequestURI());
43 | filterChain.doFilter(srequest, sresponse);
44 | }
45 |
46 | @Override
47 | public void init(FilterConfig arg0) throws ServletException {
48 | System.out.println("filter init..."+arg0.toString());
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/release-cache/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.github.davidji80.springboot
7 | release-cache
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | release-cache
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.3.1.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-data-redis
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-web
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-cache
39 |
40 |
41 |
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-maven-plugin
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/rabbitmq/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.github.davidji80.springboot
7 | rabbitmq
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | rabbitmq
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.5.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-amqp
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-web
35 |
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-test
40 | test
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/actuator/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | actuator
13 | 0.0.1-SNAPSHOT
14 | actuator
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-actuator
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-test
34 | test
35 |
36 |
37 | org.junit.vintage
38 | junit-vintage-engine
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/controller/MovieRecommenderController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.controller;
2 |
3 | import com.github.davidji80.springboot.mahout.service.MovieService;
4 | import com.github.davidji80.springboot.mahout.service.UserService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 | import org.springframework.web.servlet.ModelAndView;
10 |
11 | import java.util.List;
12 |
13 | @Controller
14 | @RequestMapping(value = "/mahout")
15 | public class MovieRecommenderController {
16 | final private int RECOMMENDER_NUM = 10; //推荐结果个数
17 | final private int PAGE_SIZE = 20; //推荐结果个数
18 | @Autowired
19 | private UserService userService;
20 | @Autowired
21 | private MovieService movieService;
22 |
23 |
24 |
25 | @RequestMapping(value = "/userlist")
26 | public ModelAndView userlist(@RequestParam(value = "pageno", defaultValue = "1") int currPage, ModelAndView mv) {
27 | mv.setViewName("/userlist");
28 | List users = userService.queryUsersBySql(currPage, PAGE_SIZE);
29 | mv.addObject("userList", users);
30 | mv.addObject("pageno",currPage);
31 | return mv;
32 | }
33 |
34 | @RequestMapping(value = "/recommend")
35 | public ModelAndView recommendlist(@RequestParam(value = "userid", defaultValue = "1") int userID, ModelAndView mv) {
36 | List moviesRBU=movieService.recommendMoviesBasedUser(userID, RECOMMENDER_NUM);
37 | List moviesRBI=movieService.recommendMoviesBasedItem(userID, RECOMMENDER_NUM);
38 | List lookedMovies=movieService.queryLookedMoviesByUser(userID);
39 | mv.setViewName("/recommendlist");
40 | mv.addObject("lookedMovies",lookedMovies);
41 | mv.addObject("moviesRBU",moviesRBU);
42 | mv.addObject("moviesRBI",moviesRBI);
43 | return mv;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/aop/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | aop
13 | 0.0.1-SNAPSHOT
14 | aop
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-aop
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-maven-plugin
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/release-nosql-mongodb/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | mongodb
13 | 0.0.1-SNAPSHOT
14 | mongodb
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-data-mongodb
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-test
34 | test
35 |
36 |
37 | org.junit.vintage
38 | junit-vintage-engine
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/release-quartz/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.2.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-quartz
13 | 0.0.1-SNAPSHOT
14 | release-quartz
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-quartz
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-test
34 | test
35 |
36 |
37 | org.junit.vintage
38 | junit-vintage-engine
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/release-ms-activemq/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-activemq
13 | 0.0.1-SNAPSHOT
14 | release-activemq
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-activemq
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-test
34 | test
35 |
36 |
37 | org.junit.vintage
38 | junit-vintage-engine
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/release-webmvc/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-webmvc
13 | 0.0.1-SNAPSHOT
14 | release-webmvc
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-freemarker
30 |
31 |
32 |
33 |
34 | net.tongark.spring
35 | web-service-api
36 | 1.0
37 |
38 |
39 |
40 | com.caucho
41 | hessian
42 | 4.0.63
43 |
44 |
45 |
46 |
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-maven-plugin
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/service/impl/MovieServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.service.impl;
2 |
3 | import com.github.davidji80.springboot.neo4j.dao.ActedInRepository;
4 | import com.github.davidji80.springboot.neo4j.dao.DirectedRepository;
5 | import com.github.davidji80.springboot.neo4j.dao.MovieRepository;
6 | import com.github.davidji80.springboot.neo4j.dao.PersonRepository;
7 | import com.github.davidji80.springboot.neo4j.model.ActedIn;
8 | import com.github.davidji80.springboot.neo4j.model.Directed;
9 | import com.github.davidji80.springboot.neo4j.model.Movie;
10 | import com.github.davidji80.springboot.neo4j.model.Person;
11 | import com.github.davidji80.springboot.neo4j.service.MovieServer;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.stereotype.Service;
14 |
15 | import java.util.Optional;
16 |
17 | @Service
18 | public class MovieServiceImpl implements MovieServer {
19 |
20 | @Autowired
21 | private PersonRepository personRepository;
22 | @Autowired
23 | private MovieRepository movieRepository;
24 | @Autowired
25 | private DirectedRepository directedRepository;
26 | @Autowired
27 | private ActedInRepository actedInRepository;
28 |
29 | @Override
30 | public Person addPerson(Person person){
31 | return personRepository.save(person);
32 | }
33 | @Override
34 | public Person findOnePerson(long id){
35 | return personRepository.findById(id).get();
36 | }
37 | @Override
38 | public void deleteOnePerson(long id){
39 | personRepository.deleteById(id);
40 | }
41 | @Override
42 | public Movie addMovie(Movie movie){
43 | return movieRepository.save(movie);
44 | }
45 | @Override
46 | public Movie findOneMovie(long id){
47 | return movieRepository.findById(id).get();
48 | }
49 | @Override
50 | public Directed directed(Directed directed){
51 | return directedRepository.save(directed);
52 | }
53 | @Override
54 | public ActedIn actedIn(ActedIn actedIn) {
55 | return actedInRepository.save(actedIn);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/release-sql-jpa/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-sql-jpa
13 | 0.0.1-SNAPSHOT
14 | release-sql-jpa
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-data-jpa
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | mysql
33 | mysql-connector-java
34 | runtime
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-test
39 | test
40 |
41 |
42 | org.junit.vintage
43 | junit-vintage-engine
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.springframework.boot
53 | spring-boot-maven-plugin
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/release-sql-jdbc/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-sql-jdbc
13 | 0.0.1-SNAPSHOT
14 | release-sql-jdbc
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-data-jdbc
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | mysql
33 | mysql-connector-java
34 | runtime
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-test
39 | test
40 |
41 |
42 | org.junit.vintage
43 | junit-vintage-engine
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.springframework.boot
53 | spring-boot-maven-plugin
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/release-ms-rabbitmq/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-rabbitmq
13 | 0.0.1-SNAPSHOT
14 | release-rabbitmq
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-amqp
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-starter-test
34 | test
35 |
36 |
37 | org.junit.vintage
38 | junit-vintage-engine
39 |
40 |
41 |
42 |
43 | org.springframework.amqp
44 | spring-rabbit-test
45 | test
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.springframework.boot
53 | spring-boot-maven-plugin
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/Keys.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated;
5 |
6 |
7 | import net.tongark.springboot.releasesqljooq.generated.tables.TAccount;
8 | import net.tongark.springboot.releasesqljooq.generated.tables.records.AccountRecord;
9 |
10 | import org.jooq.Identity;
11 | import org.jooq.TableField;
12 | import org.jooq.UniqueKey;
13 | import org.jooq.impl.Internal;
14 |
15 |
16 | /**
17 | * A class modelling foreign key relationships and constraints of tables of
18 | * the test01 schema.
19 | */
20 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
21 | public class Keys {
22 |
23 | // -------------------------------------------------------------------------
24 | // IDENTITY definitions
25 | // -------------------------------------------------------------------------
26 |
27 | public static final Identity IDENTITY_T_ACCOUNT = Identities0.IDENTITY_T_ACCOUNT;
28 |
29 | // -------------------------------------------------------------------------
30 | // UNIQUE and PRIMARY KEY definitions
31 | // -------------------------------------------------------------------------
32 |
33 | public static final UniqueKey KEY_T_ACCOUNT_PRIMARY = UniqueKeys0.KEY_T_ACCOUNT_PRIMARY;
34 |
35 | // -------------------------------------------------------------------------
36 | // FOREIGN KEY definitions
37 | // -------------------------------------------------------------------------
38 |
39 |
40 | // -------------------------------------------------------------------------
41 | // [#1459] distribute members to avoid static initialisers > 64kb
42 | // -------------------------------------------------------------------------
43 |
44 | private static class Identities0 {
45 | public static Identity IDENTITY_T_ACCOUNT = Internal.createIdentity(TAccount.T_ACCOUNT, TAccount.T_ACCOUNT.ID);
46 | }
47 |
48 | private static class UniqueKeys0 {
49 | public static final UniqueKey KEY_T_ACCOUNT_PRIMARY = Internal.createUniqueKey(TAccount.T_ACCOUNT, "KEY_t_account_PRIMARY", new TableField[] { TAccount.T_ACCOUNT.ID }, true);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/com/github/davidji80/springboot/mybatis/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mybatis.service.impl;
2 |
3 | import com.github.davidji80.springboot.mybatis.esdao.UserRepository;
4 | import com.github.davidji80.springboot.mybatis.mapper.UserMapper;
5 | import com.github.davidji80.springboot.mybatis.model.User;
6 | import com.github.davidji80.springboot.mybatis.service.UserService;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.cache.annotation.CacheConfig;
9 | import org.springframework.cache.annotation.CacheEvict;
10 | import org.springframework.cache.annotation.CachePut;
11 | import org.springframework.cache.annotation.Cacheable;
12 | import org.springframework.stereotype.Service;
13 | import org.springframework.transaction.annotation.Transactional;
14 |
15 | @Service
16 | @CacheConfig(cacheNames="userCache")
17 | @Transactional
18 | public class UserServiceImpl implements UserService {
19 |
20 | @Autowired
21 | private UserMapper userMapper;
22 | @Autowired
23 | private UserRepository userRepository;
24 |
25 | @Override
26 | @CachePut(key="#result.userId")
27 | public User addUser(User user) {
28 | userMapper.insert(user);
29 | /*//模拟抛出错误,测试事务
30 | String a = null;
31 | a.indexOf('c');*/
32 | userRepository.save(user);
33 | return user;
34 | }
35 |
36 | @Override
37 | @Cacheable(key = "#p0",unless="#result == null")
38 | public User findUserByID(int id) {
39 | User user=userMapper.selectByPrimaryKey(new Integer(id));
40 | return user;
41 | }
42 |
43 | @Override
44 | @CachePut(key="#result.userId",unless="#result == null")
45 | public User findUserByPhone(String phone) {
46 | User user=userMapper.selectByMobile(phone);
47 | return user;
48 | }
49 |
50 | @Override
51 | @CachePut(key="#p0.userId",unless="#result == null")
52 | public User updateUserByID(User user) {
53 | userMapper.updateByPrimaryKeySelective(user);
54 | return findUserByID(user.getUserId());
55 | }
56 |
57 | @Override
58 | @CacheEvict(key="#p0")
59 | public void deleteUserByID(int id) {
60 | userMapper.deleteByPrimaryKey(new Integer(id));
61 | }
62 |
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/web-service/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | web-service
13 | 0.0.1-SNAPSHOT
14 | web-service
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web-services
29 |
30 |
31 |
32 | net.tongark.spring
33 | web-service-api
34 | 1.0
35 |
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-test
40 | test
41 |
42 |
43 | org.junit.vintage
44 | junit-vintage-engine
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-maven-plugin
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/mybatis/src/main/resources/generator/generatorConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
34 |
35 |
36 |
37 |
39 |
40 |
--------------------------------------------------------------------------------
/helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.github.davidji80.springboot
7 | helloworld
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | helloworld
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-thymeleaf
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-thymeleaf
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-actuator
43 |
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-starter-test
48 | test
49 |
50 |
51 |
52 |
53 |
54 |
55 | org.springframework.boot
56 | spring-boot-maven-plugin
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/release-ms-kafka/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-kafka
13 | 0.0.1-SNAPSHOT
14 | release-kafka
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 | org.apache.kafka
28 | kafka-streams
29 |
30 |
31 | org.springframework.kafka
32 | spring-kafka
33 |
34 |
35 |
36 | org.springframework.boot
37 | spring-boot-starter-test
38 | test
39 |
40 |
41 | org.junit.vintage
42 | junit-vintage-engine
43 |
44 |
45 |
46 |
47 | org.springframework.kafka
48 | spring-kafka-test
49 | test
50 |
51 |
52 |
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/mybatis/src/main/resources/mapping/AccountMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | id, name
10 |
11 |
17 |
18 | delete from t_account
19 | where id = #{id,jdbcType=INTEGER}
20 |
21 |
22 | insert into t_account (id, name)
23 | values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})
24 |
25 |
26 | insert into t_account
27 |
28 |
29 | id,
30 |
31 |
32 | name,
33 |
34 |
35 |
36 |
37 | #{id,jdbcType=INTEGER},
38 |
39 |
40 | #{name,jdbcType=VARCHAR},
41 |
42 |
43 |
44 |
45 | update t_account
46 |
47 |
48 | name = #{name,jdbcType=VARCHAR},
49 |
50 |
51 | where id = #{id,jdbcType=INTEGER}
52 |
53 |
54 | update t_account
55 | set name = #{name,jdbcType=VARCHAR}
56 | where id = #{id,jdbcType=INTEGER}
57 |
58 |
--------------------------------------------------------------------------------
/mahout/src/main/resources/mybatisgenerator/generatorConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
34 |
35 |
36 |
37 |
39 |
41 |
42 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/tables/daos/AccountDao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated.tables.daos;
5 |
6 |
7 | import java.util.List;
8 |
9 | import net.tongark.springboot.releasesqljooq.generated.tables.TAccount;
10 | import net.tongark.springboot.releasesqljooq.generated.tables.pojos.Account;
11 | import net.tongark.springboot.releasesqljooq.generated.tables.records.AccountRecord;
12 |
13 | import org.jooq.Configuration;
14 | import org.jooq.impl.DAOImpl;
15 |
16 |
17 | /**
18 | * This class is generated by jOOQ.
19 | */
20 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
21 | public class AccountDao extends DAOImpl {
22 |
23 | /**
24 | * Create a new TAccountDao without any configuration
25 | */
26 | public AccountDao() {
27 | super(TAccount.T_ACCOUNT, Account.class);
28 | }
29 |
30 | /**
31 | * Create a new TAccountDao with an attached configuration
32 | */
33 | public AccountDao(Configuration configuration) {
34 | super(TAccount.T_ACCOUNT, Account.class, configuration);
35 | }
36 |
37 | @Override
38 | public Integer getId(Account object) {
39 | return object.getId();
40 | }
41 |
42 | /**
43 | * Fetch records that have id BETWEEN lowerInclusive AND upperInclusive
44 | */
45 | public List fetchRangeOfId(Integer lowerInclusive, Integer upperInclusive) {
46 | return fetchRange(TAccount.T_ACCOUNT.ID, lowerInclusive, upperInclusive);
47 | }
48 |
49 | /**
50 | * Fetch records that have id IN (values)
51 | */
52 | public List fetchById(Integer... values) {
53 | return fetch(TAccount.T_ACCOUNT.ID, values);
54 | }
55 |
56 | /**
57 | * Fetch a unique record that has id = value
58 | */
59 | public Account fetchOneById(Integer value) {
60 | return fetchOne(TAccount.T_ACCOUNT.ID, value);
61 | }
62 |
63 | /**
64 | * Fetch records that have name BETWEEN lowerInclusive AND upperInclusive
65 | */
66 | public List fetchRangeOfName(String lowerInclusive, String upperInclusive) {
67 | return fetchRange(TAccount.T_ACCOUNT.NAME, lowerInclusive, upperInclusive);
68 | }
69 |
70 | /**
71 | * Fetch records that have name IN (values)
72 | */
73 | public List fetchByName(String... values) {
74 | return fetch(TAccount.T_ACCOUNT.NAME, values);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/resources/generator/JooqConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.mysql.jdbc.Driver
6 | jdbc:mysql://192.168.1.7:3306/test01
7 | xhsit
8 | sit1818
9 |
10 |
11 |
12 |
17 | org.jooq.codegen.JavaGenerator
18 |
19 |
20 |
22 | org.jooq.meta.mysql.MySQLDatabase
23 |
24 |
26 | test01
27 |
28 |
31 | .*
32 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | true
43 | true
44 |
45 | true
46 |
47 |
48 | false
49 |
50 |
51 |
52 |
53 | net.tongark.springboot.releasesqljooq.generated
54 |
55 |
56 | src/main/java
57 |
58 |
59 |
--------------------------------------------------------------------------------
/mahout/src/main/java/com/github/davidji80/springboot/mahout/recommender/MovieRecommender.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.mahout.recommender;
2 |
3 | import org.apache.mahout.cf.taste.common.TasteException;
4 | import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
5 | import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender;
6 | import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
7 | import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender;
8 | import org.apache.mahout.cf.taste.impl.similarity.EuclideanDistanceSimilarity;
9 | import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity;
10 | import org.apache.mahout.cf.taste.model.DataModel;
11 | import org.apache.mahout.cf.taste.recommender.RecommendedItem;
12 | import org.apache.mahout.cf.taste.recommender.Recommender;
13 | import org.apache.mahout.cf.taste.similarity.ItemSimilarity;
14 | import org.apache.mahout.cf.taste.similarity.UserSimilarity;
15 | import org.springframework.stereotype.Component;
16 |
17 | import javax.annotation.Resource;
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | @Component
22 | public class MovieRecommender {
23 | final private int NEIGHBORHOOD_NUM = 10;
24 | @Resource(name = "fileDataModel")
25 | private DataModel dataModel;
26 |
27 | private List getRecommendedItemIDs(List recommendations){
28 | List recommendItems = new ArrayList<>();
29 | for(int i = 0 ; i < recommendations.size() ; i++) {
30 | RecommendedItem recommendedItem=recommendations.get(i);
31 | recommendItems.add(recommendedItem.getItemID());
32 | }
33 | return recommendItems;
34 | }
35 |
36 | public List userBasedRecommender(long userID,int size) throws TasteException {
37 | UserSimilarity similarity = new EuclideanDistanceSimilarity(dataModel );
38 | NearestNUserNeighborhood neighbor = new NearestNUserNeighborhood(NEIGHBORHOOD_NUM, similarity, dataModel );
39 | Recommender recommender = new CachingRecommender(new GenericUserBasedRecommender(dataModel , neighbor, similarity));
40 | List recommendations = recommender.recommend(userID, size);
41 | return getRecommendedItemIDs(recommendations);
42 | }
43 |
44 | public List itemBasedRecommender(long userID,int size) throws TasteException {
45 | List recommendItems = new ArrayList<>();
46 | ItemSimilarity itemSimilarity = new PearsonCorrelationSimilarity(dataModel);
47 | Recommender recommender = new GenericItemBasedRecommender(dataModel, itemSimilarity);
48 | List recommendations = recommender.recommend(userID, size);
49 | return getRecommendedItemIDs(recommendations);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/neo4j/src/main/java/com/github/davidji80/springboot/neo4j/controller/MovieController.java:
--------------------------------------------------------------------------------
1 | package com.github.davidji80.springboot.neo4j.controller;
2 |
3 | import com.github.davidji80.springboot.neo4j.model.ActedIn;
4 | import com.github.davidji80.springboot.neo4j.model.Directed;
5 | import com.github.davidji80.springboot.neo4j.model.Movie;
6 | import com.github.davidji80.springboot.neo4j.model.Person;
7 | import com.github.davidji80.springboot.neo4j.service.MovieServer;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.PathVariable;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.RestController;
12 |
13 | @RestController
14 | @RequestMapping("movie")
15 | public class MovieController {
16 | @Autowired
17 | private MovieServer movieServer;
18 |
19 | @RequestMapping("addPerson")
20 | public Person addPerson(Person person) {
21 | return movieServer.addPerson(person);
22 | }
23 |
24 | @RequestMapping("/findOnePerson/{id}")
25 | public Person findOnePerson(@PathVariable("id")String id){
26 | return movieServer.findOnePerson(Long.parseLong(id));
27 | }
28 |
29 | @RequestMapping("/deleteOnePerson/{id}")
30 | public String deleteOnePerson(@PathVariable("id")String id){
31 | movieServer.deleteOnePerson(Long.parseLong(id));
32 | return "success";
33 | }
34 |
35 | @RequestMapping("addMovie")
36 | public Movie addMobie(Movie movie) {
37 | return movieServer.addMovie(movie);
38 | }
39 |
40 | @RequestMapping("/findOneMovie/{id}")
41 | public Movie findOneMovie(@PathVariable("id")String id){
42 | return movieServer.findOneMovie(Long.parseLong(id));
43 | }
44 |
45 | @RequestMapping("/directed/{personId}/{movieId}")
46 | public Directed directed(@PathVariable("personId")String personId,@PathVariable("movieId")String movieId){
47 | Person person=movieServer.findOnePerson(Long.parseLong(personId));
48 | Movie movie=movieServer.findOneMovie(Long.parseLong(movieId));
49 | Directed directed=new Directed();
50 | directed.setStartNode(person);
51 | directed.setEndNode(movie);
52 | return movieServer.directed(directed);
53 | }
54 |
55 | @RequestMapping("/actedIn/{personId}/{movieId}")
56 | public ActedIn actedIn(@PathVariable("personId")String personId, @PathVariable("movieId")String movieId){
57 | Person person=movieServer.findOnePerson(Long.parseLong(personId));
58 | Movie movie=movieServer.findOneMovie(Long.parseLong(movieId));
59 | ActedIn actedIn=new ActedIn();
60 | actedIn.setRoles("龙套");
61 | actedIn.setStartNode(person);
62 | actedIn.setEndNode(movie);
63 | return movieServer.actedIn(actedIn);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/mahout/src/main/resources/mapping/MovieMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | id, title, genres
11 |
12 |
18 |
19 | delete from movie
20 | where id = #{id,jdbcType=INTEGER}
21 |
22 |
23 | insert into movie (id, title, genres
24 | )
25 | values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{genres,jdbcType=VARCHAR}
26 | )
27 |
28 |
29 | insert into movie
30 |
31 |
32 | id,
33 |
34 |
35 | title,
36 |
37 |
38 | genres,
39 |
40 |
41 |
42 |
43 | #{id,jdbcType=INTEGER},
44 |
45 |
46 | #{title,jdbcType=VARCHAR},
47 |
48 |
49 | #{genres,jdbcType=VARCHAR},
50 |
51 |
52 |
53 |
54 | update movie
55 |
56 |
57 | title = #{title,jdbcType=VARCHAR},
58 |
59 |
60 | genres = #{genres,jdbcType=VARCHAR},
61 |
62 |
63 | where id = #{id,jdbcType=INTEGER}
64 |
65 |
66 | update movie
67 | set title = #{title,jdbcType=VARCHAR},
68 | genres = #{genres,jdbcType=VARCHAR}
69 | where id = #{id,jdbcType=INTEGER}
70 |
71 |
76 |
83 |
84 |
--------------------------------------------------------------------------------
/release-sql-jooq/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.1.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-sql-jooq
13 | 0.0.1-SNAPSHOT
14 | release-sql-jooq
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-jooq
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 | mysql
32 | mysql-connector-java
33 | runtime
34 |
35 |
36 | commons-collections
37 | commons-collections
38 | 3.2.2
39 | compile
40 |
41 |
42 |
43 |
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-maven-plugin
48 |
49 |
50 |
51 | org.jooq
52 | jooq-codegen-maven
53 |
54 |
55 |
56 | generate
57 |
58 |
59 |
60 |
61 |
62 | mysql
63 | mysql-connector-java
64 | 8.0.20
65 |
66 |
67 |
68 |
69 | ${basedir}/src/main/resources/generator/JooqConfig.xml
70 |
71 |
72 | true
73 | true
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/release-atomikos/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.3.2.RELEASE
9 |
10 |
11 | net.tongark.springboot
12 | release-atomikos
13 | 0.0.1-SNAPSHOT
14 | release-atomikos
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-jdbc
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 | org.springframework.boot
32 | spring-boot-starter-jta-atomikos
33 |
34 |
35 | mysql
36 | mysql-connector-java
37 | runtime
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-starter-test
42 | test
43 |
44 |
45 | org.junit.vintage
46 | junit-vintage-engine
47 |
48 |
49 |
50 |
51 | mysql
52 | mysql-connector-java
53 | 8.0.21
54 | compile
55 |
56 |
57 | mysql
58 | mysql-connector-java
59 | 8.0.21
60 | compile
61 |
62 |
63 | mysql
64 | mysql-connector-java
65 | 8.0.21
66 | compile
67 |
68 |
69 | mysql
70 | mysql-connector-java
71 | 8.0.21
72 | compile
73 |
74 |
75 |
76 |
77 |
78 |
79 | org.springframework.boot
80 | spring-boot-maven-plugin
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/mybatis/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.github.davidji80.springboot
7 | mybatis
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | mybatis
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.5.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-jdbc
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-web
35 |
36 |
37 | org.mybatis.spring.boot
38 | mybatis-spring-boot-starter
39 | 1.3.2
40 |
41 |
42 |
43 | mysql
44 | mysql-connector-java
45 | runtime
46 |
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-starter-cache
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-starter-data-redis
55 |
56 |
57 |
58 | org.springframework.boot
59 | spring-boot-starter-data-elasticsearch
60 |
61 |
62 |
63 |
64 |
65 |
66 | org.springframework.boot
67 | spring-boot-maven-plugin
68 |
69 |
70 |
71 | org.mybatis.generator
72 | mybatis-generator-maven-plugin
73 | 1.4.0
74 |
75 |
76 | ${basedir}/src/main/resources/generator/generatorConfig.xml
77 | true
78 | true
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/mybatis/src/main/resources/mapping/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | user_id, user_name, password, phone
12 |
13 |
19 |
20 | delete from t_user
21 | where user_id = #{userId,jdbcType=INTEGER}
22 |
23 |
24 | insert into t_user ( user_name, password,
25 | phone)
26 | values ( #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
27 | #{phone,jdbcType=VARCHAR})
28 |
29 | SELECT LAST_INSERT_ID()
30 |
31 |
32 |
33 | insert into t_user
34 |
35 |
36 | user_id,
37 |
38 |
39 | user_name,
40 |
41 |
42 | password,
43 |
44 |
45 | phone,
46 |
47 |
48 |
49 |
50 | #{userId,jdbcType=INTEGER},
51 |
52 |
53 | #{userName,jdbcType=VARCHAR},
54 |
55 |
56 | #{password,jdbcType=VARCHAR},
57 |
58 |
59 | #{phone,jdbcType=VARCHAR},
60 |
61 |
62 |
63 |
64 | update t_user
65 |
66 |
67 | user_name = #{userName,jdbcType=VARCHAR},
68 |
69 |
70 | password = #{password,jdbcType=VARCHAR},
71 |
72 |
73 | phone = #{phone,jdbcType=VARCHAR},
74 |
75 |
76 | where user_id = #{userId,jdbcType=INTEGER}
77 |
78 |
79 | update t_user
80 | set user_name = #{userName,jdbcType=VARCHAR},
81 | password = #{password,jdbcType=VARCHAR},
82 | phone = #{phone,jdbcType=VARCHAR}
83 | where user_id = #{userId,jdbcType=INTEGER}
84 |
85 |
92 |
--------------------------------------------------------------------------------
/mahout/src/main/resources/mapping/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | id, gender, age, occupation, zip_code
13 |
14 |
20 |
21 | delete from user
22 | where id = #{id,jdbcType=INTEGER}
23 |
24 |
25 | insert into user (id, gender, age,
26 | occupation, zip_code)
27 | values (#{id,jdbcType=INTEGER}, #{gender,jdbcType=CHAR}, #{age,jdbcType=INTEGER},
28 | #{occupation,jdbcType=INTEGER}, #{zipCode,jdbcType=VARCHAR})
29 |
30 |
31 | insert into user
32 |
33 |
34 | id,
35 |
36 |
37 | gender,
38 |
39 |
40 | age,
41 |
42 |
43 | occupation,
44 |
45 |
46 | zip_code,
47 |
48 |
49 |
50 |
51 | #{id,jdbcType=INTEGER},
52 |
53 |
54 | #{gender,jdbcType=CHAR},
55 |
56 |
57 | #{age,jdbcType=INTEGER},
58 |
59 |
60 | #{occupation,jdbcType=INTEGER},
61 |
62 |
63 | #{zipCode,jdbcType=VARCHAR},
64 |
65 |
66 |
67 |
68 | update user
69 |
70 |
71 | gender = #{gender,jdbcType=CHAR},
72 |
73 |
74 | age = #{age,jdbcType=INTEGER},
75 |
76 |
77 | occupation = #{occupation,jdbcType=INTEGER},
78 |
79 |
80 | zip_code = #{zipCode,jdbcType=VARCHAR},
81 |
82 |
83 | where id = #{id,jdbcType=INTEGER}
84 |
85 |
86 | update user
87 | set gender = #{gender,jdbcType=CHAR},
88 | age = #{age,jdbcType=INTEGER},
89 | occupation = #{occupation,jdbcType=INTEGER},
90 | zip_code = #{zipCode,jdbcType=VARCHAR}
91 | where id = #{id,jdbcType=INTEGER}
92 |
93 |
99 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/tables/records/AccountRecord.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated.tables.records;
5 |
6 |
7 | import net.tongark.springboot.releasesqljooq.generated.tables.TAccount;
8 |
9 | import org.jooq.Field;
10 | import org.jooq.Record1;
11 | import org.jooq.Record2;
12 | import org.jooq.Row2;
13 | import org.jooq.impl.UpdatableRecordImpl;
14 |
15 |
16 | /**
17 | * This class is generated by jOOQ.
18 | */
19 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
20 | public class AccountRecord extends UpdatableRecordImpl implements Record2 {
21 |
22 | private static final long serialVersionUID = -1997538982;
23 |
24 | /**
25 | * Setter for test01.t_account.id.
26 | */
27 | public AccountRecord setId(Integer value) {
28 | set(0, value);
29 | return this;
30 | }
31 |
32 | /**
33 | * Getter for test01.t_account.id.
34 | */
35 | public Integer getId() {
36 | return (Integer) get(0);
37 | }
38 |
39 | /**
40 | * Setter for test01.t_account.name.
41 | */
42 | public AccountRecord setName(String value) {
43 | set(1, value);
44 | return this;
45 | }
46 |
47 | /**
48 | * Getter for test01.t_account.name.
49 | */
50 | public String getName() {
51 | return (String) get(1);
52 | }
53 |
54 | // -------------------------------------------------------------------------
55 | // Primary key information
56 | // -------------------------------------------------------------------------
57 |
58 | @Override
59 | public Record1 key() {
60 | return (Record1) super.key();
61 | }
62 |
63 | // -------------------------------------------------------------------------
64 | // Record2 type implementation
65 | // -------------------------------------------------------------------------
66 |
67 | @Override
68 | public Row2 fieldsRow() {
69 | return (Row2) super.fieldsRow();
70 | }
71 |
72 | @Override
73 | public Row2 valuesRow() {
74 | return (Row2) super.valuesRow();
75 | }
76 |
77 | @Override
78 | public Field field1() {
79 | return TAccount.T_ACCOUNT.ID;
80 | }
81 |
82 | @Override
83 | public Field field2() {
84 | return TAccount.T_ACCOUNT.NAME;
85 | }
86 |
87 | @Override
88 | public Integer component1() {
89 | return getId();
90 | }
91 |
92 | @Override
93 | public String component2() {
94 | return getName();
95 | }
96 |
97 | @Override
98 | public Integer value1() {
99 | return getId();
100 | }
101 |
102 | @Override
103 | public String value2() {
104 | return getName();
105 | }
106 |
107 | @Override
108 | public AccountRecord value1(Integer value) {
109 | setId(value);
110 | return this;
111 | }
112 |
113 | @Override
114 | public AccountRecord value2(String value) {
115 | setName(value);
116 | return this;
117 | }
118 |
119 | @Override
120 | public AccountRecord values(Integer value1, String value2) {
121 | value1(value1);
122 | value2(value2);
123 | return this;
124 | }
125 |
126 | // -------------------------------------------------------------------------
127 | // Constructors
128 | // -------------------------------------------------------------------------
129 |
130 | /**
131 | * Create a detached TAccountRecord
132 | */
133 | public AccountRecord() {
134 | super(TAccount.T_ACCOUNT);
135 | }
136 |
137 | /**
138 | * Create a detached, initialised TAccountRecord
139 | */
140 | public AccountRecord(Integer id, String name) {
141 | super(TAccount.T_ACCOUNT);
142 |
143 | set(0, id);
144 | set(1, name);
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/release-sql-jooq/src/main/java/net/tongark/springboot/releasesqljooq/generated/tables/TAccount.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is generated by jOOQ.
3 | */
4 | package net.tongark.springboot.releasesqljooq.generated.tables;
5 |
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | import net.tongark.springboot.releasesqljooq.generated.Keys;
11 | import net.tongark.springboot.releasesqljooq.generated.Test01;
12 | import net.tongark.springboot.releasesqljooq.generated.tables.records.AccountRecord;
13 |
14 | import org.jooq.Field;
15 | import org.jooq.ForeignKey;
16 | import org.jooq.Identity;
17 | import org.jooq.Name;
18 | import org.jooq.Record;
19 | import org.jooq.Row2;
20 | import org.jooq.Schema;
21 | import org.jooq.Table;
22 | import org.jooq.TableField;
23 | import org.jooq.TableOptions;
24 | import org.jooq.UniqueKey;
25 | import org.jooq.impl.DSL;
26 | import org.jooq.impl.TableImpl;
27 |
28 |
29 | /**
30 | * This class is generated by jOOQ.
31 | */
32 | @SuppressWarnings({ "all", "unchecked", "rawtypes" })
33 | public class TAccount extends TableImpl {
34 |
35 | private static final long serialVersionUID = 1120441562;
36 |
37 | /**
38 | * The reference instance of test01.t_account
39 | */
40 | public static final TAccount T_ACCOUNT = new TAccount();
41 |
42 | /**
43 | * The class holding records for this type
44 | */
45 | @Override
46 | public Class getRecordType() {
47 | return AccountRecord.class;
48 | }
49 |
50 | /**
51 | * The column test01.t_account.id.
52 | */
53 | public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false).identity(true), this, "");
54 |
55 | /**
56 | * The column test01.t_account.name.
57 | */
58 | public final TableField NAME = createField(DSL.name("name"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "");
59 |
60 | /**
61 | * Create a test01.t_account table reference
62 | */
63 | public TAccount() {
64 | this(DSL.name("t_account"), null);
65 | }
66 |
67 | /**
68 | * Create an aliased test01.t_account table reference
69 | */
70 | public TAccount(String alias) {
71 | this(DSL.name(alias), T_ACCOUNT);
72 | }
73 |
74 | /**
75 | * Create an aliased test01.t_account table reference
76 | */
77 | public TAccount(Name alias) {
78 | this(alias, T_ACCOUNT);
79 | }
80 |
81 | private TAccount(Name alias, Table aliased) {
82 | this(alias, aliased, null);
83 | }
84 |
85 | private TAccount(Name alias, Table aliased, Field>[] parameters) {
86 | super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
87 | }
88 |
89 | public TAccount(Table child, ForeignKey key) {
90 | super(child, key, T_ACCOUNT);
91 | }
92 |
93 | @Override
94 | public Schema getSchema() {
95 | return Test01.TEST01;
96 | }
97 |
98 | @Override
99 | public Identity getIdentity() {
100 | return Keys.IDENTITY_T_ACCOUNT;
101 | }
102 |
103 | @Override
104 | public UniqueKey getPrimaryKey() {
105 | return Keys.KEY_T_ACCOUNT_PRIMARY;
106 | }
107 |
108 | @Override
109 | public List> getKeys() {
110 | return Arrays.>asList(Keys.KEY_T_ACCOUNT_PRIMARY);
111 | }
112 |
113 | @Override
114 | public TAccount as(String alias) {
115 | return new TAccount(DSL.name(alias), this);
116 | }
117 |
118 | @Override
119 | public TAccount as(Name alias) {
120 | return new TAccount(alias, this);
121 | }
122 |
123 | /**
124 | * Rename this table
125 | */
126 | @Override
127 | public TAccount rename(String name) {
128 | return new TAccount(DSL.name(name), null);
129 | }
130 |
131 | /**
132 | * Rename this table
133 | */
134 | @Override
135 | public TAccount rename(Name name) {
136 | return new TAccount(name, null);
137 | }
138 |
139 | // -------------------------------------------------------------------------
140 | // Row2 type methods
141 | // -------------------------------------------------------------------------
142 |
143 | @Override
144 | public Row2 fieldsRow() {
145 | return (Row2) super.fieldsRow();
146 | }
147 | }
148 |
--------------------------------------------------------------------------------