-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature:add seata-spring-boot-starter #1742
Merged
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
e1debce
support spring-boot auto configuration
xingfudeshi 7ff11ac
Merge branch 'develop' into spring-boot-starter
xingfudeshi 2889bf6
Merge branch 'develop' into spring-boot-starter
xingfudeshi 10f3386
Merge branch 'develop' into spring-boot-starter
xingfudeshi de28a7d
remove unused imports.
xingfudeshi fbe225e
Merge remote-tracking branch 'origin/spring-boot-starter' into spring…
xingfudeshi 7f38d25
add missing properties.
xingfudeshi 58e57e7
config missing properties for config®istry
xingfudeshi a0c7cb2
unify the default port for eureka.
xingfudeshi e740cbd
code format.
xingfudeshi 6ed3448
extends from parent.
xingfudeshi 0a291e2
set the capacity for HashMap
xingfudeshi ff693bd
fix coverage
xingfudeshi 7327b91
Revert "extends from parent."
xingfudeshi 7737ec4
fix coverage
xingfudeshi f6bb843
fix coverage
xingfudeshi 1d3f187
use seata-all
xingfudeshi 2c22e2a
degrades the version of spring-boot 1.5.22.RELEASE
xingfudeshi a547036
Merge branch 'develop' into spring-boot-starter
xingfudeshi 9b3b7e0
Merge branch 'develop' into spring-boot-starter
xingfudeshi adee8b5
Merge branch 'develop' into spring-boot-starter
xingfudeshi 5690bdf
Merge branch 'develop' into spring-boot-starter
jsbxyyx 76a97d1
Merge branch 'develop' into spring-boot-starter
xingfudeshi 8fc0f0c
fix reviews.
xingfudeshi dd0e5bd
Merge remote-tracking branch 'origin/spring-boot-starter' into spring…
xingfudeshi 980ab95
Merge branch 'develop' into spring-boot-starter
xingfudeshi b4429b1
Merge branch 'develop' into spring-boot-starter
jsbxyyx af35b79
Merge branch 'develop' into spring-boot-starter
jsbxyyx 3bceaaf
Merge branch 'develop' into spring-boot-starter
xingfudeshi eb55ee3
Merge branch 'develop' into spring-boot-starter
xingfudeshi 4acc0e2
Merge branch 'develop' into spring-boot-starter
xingfudeshi 1bb22f0
Merge branch 'develop' into spring-boot-starter
xingfudeshi 4ca93bc
Merge branch 'develop' into spring-boot-starter
xingfudeshi 70e421f
Merge branch 'develop' into spring-boot-starter
xingfudeshi 10a9c2d
Merge branch 'develop' into spring-boot-starter
xingfudeshi c7a1e61
Merge branch 'develop' into spring-boot-starter
xingfudeshi 005d5a4
Merge branch 'develop' into spring-boot-starter
xingfudeshi 103bf8f
Merge branch 'develop' into spring-boot-starter
zjinlei 6db8366
Merge branch 'develop' into spring-boot-starter
jsbxyyx 7aa1c59
Merge branch 'develop' into spring-boot-starter
xingfudeshi f030d19
fix reviews and add missing configurations.
xingfudeshi 5267c19
Merge branch 'develop' into spring-boot-starter
xingfudeshi 6953a6c
Merge branch 'develop' into spring-boot-starter
xingfudeshi 9461671
Merge branch 'develop' into spring-boot-starter
xingfudeshi f7512ab
Merge branch 'develop' into spring-boot-starter
xingfudeshi 5e9cd84
Merge branch 'develop' into spring-boot-starter
zjinlei efe00ea
update codecov.yml
xingfudeshi f0ba5b1
Revert "update codecov.yml"
xingfudeshi eccc6e2
Merge branch 'develop' into spring-boot-starter
xingfudeshi f19de4e
Merge branch 'develop' into spring-boot-starter
xingfudeshi eda2d62
Merge branch 'develop' into spring-boot-starter
xingfudeshi 59aad16
Merge branch 'develop' into spring-boot-starter
zjinlei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
30 changes: 30 additions & 0 deletions
30
config/seata-config-core/src/main/java/io/seata/config/ExtConfigurationProvider.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,30 @@ | ||
/* | ||
* Copyright 1999-2019 Seata.io Group. | ||
* | ||
* 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 io.seata.config; | ||
|
||
/** | ||
* the interface ext configuration provider | ||
* @author xingfudeshi@gmail.com | ||
* @date 2019/10/03 | ||
*/ | ||
public interface ExtConfigurationProvider { | ||
/** | ||
* provide a AbstractConfiguration implementation instance | ||
* @param originalConfiguration | ||
* @return configuration | ||
*/ | ||
Configuration provide(Configuration originalConfiguration); | ||
} |
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
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,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 1999-2019 Seata.io Group. | ||
~ | ||
~ 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. | ||
--> | ||
<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>io.seata</groupId> | ||
<artifactId>seata-parent</artifactId> | ||
<version>${revision}</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>seata-spring-boot-starter</artifactId> | ||
<packaging>jar</packaging> | ||
<name>seata-spring-boot-starter ${project.version}</name> | ||
|
||
<properties> | ||
<spring-boot.version>1.5.22.RELEASE</spring-boot.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>${spring-boot.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
zjinlei marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<dependencies> | ||
<!--seata--> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>seata-all</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<!--spring--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
64 changes: 64 additions & 0 deletions
64
...boot-starter/src/main/java/io/seata/spring/boot/autoconfigure/SeataAutoConfiguration.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,64 @@ | ||
/* | ||
* Copyright 1999-2019 Seata.io Group. | ||
* | ||
* 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 io.seata.spring.boot.autoconfigure; | ||
|
||
import io.seata.rm.datasource.DataSourceProxy; | ||
import io.seata.spring.annotation.GlobalTransactionScanner; | ||
import io.seata.spring.boot.autoconfigure.properties.SeataProperties; | ||
import io.seata.spring.boot.autoconfigure.util.SpringUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.DependsOn; | ||
|
||
/** | ||
* @author xingfudeshi@gmail.com | ||
* @date 2019/09/30 | ||
*/ | ||
@ComponentScan(basePackages = "io.seata.spring.boot.autoconfigure.properties") | ||
@ConditionalOnProperty(prefix = StarterConstants.SEATA_PREFIX, name = "enabled", matchIfMissing = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check seata.enable value. |
||
@ConditionalOnClass({DataSourceProxy.class}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if not contains AT mode. |
||
@Configuration | ||
@EnableConfigurationProperties({SeataProperties.class}) | ||
public class SeataAutoConfiguration { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(SeataAutoConfiguration.class); | ||
@Autowired | ||
private SeataProperties seataProperties; | ||
|
||
@Bean | ||
public SpringUtils springUtils() { | ||
return new SpringUtils(); | ||
} | ||
|
||
@Bean | ||
@DependsOn({"springUtils"}) | ||
@ConditionalOnMissingBean(GlobalTransactionScanner.class) | ||
public GlobalTransactionScanner globalTransactionScanner() { | ||
if (LOGGER.isInfoEnabled()) { | ||
LOGGER.info("Automatically configure Seata"); | ||
} | ||
return new GlobalTransactionScanner(seataProperties.getApplicationId(), seataProperties.getTxServiceGroup()); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need with seata prefix?