Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-boot-build</artifactId>
<version>3.4.2</version>
<version>3.4.3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>SOFABoot Build</name>
<description>SOFABoot Build</description>
Expand Down
2 changes: 1 addition & 1 deletion sofa-boot-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>sofa-boot-build</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>3.4.2</version>
<version>3.4.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
8 changes: 7 additions & 1 deletion sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-boot-parent</artifactId>
<version>3.4.2</version>
<version>3.4.3-SNAPSHOT</version>
<relativePath>../sofa-boot-parent</relativePath>
</parent>

Expand Down Expand Up @@ -49,6 +49,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>startup-sofa-boot</artifactId>
<optional>true</optional>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.alipay.sofa.boot.actuator.autoconfigure.startup;

import com.alipay.sofa.boot.actuator.startup.SofaBootStartupEndPoint;
import com.alipay.sofa.startup.SofaStartupContext;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* @author: Zhijie
* @since: 2020/7/7
*/
@Configuration
@ConditionalOnClass(SofaStartupContext.class)
public class StartupEndPointAutoConfiguration {

@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint(endpoint = SofaBootStartupEndPoint.class)
public SofaBootStartupEndPoint sofaBootStartupEndPoint() {
return new SofaBootStartupEndPoint();
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alipay.sofa.boot.actuator.autoconfigure.version.VersionEndpointAutoConfiguration,\
com.alipay.sofa.boot.actuator.autoconfigure.health.SofaBootHealthCheckAutoConfiguration
com.alipay.sofa.boot.actuator.autoconfigure.health.SofaBootHealthCheckAutoConfiguration,\
com.alipay.sofa.boot.actuator.autoconfigure.startup.StartupEndPointAutoConfiguration
8 changes: 7 additions & 1 deletion sofa-boot-project/sofa-boot-actuator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-boot-parent</artifactId>
<version>3.4.2</version>
<version>3.4.3-SNAPSHOT</version>
<relativePath>../sofa-boot-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -37,6 +37,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>startup-sofa-boot</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>runtime-sofa-boot</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.alipay.sofa.boot.actuator.startup;

import com.alipay.sofa.startup.SofaStartupReporter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;

/**
* Display the time cost details used in startup
*
* @author: Zhijie
* @since: 2020/7/7
*/
@Endpoint(id = "startup")
public class SofaBootStartupEndPoint {

@Autowired
SofaStartupReporter sofaStartupReporter;

@ReadOperation
public SofaStartupReporter.SofaStartupCostModel startup() {
return sofaStartupReporter.report();
}
}
32 changes: 31 additions & 1 deletion sofa-boot-project/sofa-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-boot-parent</artifactId>
<version>3.4.2</version>
<version>3.4.3-SNAPSHOT</version>
<relativePath>../sofa-boot-parent</relativePath>
</parent>

Expand Down Expand Up @@ -60,6 +60,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>startup-sofa-boot</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
Expand Down Expand Up @@ -151,6 +157,30 @@
<artifactId>hessian</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>8.5.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.2.18.v20160721</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.2.18.v20160721</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>2.1.3.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
*/
package com.alipay.sofa.boot.autoconfigure.runtime;

import java.util.HashSet;
import java.util.ServiceLoader;
import java.util.Set;

import org.springframework.beans.factory.annotation.Value;
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.alipay.sofa.runtime.SofaFramework;
import com.alipay.sofa.runtime.api.client.ReferenceClient;
import com.alipay.sofa.runtime.api.client.ServiceClient;
Expand All @@ -49,6 +38,16 @@
import com.alipay.sofa.runtime.spring.ServiceBeanFactoryPostProcessor;
import com.alipay.sofa.runtime.spring.async.AsyncTaskExecutionListener;
import com.alipay.sofa.runtime.spring.aware.DefaultRuntimeShutdownAware;
import org.springframework.beans.factory.annotation.Value;
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 java.util.HashSet;
import java.util.ServiceLoader;
import java.util.Set;

/**
* @author xuanbei 18/3/17
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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.alipay.sofa.boot.autoconfigure.startup;

import com.alipay.sofa.startup.SofaStartupContext;
import com.alipay.sofa.startup.SofaStartupProperties;
import com.alipay.sofa.startup.SofaStartupReporter;
import com.alipay.sofa.startup.spring.SpringContextAwarer;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
* @author: Zhijie
* @since: 2020/7/8
*/
@Configuration
@AutoConfigureBefore(ServletWebServerFactoryAutoConfiguration.class)
@ConditionalOnClass(SofaStartupContext.class)
@EnableConfigurationProperties(SofaStartupProperties.class)
@Import({ SofaStartupConfiguration.StartupTomcat.class,
SofaStartupConfiguration.StartupJetty.class,
SofaStartupConfiguration.StartupUndertow.class,
SofaStartupConfiguration.SpringContextAware.class,
SofaStartupConfiguration.IsleSpringContextAware.class,
SofaStartupConfiguration.InstallStage.class })
public class SofaStartupAutoConfiguration {

@Bean
@ConditionalOnMissingBean
public SofaStartupContext sofaStartupContext(SpringContextAwarer springContextAwarer,
SofaStartupProperties sofaStartupProperties) {
return new SofaStartupContext(springContextAwarer, sofaStartupProperties);
}

@Bean
@ConditionalOnMissingBean
public SofaStartupReporter sofaStartupReporter(SofaStartupContext sofaStartupContext) {
return new SofaStartupReporter(sofaStartupContext);
}
}
Loading