Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
968 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>nacos-spring-boot-parent</artifactId> | ||
<groupId>com.alibaba.boot</groupId> | ||
<version>0.1.0-SNAPSHOT</version> | ||
<relativePath>../nacos-spring-boot-parent/pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>nacos-spring-boot-actuator</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Nacos Spring Boot Actuator</name> | ||
<description>Nacos Spring Boot Actuator</description> | ||
|
||
<dependencies> | ||
|
||
<!-- Compile --> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.1.0</version> | ||
<scope>provided</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- @ConfigurationProperties annotation processing (metadata for IDEs) --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- Nacos autoconfigure --> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>nacos-spring-boot-autoconfigure</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<!-- Nacos --> | ||
<dependency> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<artifactId>nacos-client</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<artifactId>nacos-spring-context</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- Test Dependencies --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
38 changes: 38 additions & 0 deletions
38
...in/java/com/alibaba/boot/nacos/actuate/autoconfigure/NacosEndpointsAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 com.alibaba.boot.nacos.actuate.autoconfigure; | ||
|
||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import com.alibaba.boot.nacos.actuate.endpoint.NacosPropertiesEndpoint; | ||
|
||
/** | ||
* @author xiaojing | ||
*/ | ||
@Configuration | ||
public class NacosEndpointsAutoConfiguration { | ||
|
||
@Bean | ||
@ConditionalOnMissingBean | ||
@ConditionalOnEnabledEndpoint | ||
public NacosPropertiesEndpoint nacosPropertiesEndpoint() { | ||
return new NacosPropertiesEndpoint(); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
...a/com/alibaba/boot/nacos/actuate/autoconfigure/NacosHealthIndicatorAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 com.alibaba.boot.nacos.actuate.autoconfigure; | ||
|
||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; | ||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; | ||
import org.springframework.boot.actuate.health.HealthIndicator; | ||
import org.springframework.boot.autoconfigure.AutoConfigureAfter; | ||
import org.springframework.boot.autoconfigure.AutoConfigureBefore; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.alibaba.boot.nacos.actuate.health.NacosHealthIndicator; | ||
import com.alibaba.boot.nacos.actuate.health.NacosHealthIndicatorProperties; | ||
import com.alibaba.boot.nacos.autoconfigure.NacosAutoConfiguration; | ||
|
||
/** | ||
* @author xiaojing | ||
*/ | ||
@Configuration | ||
@ConditionalOnClass({ HealthIndicator.class }) | ||
@AutoConfigureBefore({ EndpointAutoConfiguration.class }) | ||
@AutoConfigureAfter(NacosAutoConfiguration.class) | ||
@ConditionalOnEnabledHealthIndicator("nacos") | ||
@EnableConfigurationProperties(NacosHealthIndicatorProperties.class) | ||
public class NacosHealthIndicatorAutoConfiguration { | ||
|
||
@Bean | ||
@ConditionalOnMissingBean | ||
public NacosHealthIndicator nacosHealthIndicator() { | ||
return new NacosHealthIndicator(); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...tuator/src/main/java/com/alibaba/boot/nacos/actuate/endpoint/NacosPropertiesEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 com.alibaba.boot.nacos.actuate.endpoint; | ||
|
||
/** | ||
* @author xiaojing | ||
*/ | ||
public class NacosPropertiesEndpoint { | ||
} |
32 changes: 32 additions & 0 deletions
32
...ot-actuator/src/main/java/com/alibaba/boot/nacos/actuate/health/NacosHealthIndicator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 com.alibaba.boot.nacos.actuate.health; | ||
|
||
import org.springframework.boot.actuate.health.AbstractHealthIndicator; | ||
import org.springframework.boot.actuate.health.Health; | ||
|
||
/** | ||
* @author xiaojing | ||
*/ | ||
public class NacosHealthIndicator extends AbstractHealthIndicator { | ||
|
||
@Override | ||
protected void doHealthCheck(Health.Builder builder) throws Exception { | ||
|
||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...r/src/main/java/com/alibaba/boot/nacos/actuate/health/NacosHealthIndicatorProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 com.alibaba.boot.nacos.actuate.health; | ||
|
||
/** | ||
* @author xiaojing | ||
*/ | ||
public class NacosHealthIndicatorProperties { | ||
} |
3 changes: 3 additions & 0 deletions
3
nacos-spring-boot-actuator/src/main/resources/META-INF/spring.factories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
com.alibaba.boot.nacos.actuate.autoconfigure.NacosEndpointsAutoConfiguration,\ | ||
com.alibaba.boot.nacos.actuate.autoconfigure.NacosHealthIndicatorAutoConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>com.alibaba.boot</groupId> | ||
<artifactId>nacos-spring-boot-parent</artifactId> | ||
<version>0.1.0-SNAPSHOT</version> | ||
<relativePath>../nacos-spring-boot-parent</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>nacos-spring-boot-autoconfigure</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Nacos Spring Boot AutoConfigure</name> | ||
<description>Nacos Spring Boot AutoConfigure</description> | ||
|
||
|
||
<dependencies> | ||
<!-- Spring Boot dependencies --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-logging</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- @ConfigurationProperties annotation processing (metadata for IDEs) --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- Nacos --> | ||
<dependency> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<artifactId>nacos-client</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba.nacos</groupId> | ||
<artifactId>nacos-spring-context</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- Test Dependencies --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
...oconfigure/src/main/java/com/alibaba/boot/nacos/autoconfigure/NacosAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 com.alibaba.boot.nacos.autoconfigure; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author xiaojing | ||
*/ | ||
@Configuration | ||
public class NacosAutoConfiguration { | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...ure/src/main/java/com/alibaba/boot/nacos/context/event/NacosEventApplicationListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.alibaba.boot.nacos.context.event; | ||
|
||
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; | ||
import org.springframework.context.ApplicationListener; | ||
|
||
/** | ||
* @author yizhan | ||
*/ | ||
public class NacosEventApplicationListener | ||
implements ApplicationListener<ApplicationEnvironmentPreparedEvent> { | ||
@Override | ||
public void onApplicationEvent( | ||
ApplicationEnvironmentPreparedEvent applicationEnvironmentPreparedEvent) { | ||
|
||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
nacos-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
com.alibaba.boot.nacos.autoconfigure.NacosAutoConfiguration | ||
|
||
|
||
org.springframework.context.ApplicationListener=\ | ||
com.alibaba.boot.nacos.context.event.NacosEventApplicationListener |
Oops, something went wrong.