Skip to content

Commit

Permalink
feat: use can change spring.profiles.active's value without rebuild p…
Browse files Browse the repository at this point in the history
…roject (#4616)

* refactor: move spring.profiles.active to application.properties

* fix: h2 test error when spring.jpa.properties.hibernate.globally_quoted_identifiers=true

* fix(adminservice): test fail h2 test error when globally_quoted_identifiers = true

* fix(configservice): test fail h2 test error when globally_quoted_identifiers=true

* fix(portal): test fail h2 test error when globally_quoted_identifiers=true

* fix: ${apollo_profile}

* fix: license

* feat: user only need to uncomment spring.profiles.active

* test: fix

* refactor: rename back to application.properties in src/test/resources

* fix: applicatioin.properties -> applicatioin.yaml forbid cover config

* test: add config DB_CLOSE_DELAY=-1

* test: fix config apolloconfigdb -> apolloportaldb

* refactor: remove @TestPropertySource("classpath:" + "application.properties")

* Update distributed-deployment-guide.md

* fix: delete kubernetes and nacos discovery in application.properties

* Update docs/zh/deployment/distributed-deployment-guide.md

Co-authored-by: Jason Song <[email protected]>

* Update docs/zh/deployment/distributed-deployment-guide.md

Co-authored-by: Jason Song <[email protected]>

* Update docs/zh/deployment/distributed-deployment-guide.md

Co-authored-by: Jason Song <[email protected]>

* Apply suggestions from code review

Co-authored-by: Jason Song <[email protected]>

* move up `启用外部xxxxxx`

* docs: Replace built-in eureka with another service registry

* Update CHANGES.md

Co-authored-by: Jason Song <[email protected]>
  • Loading branch information
Anilople and nobodyiam authored Nov 6, 2022
1 parent 4604e30 commit 821c855
Show file tree
Hide file tree
Showing 15 changed files with 477 additions and 175 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Apollo 2.1.0
* [feat: support use database as a registry](https://github.com/apolloconfig/apollo/pull/4595)
* [fix doc bug](https://github.com/apolloconfig/apollo/pull/4579)
* [fix Grayscale release Item Value length limit can not be synchronized with its main version](https://github.com/apolloconfig/apollo/pull/4622)
* [feat: use can change spring.profiles.active's value without rebuild project](https://github.com/apolloconfig/apollo/pull/4616)

------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1)
1 change: 1 addition & 0 deletions apollo-adminservice/src/assembly/assembly-descriptor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<outputDirectory>/config</outputDirectory>
<includes>
<include>application-github.properties</include>
<include>application.properties</include>
</includes>
</fileSet>
<!--artifact -->
Expand Down
21 changes: 21 additions & 0 deletions apollo-adminservice/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright 2022 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# You may uncomment the following config to activate different spring profiles
#spring.profiles.active=github,consul-discovery
#spring.profiles.active=github,zookeeper-discovery
#spring.profiles.active=github,custom-defined-discovery
#spring.profiles.active=github,database-discovery
13 changes: 10 additions & 3 deletions apollo-adminservice/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.cloud.discovery.enabled=false

spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.metadata_builder_contributor=com.ctrip.framework.apollo.common.jpa.SqlFunctionsMetadataBuilderContributor
spring.jpa.defer-datasource-initialization=true

spring.h2.console.enabled = true
spring.h2.console.settings.web-allow-others=true

spring.main.allow-bean-definition-overriding=true
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.jpa.defer-datasource-initialization=true
2 changes: 1 addition & 1 deletion apollo-assembly/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.metadata_builder_contributor=com.ctrip.framework.apollo.common.jpa.SqlFunctionsMetadataBuilderContributor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
@RunWith(SpringJUnit4ClassRunner.class)
@Rollback
@Transactional
@SpringBootTest(classes = BizTestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT
, properties = {"spring.cloud.discovery.enabled=false"})
@SpringBootTest(
classes = BizTestConfiguration.class,
webEnvironment = WebEnvironment.RANDOM_PORT
)
public abstract class AbstractIntegrationTest {

}
16 changes: 11 additions & 5 deletions apollo-biz/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.cloud.discovery.enabled=false

spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.metadata_builder_contributor=com.ctrip.framework.apollo.common.jpa.SqlFunctionsMetadataBuilderContributor
spring.jpa.defer-datasource-initialization=true

spring.h2.console.enabled = true
spring.h2.console.settings.web-allow-others=true
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.jpa.defer-datasource-initialization=true
spring.h2.console.settings.web-allow-others=true
40 changes: 0 additions & 40 deletions apollo-common/src/main/resources/application.properties

This file was deleted.

57 changes: 57 additions & 0 deletions apollo-common/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Copyright 2022 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

spring:
jpa:
properties:
hibernate:
globally_quoted_identifiers: 'true'
hibernate:
globally_quoted_identifiers: 'true'
# Naming strategy
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
info:
# Project information
git:
location: classpath:apollo-git.properties
mvc:
converters:
preferred-json-mapper: gson
# DataSource
datasource:
hikari:
connectionInitSql: set names utf8mb4

# Tomcat configuration
server:
tomcat:
accept-count: '5000'
# Increase tomcat header size for longer GET query parameter, should be n * 1024
max-http-header-size: '10240'

# Spring Boot 2.x
management:
endpoints:
web:
exposure:
include: info,health,metrics,prometheus
base-path: /
logging:
logback:
rollingpolicy:
max-history: '10'
max-file-size: 50MB
1 change: 1 addition & 0 deletions apollo-configservice/src/assembly/assembly-descriptor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<outputDirectory>/config</outputDirectory>
<includes>
<include>application-github.properties</include>
<include>application.properties</include>
</includes>
</fileSet>
<!--artifact -->
Expand Down
21 changes: 21 additions & 0 deletions apollo-configservice/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright 2022 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# You may uncomment the following config to activate different spring profiles
#spring.profiles.active=github,consul-discovery
#spring.profiles.active=github,zookeeper-discovery
#spring.profiles.active=github,custom-defined-discovery
#spring.profiles.active=github,database-discovery
12 changes: 9 additions & 3 deletions apollo-configservice/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false

spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.metadata_builder_contributor=com.ctrip.framework.apollo.common.jpa.SqlFunctionsMetadataBuilderContributor
spring.jpa.defer-datasource-initialization=true

spring.h2.console.enabled = true
spring.h2.console.settings.web-allow-others=true
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false

spring.main.allow-bean-definition-overriding=true
spring.jpa.defer-datasource-initialization=true

# for ReleaseMessageScanner test
apollo.message-scan.interval=100
12 changes: 11 additions & 1 deletion apollo-portal/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.session.store-type=none
spring.cloud.consul.enabled=false
spring.cloud.zookeeper.enabled=false
spring.cloud.discovery.enabled=false

spring.datasource.url = jdbc:h2:mem:~/apolloportaldb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.globally_quoted_identifiers=false
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.metadata_builder_contributor=com.ctrip.framework.apollo.common.jpa.SqlFunctionsMetadataBuilderContributor
spring.jpa.defer-datasource-initialization=true

spring.h2.console.enabled = true
spring.h2.console.settings.web-allow-others=true

spring.session.store-type=none
spring.main.allow-bean-definition-overriding=true
Loading

0 comments on commit 821c855

Please sign in to comment.