mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Merge pull request #476 from fangjian0423/master
add spring-cloud-alibaba-dubbo to bom and remove useless example
This commit is contained in:
commit
d21a5b99cb
@ -305,6 +305,11 @@
|
|||||||
<artifactId>spring-cloud-stream-binder-rocketmq</artifactId>
|
<artifactId>spring-cloud-stream-binder-rocketmq</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dubbo</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Own dependencies - Starters -->
|
<!-- Own dependencies - Starters -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>2.0.6.RELEASE</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>alibaba.com</groupId>
|
|
||||||
<artifactId>env-extension</artifactId>
|
|
||||||
<version>0.2.2.BUILD-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>env-extension</name>
|
|
||||||
<description>Demo project for Spring Boot</description>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!--Spring Boot -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,16 +0,0 @@
|
|||||||
package org.springframework.alicloud.env.extension;
|
|
||||||
|
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Documented
|
|
||||||
public @interface ImportExtraConfig {
|
|
||||||
|
|
||||||
String[] name() default "";
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 the original author or 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.
|
|
||||||
*/
|
|
||||||
package org.springframework.alicloud.env.extension;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import org.springframework.core.env.PropertiesPropertySource;
|
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author pbting
|
|
||||||
* @date 2019-01-09 9:00 PM
|
|
||||||
*/
|
|
||||||
public class LoadExtraConfigApplicationListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
|
|
||||||
SpringApplication springApplication = event.getSpringApplication();
|
|
||||||
Class clazz = springApplication.getMainApplicationClass();
|
|
||||||
if (!clazz.isAnnotationPresent(ImportExtraConfig.class)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ImportExtraConfig annotation = (ImportExtraConfig) clazz
|
|
||||||
.getAnnotation(ImportExtraConfig.class);
|
|
||||||
|
|
||||||
String[] extraConfig = annotation.name();
|
|
||||||
|
|
||||||
if (extraConfig == null || extraConfig.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String config : extraConfig) {
|
|
||||||
try {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.load(new FileInputStream(config));
|
|
||||||
event.getEnvironment().getPropertySources()
|
|
||||||
.addFirst(new PropertiesPropertySource(config, properties));
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
org.springframework.context.ApplicationListener=\
|
|
||||||
org.springframework.alicloud.env.extension.LoadExtraConfigApplicationListener
|
|
@ -24,7 +24,6 @@
|
|||||||
<module>nacos-example/nacos-discovery-example</module>
|
<module>nacos-example/nacos-discovery-example</module>
|
||||||
<module>nacos-example/nacos-config-example</module>
|
<module>nacos-example/nacos-config-example</module>
|
||||||
<module>nacos-example/nacos-gateway-example</module>
|
<module>nacos-example/nacos-gateway-example</module>
|
||||||
<module>env-extension</module>
|
|
||||||
<module>oss-example</module>
|
<module>oss-example</module>
|
||||||
<module>ans-example/ans-consumer-feign-example</module>
|
<module>ans-example/ans-consumer-feign-example</module>
|
||||||
<module>ans-example/ans-consumer-ribbon-example</module>
|
<module>ans-example/ans-consumer-ribbon-example</module>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user