├── COPYING
├── .gitignore
├── src
└── main
│ ├── resources
│ ├── META-INF
│ │ ├── spring
│ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports
│ │ └── spring.factories
│ ├── jdbcTypeToFieldType.properties
│ ├── jdbcTypeToFieldType-MySQL.properties
│ ├── jdbcTypeToFieldType-Oracle.properties
│ ├── beeMongoContext.xml
│ ├── beeContext.xml
│ └── bee.properties
│ └── java
│ └── org
│ └── teasoft
│ └── spring
│ └── boot
│ └── config
│ ├── BeeXmlConfiguration.java
│ ├── BeeMongoXmlConfiguration.java
│ ├── SpringDatasourceConfig.java
│ ├── BeeAutoConfiguration.java
│ ├── BeeProperties.java
│ └── BeeManageConfig.java
├── README_CN.md
├── README.md
├── pom.xml
└── LICENSE
/COPYING:
--------------------------------------------------------------------------------
1 | See the LICENSE file.
2 | 查看LICENSE文件.
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.settings/
3 | /.classpath
4 | /.project
5 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | org.teasoft.spring.boot.config.BeeProperties
2 | org.teasoft.spring.boot.config.BeeManageConfig
3 | org.teasoft.spring.boot.config.BeeXmlConfiguration
4 | org.teasoft.spring.boot.config.BeeMongoXmlConfiguration
5 | org.teasoft.spring.boot.config.BeeAutoConfiguration
--------------------------------------------------------------------------------
/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | # Auto Configure
2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
3 | org.teasoft.spring.boot.config.BeeProperties,\
4 | org.teasoft.spring.boot.config.BeeManageConfig,\
5 | org.teasoft.spring.boot.config.BeeXmlConfiguration,\
6 | org.teasoft.spring.boot.config.BeeMongoXmlConfiguration,\
7 | org.teasoft.spring.boot.config.BeeAutoConfiguration
8 |
--------------------------------------------------------------------------------
/src/main/resources/jdbcTypeToFieldType.properties:
--------------------------------------------------------------------------------
1 |
2 | #JDBC_type=define_type(java field type)
3 | #\u82e5\u6709jdbcTypeToFieldType-{DbName}.properties,\u5219\u4f1a\u8986\u76d6\u8fd9\u4e2a\u6587\u4ef6\u76f8\u540ckey\u7684\u503c
4 |
5 | #\u82e5key\u6709\u7a7a\u683c\u8981\u7528\\u8f6c\u4e49
6 | #\u8981\u662f\u7c7b\u4e0d\u5728java.lang\u4e0b,\u7528\u5b8c\u6574\u7c7b\u540d
7 | #java.lang.String can just use:String
8 |
9 | JSON=String
10 | TEXT=String
11 | LONGTEXT=String
--------------------------------------------------------------------------------
/src/main/resources/jdbcTypeToFieldType-MySQL.properties:
--------------------------------------------------------------------------------
1 | #mysql
2 |
3 | #JDBC_type=define_type
4 | #jdbcTypeToFieldType-{DbName}.properties,\u4f1a\u8986\u76d6jdbcTypeToFieldType.properties\u76f8\u540ckey\u7684\u503c
5 |
6 | #\u82e5key\u6709\u7a7a\u683c\u8981\u8f6c\u4e49
7 | #TINYINT\ UNSIGNED=Byte
8 | #\u8981\u662f\u7c7b\u4e0d\u5728java.lang\u4e0b,\u7528\u5b8c\u6574\u7c7b\u540d
9 | #java.lang.String can just use:String
10 | #VARCHAR=String
11 | #mysql 8.0
12 | TINYTEXT=String
13 | MEDIUMTEXT=String
14 | LONGTEXT=String
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/jdbcTypeToFieldType-Oracle.properties:
--------------------------------------------------------------------------------
1 | #oracle
2 |
3 | #JDBC_type=define_type
4 | #jdbcTypeToFieldType-{DbName}.properties,\u4f1a\u8986\u76d6jdbcTypeToFieldType.properties\u76f8\u540ckey\u7684\u503c
5 |
6 | #\u82e5key\u6709\u7a7a\u683c\u8981\u7528\\u8f6c\u4e49
7 | #\u8981\u662f\u7c7b\u4e0d\u5728java.lang\u4e0b,\u7528\u5b8c\u6574\u7c7b\u540d
8 | #java.lang.String can just use:String
9 | #key\u8981\u5927\u5199\u624d\u884c
10 | BINARY_DOUBLE=oracle.sql.BINARY_DOUBLE
11 | BINARY_FLOAT=oracle.sql.BINARY_FLOAT
12 |
13 | #Oracle DATE\u5b57\u6bb5\u5728Javabean\u91cc\u8f6c\u6210java.sql.Date\u5b58\u5165\u6570\u636e\u5e93\u65f6\u4f1a\u4e22\u5931\u65f6\u5206\u79d2\uff0c\u8f6c\u6210Timestamp\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002
14 | #Fix the problem:miss the hour,minute,second in Oracle DATE column.
15 | DATE=Timestamp
16 |
--------------------------------------------------------------------------------
/src/main/java/org/teasoft/spring/boot/config/BeeXmlConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2021 the original author.All rights reserved.
3 | * Kingstar(honeysoft@126.com)
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.teasoft.spring.boot.config;
19 |
20 | import org.springframework.context.annotation.Configuration;
21 | import org.springframework.context.annotation.ImportResource;
22 |
23 | /**
24 | * @author Kingstar
25 | * @since 1.9
26 | */
27 | @Configuration
28 | @ImportResource("classpath:beeContext.xml")
29 | public class BeeXmlConfiguration {
30 |
31 | public BeeXmlConfiguration() {}
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 |
2 | Bee + Spring Boot
3 | =========
4 | ## Bee整合Spring Boot,让你瞬间拥有两样快速开发利器!
5 |
6 | 如果想直接使用starter,请查看:
7 | [bee-spring-boot-starter](../../../bee-spring-boot-starter)
8 |
9 | **Bee** 是一个简单,易用,功能强大,开发速度快,编码少的 JAVA ORM 框架。
10 | Bee简单易用:单表操作、多表关联操作,可以不用写sql,极少语句就可以完成SQL操作;**概念简单**,10分钟即可入门。
11 | Bee功能强大:复杂查询也支持向对象方式,分页查询性能更高,一级缓存即可支持个性化优化;具有分布式特性。高级要求,还可以方便自定义SQL语句。
12 |
13 | **Spring Boot**是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,
14 | 从而使开发人员不再需要定义样板化的配置。通过这种方式,**Spring Boot**可以帮助我们进行**快速应用开发**。
15 |
16 | **2.1.7.boot3.0.13需要JDK17**
17 |
18 | **Bee** url:
19 | https://github.com/automvc/bee
20 | 或者:
21 | https://gitee.com/automvc/bee
22 |
23 | 快速开始:
24 | =========
25 | [bee-starter-demo](../../../bee-starter-demo)
26 |
27 | 综合应用:
28 | =========
29 | **Java快速编程, 让Java的开发速度超过php和Rails。**
30 |
31 | **更快的开发Java Web的新组合:**
32 | [Bee+Spring+SpringMVC](../../../../aiteasoft/bee-spring-springmvc)
33 | **包括仅分库多数据源实例**
34 |
35 | **更快的开发Spring Cloud微服务的新组合:**
36 | [Bee + Spring Boot](../../../bee-springboot)
37 |
38 | 联系与欢迎:
39 | =========
40 | #### 作者的email: honeysoft@126.com
41 | #### 如有任何相关建议,欢迎给作者发邮件,不胜感激!
42 |
43 | #### 为了能及时解答大家的疑问,可以加入Bee的技术QQ群:992650213
44 |
45 | #### 同时,也欢迎你加入到Bee框架的开发之中,相信有你的加入,Bee会更加美好!
--------------------------------------------------------------------------------
/src/main/java/org/teasoft/spring/boot/config/BeeMongoXmlConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2021 the original author.All rights reserved.
3 | * Kingstar(honeysoft@126.com)
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.teasoft.spring.boot.config;
19 |
20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
21 | import org.springframework.context.annotation.Configuration;
22 | import org.springframework.context.annotation.ImportResource;
23 |
24 | /**
25 | * @author Kingstar
26 | * @since 2.1
27 | */
28 | @Configuration
29 | @ConditionalOnProperty(name = "bee.db.hasMongodb", havingValue = "true", matchIfMissing = false)
30 | @ImportResource("classpath:beeMongoContext.xml")
31 | public class BeeMongoXmlConfiguration {
32 |
33 | public BeeMongoXmlConfiguration() {}
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | Bee + Spring Boot
3 | =========
4 | ## Bee integration with Spring Boot
5 | bee-spring-boot will help you to use Bee with Spring Boot.
6 | It is faster development of new combinations for Spring Cloud microservices.
7 |
8 | If you want to use the starter directly,please see:
9 | [bee-spring-boot-starter](../../../bee-spring-boot-starter)
10 |
11 | **Bee** is an easy and high efficiency ORM framework.
12 |
13 | **Spring Boot** makes it easy to create stand-alone, production-grade Spring based Applications
14 | that you can "just run". Most Spring Boot applications need minimal Spring configuration.
15 |
16 | **Bee** see:
17 | https://github.com/automvc/bee
18 | or:
19 | https://gitee.com/automvc/bee
20 |
21 | Quick Start
22 | =========
23 | [bee-starter-demo](../../../bee-starter-demo)
24 |
25 |
26 | Rapid application development:
27 | =========
28 | **Let Java more quicker programming than php and Rails.**
29 |
30 | **Faster development of new combinations for Spring Cloud microservices:**
31 | [Bee + Spring Boot](../../../bee-springboot)
32 |
33 | **Faster development of new combinations for Java Web:**
34 | [Bee+Spring+SpringMVC](../../../../aiteasoft/bee-spring-springmvc)
35 |
36 |
37 | Contact & Welcome:
38 | =========
39 | #### Author's email: honeysoft@126.com
40 | #### If you have any problem on bee, please let me know kindly! Thank you, so much!
41 | #### ORM QQ Group: 992650213 WeChat:AiTeaSoft
42 | #### At the same time, welcome you to join Bee team create a better future.
--------------------------------------------------------------------------------
/src/main/java/org/teasoft/spring/boot/config/SpringDatasourceConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2023 the original author.All rights reserved.
3 | * Kingstar(honeysoft@126.com)
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.teasoft.spring.boot.config;
19 |
20 | /**
21 | * @author Kingstar
22 | * @since 2.1.8
23 | */
24 | public class SpringDatasourceConfig {
25 |
26 | private String url;
27 | private String username;
28 | private String password;
29 | private String driverClassName;
30 |
31 | public String getUrl() {
32 | return url;
33 | }
34 | public void setUrl(String url) {
35 | this.url = url;
36 | }
37 | public String getUsername() {
38 | return username;
39 | }
40 | public void setUsername(String username) {
41 | this.username = username;
42 | }
43 | public String getPassword() {
44 | return password;
45 | }
46 | public void setPassword(String password) {
47 | this.password = password;
48 | }
49 | public String getDriverClassName() {
50 | return driverClassName;
51 | }
52 | public void setDriverClassName(String driverClassName) {
53 | this.driverClassName = driverClassName;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/resources/beeMongoContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/java/org/teasoft/spring/boot/config/BeeAutoConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2021 the original author.All rights reserved.
3 | * Kingstar(honeysoft@126.com)
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.teasoft.spring.boot.config;
19 |
20 | import javax.sql.DataSource;
21 |
22 | import org.springframework.boot.autoconfigure.AutoConfigureAfter;
23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
25 | import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
26 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
27 | import org.springframework.context.annotation.Bean;
28 | import org.springframework.context.annotation.Configuration;
29 | import org.teasoft.honey.osql.core.BeeFactory;
30 | import org.teasoft.honey.osql.core.SessionFactory;
31 |
32 | /**
33 | * @author Kingstar
34 | * @since 1.9
35 | */
36 | @Configuration
37 | @AutoConfigureAfter({ BeeManageConfig.class, DataSourceAutoConfiguration.class,
38 | BeeXmlConfiguration.class, BeeMongoXmlConfiguration.class })
39 | public class BeeAutoConfiguration {
40 |
41 | public BeeAutoConfiguration() {}
42 |
43 | @Bean
44 | @ConditionalOnMissingBean
45 | @ConditionalOnSingleCandidate(DataSource.class)
46 | public BeeFactory beeFactory(DataSource dataSource) {
47 | BeeFactory beeFactory = BeeFactory.getInstance();
48 | beeFactory.setDataSource(dataSource);
49 | return beeFactory;
50 | }
51 |
52 | @Bean
53 | @ConditionalOnMissingBean
54 | @ConditionalOnBean(BeeFactory.class)
55 | public SessionFactory sessionFactory(BeeFactory beeFactory) {
56 | SessionFactory factory = new SessionFactory();
57 | factory.setBeeFactory(beeFactory);
58 | return factory;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/resources/beeContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 | org.teasoft
6 | bee-spring-boot
7 | 2.5.2
8 |
9 | jar
10 | bee-spring-boot
11 | bee-spring-boot
12 |
13 |
14 | UTF-8
15 | 1.8
16 | 1.8
17 | 1.8
18 | ${project.version}
19 |
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-dependencies
26 | 2.7.18
27 |
28 | pom
29 | import
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-autoconfigure
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-autoconfigure-processor
44 | true
45 |
46 |
47 |
48 | org.teasoft
49 | bee
50 | ${bee.version}
51 |
52 |
53 |
54 | org.teasoft
55 | honey
56 | ${bee.version}
57 |
58 |
59 |
60 | org.teasoft
61 | bee-ext
62 | ${bee.version}
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | org.apache.maven.plugins
71 | maven-jar-plugin
72 | 3.0.0
73 |
74 |
75 |
76 |
77 | org.apache.maven.plugins
78 | maven-source-plugin
79 | 3.0.0
80 |
81 |
82 | attach-sources
83 |
84 | jar
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | org.apache.maven.plugins
93 | maven-javadoc-plugin
94 | 3.0.0
95 |
96 | UTF-8
97 | UTF-8
98 | UTF-8
99 | en_US
100 | -Xdoclint:none
101 | none
102 |
103 |
104 |
105 | package
106 |
107 | jar
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/src/main/java/org/teasoft/spring/boot/config/BeeProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2021 the original author.All rights reserved.
3 | * Kingstar(honeysoft@126.com)
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.teasoft.spring.boot.config;
19 |
20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
21 | import org.springframework.boot.context.properties.ConfigurationProperties;
22 | import org.springframework.context.annotation.Bean;
23 | import org.springframework.context.annotation.Configuration;
24 | import org.teasoft.beex.config.BeePro;
25 | import org.teasoft.beex.config.BeeProCache;
26 | import org.teasoft.beex.config.BeeProCacheRedis;
27 | import org.teasoft.beex.config.BeeProDb;
28 | import org.teasoft.beex.config.BeeProGenid;
29 | import org.teasoft.beex.config.BeeProMoreTable;
30 | import org.teasoft.beex.config.BeeProMultiDS;
31 | import org.teasoft.beex.config.BeeProNaming;
32 | import org.teasoft.beex.config.BeeProPearFlowerId;
33 | import org.teasoft.beex.config.BeeProProfiles;
34 | import org.teasoft.beex.config.BeeProReturnStringList;
35 | import org.teasoft.beex.config.BeeProSelectJson;
36 | import org.teasoft.beex.config.BeeProSharding;
37 | import org.teasoft.beex.config.BeeProShowSql;
38 |
39 | /**
40 | * @author Kingstar
41 | * @since 1.9
42 | */
43 | @Configuration
44 | public class BeeProperties {
45 |
46 | @Bean
47 | @ConditionalOnClass(BeePro.class)
48 | @ConfigurationProperties(prefix = "bee.osql")
49 | public BeePro getBeePro() {
50 | return new BeePro();
51 | }
52 |
53 | @Bean
54 | @ConditionalOnClass(BeeProCache.class)
55 | @ConfigurationProperties(prefix = "bee.osql.cache")
56 | public BeeProCache getBeeProCache() {
57 | return new BeeProCache();
58 | }
59 |
60 | @Bean
61 | @ConditionalOnClass(BeeProCacheRedis.class)
62 | @ConfigurationProperties(prefix = "bee.osql.cache-redis")
63 | public BeeProCacheRedis getBeeProCacheRedis() {
64 | return new BeeProCacheRedis();
65 | }
66 |
67 | @Bean
68 | @ConditionalOnClass(BeeProDb.class)
69 | @ConfigurationProperties(prefix = "bee.db")
70 | public BeeProDb getBeeProDb() {
71 | return new BeeProDb();
72 | }
73 |
74 | @Bean
75 | @ConditionalOnClass(BeeProProfiles.class)
76 | @ConfigurationProperties(prefix = "bee.profiles")
77 | public BeeProProfiles getBeeProProfiles() { //V1.11
78 | return new BeeProProfiles();
79 | }
80 |
81 | @Bean
82 | @ConditionalOnClass(BeeProGenid.class)
83 | @ConfigurationProperties(prefix = "bee.distribution.genid")
84 | public BeeProGenid getBeeProGenid() {
85 | return new BeeProGenid();
86 | }
87 |
88 | @Bean
89 | @ConditionalOnClass(BeeProMoreTable.class)
90 | @ConfigurationProperties(prefix = "bee.osql.more-table")
91 | public BeeProMoreTable getBeeProMoreTable() {
92 | return new BeeProMoreTable();
93 | }
94 |
95 | @Bean
96 | @ConditionalOnClass(BeeProMultiDS.class)
97 | @ConfigurationProperties(prefix = "bee.dosql.multi-d-s")
98 | public BeeProMultiDS getBeeProMultiDS() {
99 | return new BeeProMultiDS();
100 | }
101 |
102 | @Bean
103 | @ConditionalOnClass(BeeProSharding.class)
104 | @ConfigurationProperties(prefix = "bee.dosql.sharding")
105 | public BeeProSharding getBeeProSharding() {
106 | return new BeeProSharding();
107 | }
108 |
109 | @Bean
110 | @ConditionalOnClass(BeeProNaming.class)
111 | @ConfigurationProperties(prefix = "bee.osql.naming")
112 | public BeeProNaming getBeeProNaming() {
113 | return new BeeProNaming();
114 | }
115 |
116 | @Bean
117 | @ConditionalOnClass(BeeProPearFlowerId.class)
118 | @ConfigurationProperties(prefix = "bee.distribution.pear-flower-id")
119 | public BeeProPearFlowerId getBeeProPearFlowerId() {
120 | return new BeeProPearFlowerId();
121 | }
122 |
123 | @Bean
124 | @ConditionalOnClass(BeeProReturnStringList.class)
125 | @ConfigurationProperties(prefix = "bee.osql.return-string-list")
126 | public BeeProReturnStringList getBeeProReturnStringList() {
127 | return new BeeProReturnStringList();
128 | }
129 |
130 | @Bean
131 | @ConditionalOnClass(BeeProSelectJson.class)
132 | @ConfigurationProperties(prefix = "bee.osql.select-json")
133 | public BeeProSelectJson getBeeProSelectJson() {
134 | return new BeeProSelectJson();
135 | }
136 |
137 | @Bean
138 | @ConditionalOnClass(BeeProShowSql.class)
139 | @ConfigurationProperties(prefix = "bee.osql.show-sql")
140 | public BeeProShowSql getBeeProShowSql() {
141 | return new BeeProShowSql();
142 | }
143 |
144 | @Bean
145 | @ConditionalOnClass(SpringDatasourceConfig.class)
146 | @ConfigurationProperties(prefix = "spring.datasource")
147 | public SpringDatasourceConfig getSpringDatasourceConfig() {
148 | return new SpringDatasourceConfig();
149 | }
150 |
151 | }
152 |
--------------------------------------------------------------------------------
/src/main/java/org/teasoft/spring/boot/config/BeeManageConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2021 the original author.All rights reserved.
3 | * Kingstar(honeysoft@126.com)
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.teasoft.spring.boot.config;
19 |
20 | import org.springframework.beans.factory.annotation.Autowired;
21 | import org.springframework.boot.autoconfigure.AutoConfigureAfter;
22 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
23 | import org.springframework.context.EnvironmentAware;
24 | import org.springframework.context.annotation.Bean;
25 | import org.springframework.core.env.Environment;
26 | import org.teasoft.beex.config.BeePro;
27 | import org.teasoft.beex.config.BeeProCache;
28 | import org.teasoft.beex.config.BeeProCacheRedis;
29 | import org.teasoft.beex.config.BeeProDb;
30 | import org.teasoft.beex.config.BeeProGenid;
31 | import org.teasoft.beex.config.BeeProMoreTable;
32 | import org.teasoft.beex.config.BeeProMultiDS;
33 | import org.teasoft.beex.config.BeeProNaming;
34 | import org.teasoft.beex.config.BeeProPearFlowerId;
35 | import org.teasoft.beex.config.BeeProProfiles;
36 | import org.teasoft.beex.config.BeeProReturnStringList;
37 | import org.teasoft.beex.config.BeeProSelectJson;
38 | import org.teasoft.beex.config.BeeProSharding;
39 | import org.teasoft.beex.config.BeeProShowSql;
40 | import org.teasoft.beex.config.ManageConfig;
41 | import org.teasoft.honey.util.StringUtils;
42 |
43 | /**
44 | * @author Kingstar
45 | * @since 1.9
46 | */
47 | @AutoConfigureAfter(BeeProperties.class)
48 | public class BeeManageConfig implements EnvironmentAware{
49 | @Autowired
50 | private BeePro beePro;
51 | @Autowired
52 | private BeeProCache beeProCache;
53 | @Autowired
54 | private BeeProCacheRedis beeProCacheRedis;
55 | @Autowired
56 | private BeeProDb beeProDb;
57 | @Autowired
58 | private BeeProProfiles beeProProfiles; //V1.11
59 | @Autowired
60 | private BeeProGenid beeProGenid;
61 | @Autowired
62 | private BeeProMoreTable beeProMoreTable;
63 | @Autowired
64 | private BeeProMultiDS beeProMultiDS;
65 | @Autowired
66 | private BeeProSharding beeProSharding; //V2.0
67 | @Autowired
68 | private BeeProNaming beeProNaming;
69 | @Autowired
70 | private BeeProPearFlowerId beeProPearFlowerId;
71 | @Autowired
72 | private BeeProReturnStringList beeProReturnStringList;
73 | @Autowired
74 | private BeeProSelectJson beeProSelectJson;
75 |
76 | @Autowired
77 | private BeeProShowSql beeProShowSql;
78 |
79 | @Autowired
80 | private SpringDatasourceConfig springDatasourceConfig;
81 |
82 | @Bean
83 | @ConditionalOnClass(ManageConfig.class)
84 | public ManageConfig manageConfig() {
85 |
86 | //spring.datasource与bee.db四个属性整合,spring.datasource会覆盖bee.db的
87 | if (getSpringDatasourceConfig() != null && getBeeProDb() != null) {
88 | if (StringUtils.isNotBlank(getSpringDatasourceConfig().getUrl())) {
89 | getBeeProDb().setUrl(getSpringDatasourceConfig().getUrl());
90 | }
91 |
92 | if (StringUtils.isNotBlank(getSpringDatasourceConfig().getUsername())) {
93 | getBeeProDb().setUsername(getSpringDatasourceConfig().getUsername());
94 | }
95 |
96 | if (StringUtils.isNotBlank(getSpringDatasourceConfig().getPassword())) {
97 | getBeeProDb().setPassword(getSpringDatasourceConfig().getPassword());
98 | }
99 |
100 | if (StringUtils.isNotBlank(getSpringDatasourceConfig().getDriverClassName())) {
101 | getBeeProDb().setDriverName(getSpringDatasourceConfig().getDriverClassName());
102 | }
103 | }
104 |
105 | ManageConfig manageConfig1 = new ManageConfig();
106 | manageConfig1.setBeePro(beePro);
107 | manageConfig1.setBeeProCache(beeProCache);
108 | manageConfig1.setBeeProCacheRedis(beeProCacheRedis);
109 | manageConfig1.setBeeProDb(beeProDb);
110 | manageConfig1.setBeeProProfiles(beeProProfiles); //V1.11
111 | manageConfig1.setBeeProGenid(beeProGenid);
112 | manageConfig1.setBeeProMoreTable(beeProMoreTable);
113 | manageConfig1.setBeeProMultiDS(beeProMultiDS);
114 | manageConfig1.setBeeProSharding(beeProSharding); //2.0
115 | manageConfig1.setBeeProNaming(beeProNaming);
116 | manageConfig1.setBeeProPearFlowerId(beeProPearFlowerId);
117 | manageConfig1.setBeeProReturnStringList(beeProReturnStringList);
118 | manageConfig1.setBeeProSelectJson(beeProSelectJson);
119 | manageConfig1.setBeeProShowSql(beeProShowSql);
120 |
121 | manageConfig1.updateConfig();
122 |
123 | return manageConfig1;
124 | }
125 |
126 | @Override
127 | public void setEnvironment(Environment environment) {
128 | String active = environment.getProperty("spring.profiles.active");
129 | if (StringUtils.isNotBlank(active)) {
130 | BeeProProfiles profiles= getBeeProProfiles();
131 | if(profiles!=null) {
132 | profiles.setActive(active);
133 | profiles.setType(1);
134 | }
135 | }
136 | }
137 |
138 | public BeeProProfiles getBeeProProfiles() {
139 | return beeProProfiles;
140 | }
141 |
142 | public void setBeeProProfiles(BeeProProfiles beeProProfiles) {
143 | this.beeProProfiles = beeProProfiles;
144 | }
145 |
146 | public SpringDatasourceConfig getSpringDatasourceConfig() {
147 | return springDatasourceConfig;
148 | }
149 |
150 | public void setSpringDatasourceConfig(SpringDatasourceConfig springDatasourceConfig) {
151 | this.springDatasourceConfig = springDatasourceConfig;
152 | }
153 |
154 | public BeeProDb getBeeProDb() {
155 | return beeProDb;
156 | }
157 |
158 | public void setBeeProDb(BeeProDb beeProDb) {
159 | this.beeProDb = beeProDb;
160 | }
161 |
162 | }
163 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/src/main/resources/bee.properties:
--------------------------------------------------------------------------------
1 |
2 | #since V1.11
3 | #1.base main and Override with active, 2.rebase to active(other file)
4 | #1 : main file + other file; 2 : just active file(other file); if do not set , will use mail file.
5 | #bee.profiles.type=0
6 | #\u547d\u540d\u89c4\u5219 name rule: bee-{active}.properties
7 | #bee.profiles.active = test
8 |
9 | #no dataSource
10 | # if use dataSource,no need config in here.
11 | #\u65e0\u6570\u636e\u6e90,\u76f4\u8fde\u65b9\u5f0f.
12 | #\u4f7f\u7528xml\u914d\u7f6e\u7b49\u5176\u5b83\u6570\u636e\u6e90\u65f6\uff0cbee.properties\u91cc\u914d\u7f6e\u7684\u9a71\u52a8\u4fe1\u606f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5c06\u4e0d\u4f1a\u4f7f\u7528\u3002
13 | #\u6ca1\u6709\u4f7f\u7528\u6570\u636e\u6e90\u65f6\uff0c\u4f1a\u4f7f\u7528\u8fd9\u91cc\u7684\u914d\u7f6e\u3002
14 | ##bee.databaseName old key name
15 | ##When only one type of database is used, setting it can improve efficiency
16 | #bee.db.dbName=MySQL
17 | #bee.db.driverName = com.mysql.jdbc.Driver
18 | #bee.db.url =jdbc:mysql://localhost:3306/{databaseName-eg:bee}?characterEncoding=UTF-8
19 | #bee.db.username = userName
20 | #bee.db.password = YourPassword
21 |
22 | #since 2.1.10, value is:MySQL,Oracle. MySQL is default.
23 | #bee.db.oceanbaseMode=MySQL
24 | #bee.db.dbName=OceanBase
25 |
26 | #since V1.11
27 | #some db neee set,like cassandra's keyspace can set here
28 | #bee.db.schemaName=store
29 |
30 | #bee.db.jndiType=false
31 | #bee.db.jndiName=jndi/Bee
32 | #bee.db.pagingWithLimitOffset=false
33 |
34 | ##Android
35 | #bee.db.isAndroid=false
36 | #bee.db.androidDbName=bee.db
37 | #bee.db.androidDbVersion=1
38 |
39 | ##HarmonyOS
40 | #bee.db.isHarmony=false
41 | #bee.db.harmonyDbName=bee.db
42 | #bee.db.harmonyDbVersion=1
43 | #bee.db.harmonyDbReadonly=false
44 |
45 | # since v1.8
46 | #log4j>slf4j>log4j2>androidLog>harmonyLog>systemLogger>fileLogger>noLogging>jdkLog>commonsLog
47 | bee.osql.loggerType=systemLogger
48 | #set log type for systemLoggerType(for develop):debugtable name, formatter: packagename.ClassName:tableName,packagename.ClassName:tableName
103 | #Separate multiple options with comma. Package name can be omitted if they are not confused.
104 | #Just config for special
105 | #bee.osql.naming.entity2tableMappingList=User2:test_user,com.abc.user.User:test_user
106 |
107 | #since 1.7.2
108 | #default implement translate type. 1 : order_no<-->orderNo(DB<-->Java), 2: ORDER_NO<-->orderNo(DB<-->Java),
109 | # 3: original, 4 : DbUpperAndJavaLower(since 1.17), ORDER_NO<-->order_no(DB<-->Java)
110 | #if want to use other naming rule, you can define a new class implements NameTranslate
111 | #default value is :1
112 | bee.osql.naming.translateType=1
113 | #since 1.17 \u540c\u65f6\u4f7f\u7528\u591a\u7528\u4e0d\u540c\u547d\u540d\u8f6c\u6362
114 | bee.osql.naming.useMoreTranslateType=false
115 |
116 | #\u8981\u662f\u5b57\u6bb5\u540d\u5168\u7528\u5927\u5199,\u5728\u547d\u540d\u8f6c\u6362\u524d\u9700\u8981\u5148\u8f6c\u6210\u5c0f\u5199,\u5982ORDER_NO
117 | #default: to LowerCase before. \u9ed8\u8ba4\u662f\u5148\u8f6c\u5c0f\u5199,\u56e0\u4e3a\u5982\u4e0d\u8f6c,DB\u5b57\u6bb5\u7528\u5168\u5927\u5199\u65f6\u4f1a\u51fa\u9519
118 | #\u4f46\u50cfmysql,\u9ed8\u8ba4\u4e0d\u662f\u5168\u5927\u5199\u7684,\u5efa\u8bae\u8bbe\u4e3afalse,\u8fd9\u6837\u8f6c\u6362\u4f1a\u66f4\u7cbe\u51c6.
119 | bee.osql.naming.toLowerCaseBefore=true
120 |
121 |
122 | #bee.osql.moreTable.columnListWithStar=false
123 | # since v1.7.0
124 | #inner join type. use "join .. on" when true, or use "where ...=".Just there is one sub table, it is enable.
125 | #bee.osql.sqlGenerate.moreTableSelect.2tablesWithJoinOnStyle=true #close in v1.9
126 | #bee.osql.moreTable.twoTablesWithJoinOnStyle=false
127 |
128 | #\u67e5\u8be2\u7ed3\u679c\u76f4\u63a5\u8fd4\u56deJson\u662f\u5426\u5ffd\u7565null
129 | bee.osql.selectJson.ignoreNull=true
130 | #\u67e5\u8be2\u7ed3\u679c\u76f4\u63a5\u8fd4\u56deJson\u4e2d, timestamp\u662f\u5426\u7528\u6beb\u79d2\u8868\u793a
131 | bee.osql.selectJson.timestampWithMillisecond=false
132 | bee.osql.selectJson.dateWithMillisecond=false
133 | bee.osql.selectJson.timeWithMillisecond=false
134 | #since 1.9.8
135 | bee.osql.selectJson.longToString=true
136 |
137 | #\u67e5\u8be2\u7ed3\u679c\u8fd4\u56deList\u65f6,\u662f\u5426\u5c06null\u8f6c\u4e3a""
138 | bee.osql.returnStringList.nullToEmptyString=false
139 |
140 |
141 | #cache=======================start
142 | #\u7f13\u5b58\u7c7b\u578b
143 | #bee.osql.cache.type=FIFO
144 | #\u7f13\u5b58\u96c6\u6570\u636e\u91cf\u6570\u76ee
145 | #bee.osql.cache.mapSize=20000
146 | #resultset\u8d85\u8fc7\u4e00\u5b9a\u7684\u503c\u5c06\u4e0d\u4f1a\u653e\u7f13\u5b58
147 | #bee.osql.cache.workResultSetSize=300
148 | #\u7f13\u5b58\u4fdd\u5b58\u65f6\u95f4(\u6beb\u79d2 ms)
149 | #bee.osql.cache.timeout=30000
150 | #\u68c0\u6d4b\u5230\u8d85\u65f6,\u8d85\u8fc7\u8fd9\u4e2a\u4f7f\u7528\u6bd4\u4f8b\u5219\u987a\u4fbf\u8d77\u7ebf\u7a0b\u6e05\u9664\u7f13\u5b58
151 | bee.osql.cache.startDeleteRate=0.6
152 | #\u7f13\u5b58\u5bb9\u91cf\u4f7f\u7528\u7387;\u6dfb\u52a0\u7f13\u5b58,\u68c0\u6d4b\u8fbe\u5230\u8be5\u4f7f\u7528\u7387\u5219\u6e05\u9664\u4e00\u5b9a\u6bd4\u4f8b\u7f13\u5b58
153 | bee.osql.cache.fullUsedRate=0.8
154 | #\u6dfb\u52a0\u7f13\u5b58,\u68c0\u6d4b\u5230\u7f13\u5b58\u5bb9\u91cf\u5feb\u6ee1\u65f6,\u5220\u9664\u7f13\u5b58\u6570\u7684\u6bd4\u4f8b
155 | bee.osql.cache.fullClearRate=0.2
156 |
157 | #\u4ec5\u5206\u5e93\u65f6(bee.dosql.multiDS.type=2),\u53ef\u7528\u683c\u5f0f: dsName.tableName
158 | #use table name, not entity name
159 | #\u4e0d\u7f13\u5b58\u8868\u7684\u5217\u8868, \u8868\u540d\u4e0d\u533a\u5206\u5927\u5c0f\u5199.\u89c6\u56fe\u5f3a\u70c8\u5efa\u8bae\u4e0d\u653e\u7f13\u5b58,\u56e0\u4f1a\u4ea7\u751f\u810f\u6570\u636e.
160 | #bee.osql.cache.never=test_user
161 | #\u6c38\u4e45\u7f13\u5b58\u8868\u7684\u5217\u8868, \u8868\u540d\u4e0d\u533a\u5206\u5927\u5c0f\u5199
162 | #bee.osql.cache.forever=constant
163 | #\u53ea\u6709\u66f4\u6539\u65f6\u624d\u4f1a\u6e05\u9664\u7f13\u5b58,\u4ee5\u4fbf\u540c\u6b65\u65b0\u7684\u503c\u5230\u7f13\u5b58. \u8868\u540d\u4e0d\u533a\u5206\u5927\u5c0f\u5199
164 | #bee.osql.cache.modifySyn=para
165 |
166 | # since v1.7.2. default value is: false (use cache)
167 | #bee.osql.cache.nocache=false
168 |
169 | #since v1.8.99
170 | bee.osql.cache.keyUseMD5=true
171 |
172 | #since V1.11
173 | #prototype: 0 not prototype, but faster; 1:prototype,if have NotSerializableException, do not put in cache, slower, but safer; 2 : prototype, but if have NotSerializableException,return original
174 | #high safe cache,the javabean(entity) need implements Serializable interface.
175 | bee.osql.cache.prototype=1
176 | bee.osql.cache.useLevelTwo=false
177 | #\u6c38\u4e45\u548c\u957f\u4e45\u7f13\u5b58\u9ed8\u8ba4\u4e0d\u653e\u4e8c\u7ea7\u7f13\u5b58,\u5176\u5b83\u4e00\u7ea7\u7f13\u5b58\u53ef\u901a\u8fc7\u8be5\u914d\u7f6e\u8bbe\u7f6e
178 | bee.osql.cache.levelOneTolevelTwo=false
179 | #\u4e8c\u7ea7\u7f13\u5b58\u9ed8\u8ba4\u4fdd\u5b58\u65f6\u95f4(\u79d2 second)
180 | #bee.osql.cache.levelTwoTimeout=180
181 |
182 | #\u7528\u8fd9\u79cd,\u4e00\u4e2a\u5b9e\u4f53\u5bf9\u5e94\u591a\u4e2a\u4e0d\u540c\u6570\u636e\u6e90\u5219\u4e0d\u884c? \u4e5f\u53ef\u4ee5\u8868\u793a\u51e0\u4e2a\u6570\u636e\u6e90\u5bf9\u5e94\u7684\u8868\u90fd\u653e\u7f13\u5b58
183 | #bee.osql.cache.levelTwoEntityList=com.xxx.aa.Orders,com.xxx.bb.*,com.xxx.cc.**
184 |
185 | #level 2 cache: Redis
186 | #bee.osql.cacheRedis.host=localhost
187 | #bee.osql.cacheRedis.port=
188 | #bee.osql.cacheRedis.password=123456
189 | #unit: second
190 | #bee.osql.cacheRedis.connectionTimeout=6
191 | #Read timed out, unit:second
192 | #bee.osql.cacheRedis.soTimeout=6
193 | #bee.osql.cacheRedis.database=
194 | #bee.osql.cacheRedis.clientName=
195 | #bee.osql.cacheRedis.ssl=
196 | #2.1.7 eg:randTimeoutRate=0.2, bee.osql.cache.levelTwoTimeout=100 -> new timeOut is [80,120]
197 | bee.osql.cache.randTimeoutRate=0.2
198 | bee.osql.cache.randTimeoutAutoRefresh=false
199 |
200 | #cache=======================end
201 |
202 |
203 | #distributed environment
204 | #1:SerialUniqueId ,2:OneTimeSnowflakeId ,3:PearFlowerId. default is 1.
205 | #bee.distribution.genid.generatorType=1
206 | #bee.distribution.genid.workerid=0
207 | #bee.distribution.genid.startYear=
208 | #bee.distribution.genid.forAllTableLongId=false
209 | bee.distribution.genid.replaceOldId=true
210 | #when forAllTableLongId=true, it woulb be disable.
211 | #bee.distribution.genid.includesEntityList=com.xxx.aa.Orders,com.xxx.bb.*,com.xxx.cc.**
212 | #bee.distribution.genid.excludesEntityList=com.xxx.aa.User,com.xxx.bb.*
213 |
214 | #tolerateSecond need >=1
215 | #bee.distribution.pearFlowerId.tolerateSecond=10
216 | #bee.distribution.pearFlowerId.useHalfWorkId=false
217 | #unit is second.
218 | #bee.distribution.pearFlowerId.switchWorkIdTimeThreshold=120
219 | #need >=1, default is 2. \u68a8\u82b1\u7b97\u6cd5\u968f\u673a\u5f00\u59cb\u503c\u7684\u6700\u5927\u503c(\u4e0d\u5305\u62ec\u8fb9\u754c)
220 | #bee.distribution.pearFlowerId.randomNumBound=2
221 |
222 | #--------Notice: do not support define sql in this model.
223 | #DOSQL: Distributed Object SQL
224 | #bee.dosql.multiDS.enable=true
225 | #\u652f\u6301\u540c\u65f6\u4f7f\u7528\u591a\u79cd\u7c7b\u578b\u6570\u636e\u5e93\u7684\u6570\u636e\u6e90.support different type database muli-Ds at same time.
226 | #eg: have oracle,mysql,..., datasource
227 | #bee.dosql.multiDS.differentDbType=true
228 | #\u7528\u4e8e\u5728HoneyFactory\u83b7\u53d6Suid,SuidRich\u7684\u5bf9\u8c61\u65f6\u751f\u6210Mongodb\u7684
229 | bee.dosql.multiDS.justMongodb=false
230 | #bee.dosql.multiDS.defalutDS=ds1
231 | #bee.dosql.multiDS.sharding=false
232 |
233 | #\u4e0d\u662f\u5e7f\u64ad\u8868,\u624d\u6709\u6548(V2.1) for not Broadcast table(V2.1)
234 | bee.dosql.sharding.forkJoinBatchInsert=false
235 | bee.dosql.sharding.jdbcStreamSelect=true
236 | #since 2.0 \u8bbe\u7f6e\u662f\u5426\u4e0d\u652f\u6301union? include union,union all
237 | bee.dosql.sharding.notSupportUnionQuery=false
238 | #since 2.1.7
239 | #bee.dosql.sharding.executorSize=0
240 |
241 | # 1:only r/w, one main and more sub-database; 2:only more database (table name is same)
242 | #bee.dosql.multiDS.type=1
243 | #bee.dosql.multiDS.defalutDS=ds1
244 | #when type is 1
245 | #write DB just set one db.
246 | #bee.dosql.multiDS.writeDB=ds1
247 | #bee.dosql.multiDS.readDB=ds2,ds3
248 | #poll:1, rand:2
249 | #bee.dosql.multiDS.rDbRouteWay=1
250 |
251 | #when type is 2
252 | #bee.dosql.multiDS.defalutDS=ds1
253 | #bee.dosql.multiDS.type=2
254 | #\u4e0d\u540cds\u7528\u5206\u53f7\u9694\u5f00 \u540c\u4e00ds\u7528\u9017\u53f7\u9694\u5f00.Different DS are separated by semicolons and the same DS by commas.
255 | #\u4ec5\u5206\u5e93\u65f6\uff0c\u4e0d\u540c\u5e93\u6709\u76f8\u540c\u7684\u8868\u540d\uff0c\u5bf9\u5e94\u7684Entity\u6240\u5728\u7684\u5305\u540d\u4e0d\u80fd\u76f8\u540c(\u82e5\u5728java\u4ee3\u7801\u4e2d\u624b\u52a8\u6307\u5b9ads,\u5219\u4f1a\u6c61\u67d3\u4ee3\u7801)
256 | #bee.dosql.multiDS.matchEntityClassPath=ds2:com.xxx.aa.User,com.xxx.bb.*,com.xxx.cc.**;ds3:com.xxx.dd.User
257 | #config datasource and table relation
258 | #bee.dosql.multiDS.matchTable=ds2:test_user
259 |
260 | #\u82e5\u6ca1\u6709\u914d\u7f6ebee.dosql.multiDS.type,\u5219\u6839\u636e\u5177\u4f53\u60c5\u51b5\u786e\u5b9a\u6570\u636e\u6e90
261 |
262 |
263 |
264 | #############Bee+Spring boot,\u4f7f\u7528\u591a\u4e2a\u6570\u636e\u6e90\u65f6,\u9700\u8981\u5728spring boot\u5de5\u7a0b\u7684Application\u7c7b\u6dfb\u52a0:
265 | #@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
266 | #\u6216\u8005,\u5728application.properties\u91cc\u6dfb\u52a0:
267 | #spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
268 |
269 | #bee.db.dbs[i].type value :Hikari,Druid,c3p0,dbcp2,Tomcat,BeeMongo, default is : Hikari
270 | #Hikari
271 | #Hikari\u4e13\u7528:
272 | #bee.db.dbs[0].driverClassName = com.mysql.jdbc.Driver
273 | #bee.db.dbs[0].jdbcUrl =jdbc:mysql://localhost:3306/bee?characterEncoding=UTF-8&useSSL=false
274 | #Bee\u4f5c\u4e86\u517c\u5bb9\u5904\u7406 driverName->driverClassName ; url ->jdbcUrl
275 |
276 | #############Bee+Spring boot,\u4f7f\u7528\u591a\u4e2a\u6570\u636e\u6e90,\u914d\u7f6e\u5b9e\u4f8b
277 | #dbs\u6570\u7ec4,\u5176\u5b83\u4e0b\u6807,\u662f\u5426\u4ece\u9996\u4e2a\u5143\u7d20\u7ee7\u627f\u5c5e\u6027(\u4f46dsName\u4e0d\u80fd\u7ee7\u627f)
278 | #bee.db.extendFirst=true
279 | #
280 | #bee.db.dbs[0].dsName=ds0
281 | #bee.db.dbs[0].driverClassName = com.mysql.jdbc.Driver
282 | #bee.db.dbs[0].jdbcUrl =jdbc:mysql://localhost:3306/bee?characterEncoding=UTF-8&useSSL=false
283 | #bee.db.dbs[0].username = root
284 | #bee.db.dbs[0].password =123456
285 | #
286 | #bee.db.dbs[1].dsName=ds1
287 | #bee.db.dbs[1].driver-class-name = com.mysql.jdbc.Driver
288 | #bee.db.dbs[1].jdbcUrl =jdbc:mysql://localhost:3306/pro?characterEncoding=UTF-8&useSSL=false
289 | #bee.db.dbs[1].username = root
290 | #bee.db.dbs[1].password =123456
291 |
292 |
293 | ############# Bee+Spring boot,\u4f7f\u7528\u5355\u4e2a\u6570\u636e\u6e90,\u914d\u7f6e\u5b9e\u4f8b
294 | ## \u6570\u636e\u6e90\u914d\u7f6e ; \u9ed8\u8ba4\u662f:HikariPool
295 | #spring.datasource.url=jdbc:mysql://localhost:3306/bee?characterEncoding=UTF-8&useSSL=false
296 | ##spring.datasource.driver-class-name=com.mysql.jdbc.Driver
297 | #spring.datasource.driverClassName=com.mysql.jdbc.Driver
298 | #spring.datasource.username=root
299 | #spring.datasource.password=123456
300 |
301 | #Sharding\u5206\u7247properties\u98ce\u683c\u914d\u7f6e(\u4e0espringboot\u6574\u5408\u65f6,\u53ef\u4ee5\u4f7f\u7528yaml\u65b9\u5f0f),since 2.4.0
302 | #Java\u98ce\u683c\u914d\u7f6e,\u53ef\u53c2\u8003bee-exam\u5de5\u7a0b\u7684ShardingInitData.java
303 | #ShardingConfig.addShardingBean("orders",new ShardingBean("ds[0..1].orders[0..5]", "orderid"));
304 | #bee.db.sharding[0].baseTableName=orders
305 | #\u8bbe\u7f6e\u8868\u5bf9\u5e94\u7684Class\u7c7b\u4e5f\u53ef\u4ee5(\u8981\u5305\u62ec\u5305\u540d)
306 | #bee.db.sharding[0].className=org.teasoft.exam.Orders
307 | #bee.db.sharding[0].fullNodes=ds[0..1].orders[0..5]
308 | #\u7528\u4e8e\u5206\u7247\u7684\u8868\u5b57\u6bb5.
309 | #bee.db.sharding[0].tabField=orderid
310 |
311 | ##\u5176\u5b83\u53ef\u8bbe\u7f6e\u5b57\u6bb5
312 | #bee.db.sharding[0].dsField =
313 | #bee.db.sharding[0].dsAlgorithm =
314 | #bee.db.sharding[0].tabAssignType =
315 | #bee.db.sharding[0].tabAlgorithm =
316 | #bee.db.sharding[0].dsRule =
317 | #bee.db.sharding[0].dsName =
318 | #bee.db.sharding[0].tabRule =
319 | #bee.db.sharding[0].dsShardingValue =
320 | #bee.db.sharding[0].tabShardingValue=
321 |
--------------------------------------------------------------------------------