Created
March 10, 2020 09:36
-
-
Save Selenium39/21a9abe623a290de3c586597bf1e0212 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CompilerConfiguration"> | |
<annotationProcessing> | |
<profile default="true" name="Default" enabled="true" /> | |
<profile name="Maven default annotation processors profile" enabled="true"> | |
<sourceOutputDir name="target/generated-sources/annotations" /> | |
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | |
<outputRelativeToContentRoot value="true" /> | |
<module name="cloud-api-common" /> | |
<module name="cloud-order-comsumer-80" /> | |
<module name="cloud-payment-provider-8082" /> | |
<module name="cloud-payment-provider-8081" /> | |
<module name="cloud-eureka-server-7002" /> | |
<module name="cloud-eureka-server-7001" /> | |
</profile> | |
</annotationProcessing> | |
</component> | |
</project> |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8"> | |
<file url="file://$PROJECT_DIR$" charset="UTF-8" /> | |
<file url="file://$PROJECT_DIR$/cloud-api-common" charset="UTF-8" /> | |
<file url="file://$PROJECT_DIR$/cloud-eureka-server-7001" charset="UTF-8" /> | |
<file url="file://$PROJECT_DIR$/cloud-eureka-server-7002" charset="UTF-8" /> | |
<file url="file://$PROJECT_DIR$/cloud-order-comsumer-80" charset="UTF-8" /> | |
<file url="file://$PROJECT_DIR$/cloud-payment-provider-8081" charset="UTF-8" /> | |
<file url="file://$PROJECT_DIR$/cloud-payment-provider-8082" charset="UTF-8" /> | |
<file url="PROJECT" charset="UTF-8" /> | |
</component> | |
</project> |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ExternalStorageConfigurationManager" enabled="true" /> | |
<component name="MavenProjectsManager"> | |
<option name="originalFiles"> | |
<list> | |
<option value="$PROJECT_DIR$/pom.xml" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ChangeListManager"> | |
<list default="true" id="352f4c48-77c6-4d1c-8847-a36c9976a3b9" name="Default Changelist" comment="" /> | |
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |
<option name="SHOW_DIALOG" value="false" /> | |
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |
<option name="LAST_RESOLUTION" value="IGNORE" /> | |
</component> | |
<component name="CodeInsightWorkspaceSettings"> | |
<option name="optimizeImportsOnTheFly" value="true" /> | |
</component> | |
<component name="FileTemplateManagerImpl"> | |
<option name="RECENT_TEMPLATES"> | |
<list> | |
<option value="FxmlFile" /> | |
<option value="spring-beans.schema" /> | |
<option value="Interface" /> | |
<option value="Class" /> | |
</list> | |
</option> | |
</component> | |
<component name="MavenImportPreferences"> | |
<option name="generalSettings"> | |
<MavenGeneralSettings> | |
<option name="localRepository" value="C:\src\mavenRepository" /> | |
<option name="mavenHome" value="C:/Program Files/maven/apache-maven-3.6.2" /> | |
<option name="userSettingsFile" value="C:\Program Files\maven\apache-maven-3.6.2\conf\settings.xml" /> | |
</MavenGeneralSettings> | |
</option> | |
<option name="importingSettings"> | |
<MavenImportingSettings> | |
<option name="importAutomatically" value="true" /> | |
<option name="vmOptionsForImporter" value="-Xmx768m" /> | |
</MavenImportingSettings> | |
</option> | |
</component> | |
<component name="ProjectId" id="1Yph63mQGn3GeKiAQ9ctv3w02K4" /> | |
<component name="PropertiesComponent"> | |
<property name="RequestMappingsPanelOrder0" value="0" /> | |
<property name="RequestMappingsPanelOrder1" value="1" /> | |
<property name="RequestMappingsPanelWidth0" value="75" /> | |
<property name="RequestMappingsPanelWidth1" value="75" /> | |
<property name="WebServerToolWindowFactoryState" value="false" /> | |
<property name="aspect.path.notification.shown" value="true" /> | |
<property name="last_opened_file_path" value="$PROJECT_DIR$/cloud-payment-provider-8082/src/main/resources" /> | |
<property name="settings.editor.selected.configurable" value="configurable.group.build" /> | |
</component> | |
<component name="RecentsManager"> | |
<key name="CopyClassDialog.RECENTS_KEY"> | |
<recent name="com.selenium.springcloud" /> | |
<recent name="com.selenium.springcloud.service.impl" /> | |
<recent name="com.selenium.springcloud.service" /> | |
<recent name="com.selenium.springcloud.dao" /> | |
<recent name="com.selenium.springcloud.controller.dao" /> | |
</key> | |
<key name="CopyFile.RECENT_KEYS"> | |
<recent name="C:\src\idea\SpringCloud2020\cloud-payment-provider-8082\src\main\resources" /> | |
<recent name="C:\src\idea\SpringCloud2020\cloud-payment-provider-8082\src\main\resources\mapper" /> | |
<recent name="C:\src\idea\SpringCloud2020\cloud-eureka-server-7002\src\main\resources" /> | |
</key> | |
</component> | |
<component name="RunDashboard"> | |
<option name="configurationTypes"> | |
<set> | |
<option value="SpringBootApplicationConfigurationType" /> | |
</set> | |
</option> | |
<option name="ruleStates"> | |
<list> | |
<RuleState> | |
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | |
</RuleState> | |
<RuleState> | |
<option name="name" value="StatusDashboardGroupingRule" /> | |
</RuleState> | |
</list> | |
</option> | |
</component> | |
<component name="RunManager" selected="Spring Boot.PaymentMain8082"> | |
<configuration name="EurekaServerMain7001" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> | |
<module name="cloud-eureka-server-7001" /> | |
<option name="SPRING_BOOT_MAIN_CLASS" value="com.selenium.springcloud.EurekaServerMain7001" /> | |
<method v="2"> | |
<option name="Make" enabled="true" /> | |
</method> | |
</configuration> | |
<configuration name="EurekaServerMain7002" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> | |
<module name="cloud-eureka-server-7002" /> | |
<option name="SPRING_BOOT_MAIN_CLASS" value="com.selenium.springcloud.EurekaServerMain7002" /> | |
<method v="2"> | |
<option name="Make" enabled="true" /> | |
</method> | |
</configuration> | |
<configuration name="OrderMain80" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true"> | |
<module name="cloud-order-comsumer-80" /> | |
<extension name="coverage"> | |
<pattern> | |
<option name="PATTERN" value="com.selenium.springcloud.*" /> | |
<option name="ENABLED" value="true" /> | |
</pattern> | |
</extension> | |
<option name="SPRING_BOOT_MAIN_CLASS" value="com.selenium.springcloud.OrderMain80" /> | |
<method v="2"> | |
<option name="Make" enabled="true" /> | |
</method> | |
</configuration> | |
<configuration name="PaymentMain8081" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> | |
<module name="cloud-payment-provider-8081" /> | |
<option name="SPRING_BOOT_MAIN_CLASS" value="com.selenium.springcloud.PaymentMain8081" /> | |
<method v="2"> | |
<option name="Make" enabled="true" /> | |
</method> | |
</configuration> | |
<configuration name="PaymentMain8082" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true"> | |
<module name="cloud-payment-provider-8082" /> | |
<extension name="coverage"> | |
<pattern> | |
<option name="PATTERN" value="com.selenium.springcloud.*" /> | |
<option name="ENABLED" value="true" /> | |
</pattern> | |
</extension> | |
<option name="SPRING_BOOT_MAIN_CLASS" value="com.selenium.springcloud.PaymentMain8082" /> | |
<method v="2"> | |
<option name="Make" enabled="true" /> | |
</method> | |
</configuration> | |
<recent_temporary> | |
<list> | |
<item itemvalue="Spring Boot.OrderMain80" /> | |
<item itemvalue="Spring Boot.PaymentMain8082" /> | |
</list> | |
</recent_temporary> | |
</component> | |
<component name="ServiceViewManager"> | |
<option name="allServicesViewState"> | |
<serviceView> | |
<treeState> | |
<expand> | |
<path> | |
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" /> | |
<item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@54a5a988" type="7427dc5b:ServiceModel$ServiceGroupNode" /> | |
</path> | |
<path> | |
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" /> | |
<item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@54a5a988" type="7427dc5b:ServiceModel$ServiceGroupNode" /> | |
<item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@818bca4" type="7427dc5b:ServiceModel$ServiceGroupNode" /> | |
</path> | |
</expand> | |
<select /> | |
</treeState> | |
</serviceView> | |
</option> | |
</component> | |
<component name="SshConsoleOptionsProvider"> | |
<option name="myEncoding" value="UTF-8" /> | |
<option name="myConnectionType" value="NONE" /> | |
</component> | |
<component name="StructureViewFactory"> | |
<option name="ACTIVE_ACTIONS" value=",SHOW_FIELDS" /> | |
</component> | |
<component name="SvnConfiguration"> | |
<configuration /> | |
</component> | |
<component name="TaskManager"> | |
<task active="true" id="Default" summary="Default task"> | |
<changelist id="352f4c48-77c6-4d1c-8847-a36c9976a3b9" name="Default Changelist" comment="" /> | |
<created>1583645264905</created> | |
<option name="number" value="Default" /> | |
<option name="presentableId" value="Default" /> | |
<updated>1583645264905</updated> | |
<workItem from="1583645266659" duration="390000" /> | |
<workItem from="1583645689330" duration="21049000" /> | |
<workItem from="1583748264328" duration="21275000" /> | |
</task> | |
<servers /> | |
</component> | |
<component name="TypeScriptGeneratedFilesManager"> | |
<option name="version" value="1" /> | |
</component> | |
</project> |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<parent> | |
<artifactId>SpringCloud2020</artifactId> | |
<groupId>com.selenium</groupId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>cloud-api-common</artifactId> | |
<dependencies> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>cn.hutool</groupId> | |
<artifactId>hutool-all</artifactId> | |
<version>5.1.0</version> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains hidden or 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
package com.selenium.springcloud.entity; | |
import lombok.AllArgsConstructor; | |
import lombok.Data; | |
import lombok.NoArgsConstructor; | |
import java.io.Serializable; | |
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
public class Payment implements Serializable { | |
private Long id; | |
private String serial; | |
} |
This file contains hidden or 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
package com.selenium.springcloud.result; | |
import lombok.AllArgsConstructor; | |
import lombok.Data; | |
import lombok.NoArgsConstructor; | |
/** | |
* 通用的数据返回类 | |
*/ | |
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
public class CommonResult<T> { | |
private Integer code; | |
private String message; | |
private T data; | |
public CommonResult(Integer code, String message) { | |
this(code, message, null); | |
} | |
} |
This file contains hidden or 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
#Generated by Maven | |
#Mon Mar 09 14:23:08 CST 2020 | |
version=1.0-SNAPSHOT | |
groupId=com.selenium | |
artifactId=cloud-api-common |
This file contains hidden or 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
com\selenium\springcloud\result\CommonResult.class | |
com\selenium\springcloud\entity\Payment.class |
This file contains hidden or 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
C:\src\idea\SpringCloud2020\cloud-api-common\src\main\java\com\selenium\springcloud\result\CommonResult.java | |
C:\src\idea\SpringCloud2020\cloud-api-common\src\main\java\com\selenium\springcloud\entity\Payment.java |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<parent> | |
<artifactId>SpringCloud2020</artifactId> | |
<groupId>com.selenium</groupId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>cloud-eureka-server-7001</artifactId> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.selenium</groupId> | |
<artifactId>cloud-api-common</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains hidden or 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
package com.selenium.springcloud; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; | |
@SpringBootApplication | |
@EnableEurekaServer | |
public class EurekaServerMain7001 { | |
public static void main(String[] args) { | |
SpringApplication.run(EurekaServerMain7001.class, args); | |
} | |
} |
This file contains hidden or 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
server: | |
port: 7001 | |
eureka: | |
instance: | |
hostname: server1 #eureka服务端的实例名 | |
client: | |
#false代表不向服务注册中心注册自己 | |
register-with-eureka: false | |
#false代表只需维护服务注册中心注册的服务实例而不用去检索服务 | |
fetch-registry: false | |
service-url: | |
#设置与Eureka交互的地址(查询和注册服务) | |
#集群模式指向其它Eureka Server | |
defaultZone: http://server2:7002/eureka/ | |
#单机模式指向自己 | |
#defaultZone: http://server1:7001/eureka/ | |
# server: | |
# 关闭自我保护机制,保证不可用服务被及时剔除 | |
# enable-self-preservation: false | |
# eviction-interval-timer-in-ms: 2000 |
This file contains hidden or 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
server: | |
port: 7001 | |
eureka: | |
instance: | |
hostname: server1 #eureka服务端的实例名 | |
client: | |
#false代表不向服务注册中心注册自己 | |
register-with-eureka: false | |
#false代表只需维护服务注册中心注册的服务实例而不用去检索服务 | |
fetch-registry: false | |
service-url: | |
#设置与Eureka交互的地址(查询和注册服务) | |
#集群模式指向其它Eureka Server | |
defaultZone: http://server2:7002/eureka/ | |
#单机模式指向自己 | |
#defaultZone: http://server1:7001/eureka/ | |
# server: | |
# 关闭自我保护机制,保证不可用服务被及时剔除 | |
# enable-self-preservation: false | |
# eviction-interval-timer-in-ms: 2000 |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<parent> | |
<artifactId>SpringCloud2020</artifactId> | |
<groupId>com.selenium</groupId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>cloud-eureka-server-7002</artifactId> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.selenium</groupId> | |
<artifactId>cloud-api-common</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains hidden or 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
package com.selenium.springcloud; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; | |
@SpringBootApplication | |
@EnableEurekaServer | |
public class EurekaServerMain7002 { | |
public static void main(String[] args) { | |
SpringApplication.run(EurekaServerMain7002.class, args); | |
} | |
} |
This file contains hidden or 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
server: | |
port: 7002 | |
eureka: | |
instance: | |
hostname: server2 #eureka服务端的实例名 | |
client: | |
#false代表不向服务注册中心注册自己 | |
register-with-eureka: false | |
#false代表只需维护服务注册中心注册的服务实例而不用去检索服务 | |
fetch-registry: false | |
service-url: | |
#设置与Eureka交互的地址(查询和注册服务) | |
defaultZone: http://server1:7001/eureka/ |
This file contains hidden or 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
server: | |
port: 7002 | |
eureka: | |
instance: | |
hostname: server2 #eureka服务端的实例名 | |
client: | |
#false代表不向服务注册中心注册自己 | |
register-with-eureka: false | |
#false代表只需维护服务注册中心注册的服务实例而不用去检索服务 | |
fetch-registry: false | |
service-url: | |
#设置与Eureka交互的地址(查询和注册服务) | |
defaultZone: http://server1:7001/eureka/ |
This file contains hidden or 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
#Generated by Maven | |
#Mon Mar 09 18:08:34 CST 2020 | |
version=1.0-SNAPSHOT | |
groupId=com.selenium | |
artifactId=cloud-eureka-server-7002 |
This file contains hidden or 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
com\selenium\springcloud\EurekaServerMain7002.class |
This file contains hidden or 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
C:\src\idea\SpringCloud2020\cloud-eureka-server-7002\src\main\java\com\selenium\springcloud\EurekaServerMain7002.java |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4" /> |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<parent> | |
<artifactId>SpringCloud2020</artifactId> | |
<groupId>com.selenium</groupId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>cloud-order-comsumer-80</artifactId> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.selenium</groupId> | |
<artifactId>cloud-api-common</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains hidden or 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
package com.selenium.springcloud.config; | |
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.web.client.RestTemplate; | |
/** | |
* 相当于applicationContext.xml | |
*/ | |
@Configuration | |
public class ApplicationContextConfig { | |
@Bean | |
//@LoadBalanced注解提供了RestTemplate负载均衡的能力 | |
@LoadBalanced | |
public RestTemplate getRestTemplate() { | |
return new RestTemplate(); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.controller; | |
import com.selenium.springcloud.entity.Payment; | |
import com.selenium.springcloud.result.CommonResult; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.cloud.client.ServiceInstance; | |
import org.springframework.cloud.client.discovery.DiscoveryClient; | |
import org.springframework.web.bind.annotation.*; | |
import org.springframework.web.client.RestTemplate; | |
import java.util.List; | |
@RestController | |
@Slf4j | |
@RequestMapping("/consumer/order") | |
public class OrderController { | |
//通过ip,port直接访问 | |
//private static final String PAYMENT_URL = "http://localhost:8081"; | |
//通过服务名访问,可使用负载均衡的功能 | |
private static final String PAYMENT_URL = "http://CLOUD-PAYMENT-SERVICE"; | |
@Autowired | |
private RestTemplate restTemplate; | |
@Autowired | |
private DiscoveryClient discoveryClient; | |
@PostMapping("/create") | |
public CommonResult create(Payment payment) { | |
return restTemplate.postForObject(PAYMENT_URL + "/payment/create", payment, CommonResult.class); | |
} | |
@GetMapping("/get/{id}") | |
public CommonResult getPayment(@PathVariable("id") Long id) { | |
return restTemplate.getForObject(PAYMENT_URL + "/payment/get/" + id, CommonResult.class); | |
} | |
@GetMapping("/discovery") | |
public Object getServiceInfo() { | |
List<String> services = discoveryClient.getServices(); | |
for (String service : services) { | |
List<ServiceInstance> instances = discoveryClient.getInstances(service); | |
for (ServiceInstance instance : instances) { | |
//获得服务实例相关信息 | |
//log.info(instance.getServiceId()+"\t"+instance.getHost()+"\t"+instance.getPort()+"\t"+instance.getUri()); | |
} | |
} | |
return discoveryClient; | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | |
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
@SpringBootApplication | |
@EnableEurekaClient | |
@EnableDiscoveryClient | |
public class OrderMain80 { | |
public static void main(String[] args) { | |
SpringApplication.run(OrderMain80.class, args); | |
} | |
} |
This file contains hidden or 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
server: | |
port: 80 | |
spring: | |
application: | |
name: cloud-order-service | |
eureka: | |
instance: | |
hostname: localhost | |
instance-id: order80 | |
prefer-ip-address: true #显示出ip | |
#客户端向服务注册中心发送心跳间隔(默认30秒) | |
lease-renewal-interval-in-seconds: 30 | |
#最后一次心跳后,剔除服务等待时间(默认90秒) | |
lease-expiration-duration-in-seconds: 90 | |
client: | |
fetch-registry: true | |
register-with-eureka: true | |
service-url: | |
defaultZone: http://server1:7001/eureka/,http://server2:7002/eureka/ | |
This file contains hidden or 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
server: | |
port: 80 | |
spring: | |
application: | |
name: cloud-order-service | |
eureka: | |
instance: | |
hostname: localhost | |
instance-id: order80 | |
prefer-ip-address: true #显示出ip | |
#客户端向服务注册中心发送心跳间隔(默认30秒) | |
lease-renewal-interval-in-seconds: 30 | |
#最后一次心跳后,剔除服务等待时间(默认90秒) | |
lease-expiration-duration-in-seconds: 90 | |
client: | |
fetch-registry: true | |
register-with-eureka: true | |
service-url: | |
defaultZone: http://server1:7001/eureka/,http://server2:7002/eureka/ | |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<parent> | |
<artifactId>SpringCloud2020</artifactId> | |
<groupId>com.selenium</groupId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>cloud-payment-provider-8081</artifactId> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.selenium</groupId> | |
<artifactId>cloud-api-common</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.mybatis.spring.boot</groupId> | |
<artifactId>mybatis-spring-boot-starter</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.alibaba</groupId> | |
<artifactId>druid-spring-boot-starter</artifactId> | |
<version>1.1.10</version> | |
</dependency> | |
<dependency> | |
<groupId>mysql</groupId> | |
<artifactId>mysql-connector-java</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-jdbc</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains hidden or 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
package com.selenium.springcloud.controller; | |
import com.selenium.springcloud.entity.Payment; | |
import com.selenium.springcloud.result.CommonResult; | |
import com.selenium.springcloud.service.PaymentService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.web.bind.annotation.*; | |
@RestController | |
@RequestMapping("/payment") | |
public class PaymentController { | |
@Autowired | |
private PaymentService paymentService; | |
@Value("${server.port}") | |
private String serverPort; | |
@PostMapping("/create") | |
public CommonResult create(@RequestBody Payment payment) { | |
int result = paymentService.create(payment); | |
return new CommonResult(200, "success,serverPort: " + serverPort, result); | |
} | |
@GetMapping("/get/{id}") | |
public CommonResult getPaymentById(@PathVariable("id") Long id) { | |
Payment payment = paymentService.getPaymentById(id); | |
return new CommonResult(200, "success,serverPort: " + serverPort, payment); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.dao; | |
import com.selenium.springcloud.entity.Payment; | |
import org.apache.ibatis.annotations.Mapper; | |
import org.apache.ibatis.annotations.Param; | |
@Mapper | |
public interface PaymentDao { | |
int create(Payment payment); | |
Payment getPaymentById(@Param("id") Long id); | |
} |
This file contains hidden or 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
package com.selenium.springcloud; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
@SpringBootApplication | |
@EnableEurekaClient | |
public class PaymentMain8081 { | |
public static void main(String[] args) { | |
SpringApplication.run(PaymentMain8081.class, args); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.service.impl; | |
import com.selenium.springcloud.dao.PaymentDao; | |
import com.selenium.springcloud.entity.Payment; | |
import com.selenium.springcloud.service.PaymentService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
@Service | |
public class PaymentServiceImpl implements PaymentService { | |
@Autowired | |
private PaymentDao paymentDao; | |
@Override | |
public int create(Payment payment) { | |
return paymentDao.create(payment); | |
} | |
@Override | |
public Payment getPaymentById(Long id) { | |
return paymentDao.getPaymentById(id); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.service; | |
import com.selenium.springcloud.entity.Payment; | |
import org.apache.ibatis.annotations.Param; | |
public interface PaymentService { | |
int create(Payment payment); | |
Payment getPaymentById(@Param("id") Long id); | |
} |
This file contains hidden or 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
server: | |
port: 8081 | |
spring: | |
application: | |
name: cloud-payment-service | |
datasource: | |
type: com.alibaba.druid.pool.DruidDataSource | |
driver-class-name: com.mysql.cj.jdbc.Driver | |
url: jdbc:mysql://localhost:3306/cloud2020?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC | |
username: root | |
password: 15773272279wt..A | |
mybatis: | |
mapper-locations: classpath:mapper/*.xml | |
type-aliases-package: com.selenium.springcloud.entity | |
eureka: | |
instance: | |
hostname: localhost | |
instance-id: payment8081 | |
prefer-ip-address: true #显示出ip | |
client: | |
#向服务注册中心注册 | |
register-with-eureka: true | |
#向服务注册中心拉取注册的服务实例(单机版provider无所谓,集群必须设置为true才能配合ribbon使用负载均衡) | |
fetch-registry: true | |
#服务注册中心Server向外提供的服务接口URL | |
service-url: | |
defaultZone: http://server1:7001/eureka/,http://server2:7002/eureka/ |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
<mapper namespace="com.selenium.springcloud.dao.PaymentDao"> | |
<resultMap id="BaseResultMap" type="com.selenium.springcloud.entity.Payment"> | |
<id column="id" property="id" jdbcType="BIGINT"/> | |
<result column="serial" property="serial" jdbcType="VARCHAR"/> | |
</resultMap> | |
<select id="getPaymentById" parameterType="Long" resultMap="BaseResultMap"> | |
select id,serial from payment where id = #{id} | |
</select> | |
<insert id="create" parameterType="Payment" useGeneratedKeys="true" keyProperty="id"> | |
insert into payment(serial) values (#{serial}) | |
</insert> | |
</mapper> |
This file contains hidden or 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
server: | |
port: 8081 | |
spring: | |
application: | |
name: cloud-payment-service | |
datasource: | |
type: com.alibaba.druid.pool.DruidDataSource | |
driver-class-name: com.mysql.cj.jdbc.Driver | |
url: jdbc:mysql://localhost:3306/cloud2020?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC | |
username: root | |
password: 15773272279wt..A | |
mybatis: | |
mapper-locations: classpath:mapper/*.xml | |
type-aliases-package: com.selenium.springcloud.entity | |
eureka: | |
instance: | |
hostname: localhost | |
instance-id: payment8081 | |
prefer-ip-address: true #显示出ip | |
client: | |
#向服务注册中心注册 | |
register-with-eureka: true | |
#向服务注册中心拉取注册的服务实例(单机版provider无所谓,集群必须设置为true才能配合ribbon使用负载均衡) | |
fetch-registry: true | |
#服务注册中心Server向外提供的服务接口URL | |
service-url: | |
defaultZone: http://server1:7001/eureka/,http://server2:7002/eureka/ |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
<mapper namespace="com.selenium.springcloud.dao.PaymentDao"> | |
<resultMap id="BaseResultMap" type="com.selenium.springcloud.entity.Payment"> | |
<id column="id" property="id" jdbcType="BIGINT"/> | |
<result column="serial" property="serial" jdbcType="VARCHAR"/> | |
</resultMap> | |
<select id="getPaymentById" parameterType="Long" resultMap="BaseResultMap"> | |
select id,serial from payment where id = #{id} | |
</select> | |
<insert id="create" parameterType="Payment" useGeneratedKeys="true" keyProperty="id"> | |
insert into payment(serial) values (#{serial}) | |
</insert> | |
</mapper> |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<parent> | |
<artifactId>SpringCloud2020</artifactId> | |
<groupId>com.selenium</groupId> | |
<version>1.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>cloud-payment-provider-8082</artifactId> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.selenium</groupId> | |
<artifactId>cloud-api-common</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<optional>true</optional> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.mybatis.spring.boot</groupId> | |
<artifactId>mybatis-spring-boot-starter</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>com.alibaba</groupId> | |
<artifactId>druid-spring-boot-starter</artifactId> | |
<version>1.1.10</version> | |
</dependency> | |
<dependency> | |
<groupId>mysql</groupId> | |
<artifactId>mysql-connector-java</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-jdbc</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains hidden or 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
package com.selenium.springcloud.controller; | |
import com.selenium.springcloud.entity.Payment; | |
import com.selenium.springcloud.result.CommonResult; | |
import com.selenium.springcloud.service.PaymentService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.web.bind.annotation.*; | |
@RestController | |
@RequestMapping("/payment") | |
public class PaymentController { | |
@Autowired | |
private PaymentService paymentService; | |
@Value("${server.port}") | |
private String serverPort; | |
@PostMapping("/create") | |
public CommonResult create(@RequestBody Payment payment) { | |
int result = paymentService.create(payment); | |
return new CommonResult(200, "success,serverPort: " + serverPort, result); | |
} | |
@GetMapping("/get/{id}") | |
public CommonResult getPaymentById(@PathVariable("id") Long id) { | |
Payment payment = paymentService.getPaymentById(id); | |
return new CommonResult(200, "success,serverPort: " + serverPort, payment); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.dao; | |
import com.selenium.springcloud.entity.Payment; | |
import org.apache.ibatis.annotations.Mapper; | |
import org.apache.ibatis.annotations.Param; | |
@Mapper | |
public interface PaymentDao { | |
int create(Payment payment); | |
Payment getPaymentById(@Param("id") Long id); | |
} |
This file contains hidden or 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
package com.selenium.springcloud; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
@SpringBootApplication | |
@EnableEurekaClient | |
public class PaymentMain8082 { | |
public static void main(String[] args) { | |
SpringApplication.run(PaymentMain8082.class, args); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.service.impl; | |
import com.selenium.springcloud.dao.PaymentDao; | |
import com.selenium.springcloud.entity.Payment; | |
import com.selenium.springcloud.service.PaymentService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
@Service | |
public class PaymentServiceImpl implements PaymentService { | |
@Autowired | |
private PaymentDao paymentDao; | |
@Override | |
public int create(Payment payment) { | |
return paymentDao.create(payment); | |
} | |
@Override | |
public Payment getPaymentById(Long id) { | |
return paymentDao.getPaymentById(id); | |
} | |
} |
This file contains hidden or 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
package com.selenium.springcloud.service; | |
import com.selenium.springcloud.entity.Payment; | |
import org.apache.ibatis.annotations.Param; | |
public interface PaymentService { | |
int create(Payment payment); | |
Payment getPaymentById(@Param("id") Long id); | |
} |
This file contains hidden or 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
server: | |
port: 8082 | |
spring: | |
application: | |
name: cloud-payment-service | |
datasource: | |
type: com.alibaba.druid.pool.DruidDataSource | |
driver-class-name: com.mysql.cj.jdbc.Driver | |
url: jdbc:mysql://localhost:3306/cloud2020?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC | |
username: root | |
password: 15773272279wt..A | |
mybatis: | |
mapper-locations: classpath:mapper/*.xml | |
type-aliases-package: com.selenium.springcloud.entity | |
eureka: | |
instance: | |
hostname: localhost | |
instance-id: payment8082 | |
prefer-ip-address: true #显示出ip | |
client: | |
#向服务注册中心注册 | |
register-with-eureka: true | |
#向服务注册中心拉取注册的服务实例(单机版provider无所谓,集群必须设置为true才能配合ribbon使用负载均衡) | |
fetch-registry: true | |
#服务注册中心Server向外提供的服务接口URL | |
service-url: | |
defaultZone: http://server1:7001/eureka/,http://server2:7002/eureka/ |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
<mapper namespace="com.selenium.springcloud.dao.PaymentDao"> | |
<resultMap id="BaseResultMap" type="com.selenium.springcloud.entity.Payment"> | |
<id column="id" property="id" jdbcType="BIGINT"/> | |
<result column="serial" property="serial" jdbcType="VARCHAR"/> | |
</resultMap> | |
<select id="getPaymentById" parameterType="Long" resultMap="BaseResultMap"> | |
select id,serial from payment where id = #{id} | |
</select> | |
<insert id="create" parameterType="Payment" useGeneratedKeys="true" keyProperty="id"> | |
insert into payment(serial) values (#{serial}) | |
</insert> | |
</mapper> |
This file contains hidden or 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
server: | |
port: 8082 | |
spring: | |
application: | |
name: cloud-payment-service | |
datasource: | |
type: com.alibaba.druid.pool.DruidDataSource | |
driver-class-name: com.mysql.cj.jdbc.Driver | |
url: jdbc:mysql://localhost:3306/cloud2020?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC | |
username: root | |
password: 15773272279wt..A | |
mybatis: | |
mapper-locations: classpath:mapper/*.xml | |
type-aliases-package: com.selenium.springcloud.entity | |
eureka: | |
instance: | |
hostname: localhost | |
instance-id: payment8082 | |
prefer-ip-address: true #显示出ip | |
client: | |
#向服务注册中心注册 | |
register-with-eureka: true | |
#向服务注册中心拉取注册的服务实例(单机版provider无所谓,集群必须设置为true才能配合ribbon使用负载均衡) | |
fetch-registry: true | |
#服务注册中心Server向外提供的服务接口URL | |
service-url: | |
defaultZone: http://server1:7001/eureka/,http://server2:7002/eureka/ |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
<mapper namespace="com.selenium.springcloud.dao.PaymentDao"> | |
<resultMap id="BaseResultMap" type="com.selenium.springcloud.entity.Payment"> | |
<id column="id" property="id" jdbcType="BIGINT"/> | |
<result column="serial" property="serial" jdbcType="VARCHAR"/> | |
</resultMap> | |
<select id="getPaymentById" parameterType="Long" resultMap="BaseResultMap"> | |
select id,serial from payment where id = #{id} | |
</select> | |
<insert id="create" parameterType="Payment" useGeneratedKeys="true" keyProperty="id"> | |
insert into payment(serial) values (#{serial}) | |
</insert> | |
</mapper> |
This file contains hidden or 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
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<packaging>pom</packaging> | |
<modules> | |
<module>cloud-payment-provider-8081</module> | |
<module>cloud-order-comsumer-80</module> | |
<module>cloud-api-common</module> | |
<module>cloud-eureka-server-7001</module> | |
<module>cloud-eureka-server-7002</module> | |
<module>cloud-payment-provider-8082</module> | |
</modules> | |
<groupId>com.selenium</groupId> | |
<artifactId>SpringCloud2020</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<!--统一管理jar包版本--> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<maven.compiler.source>1.8</maven.compiler.source> | |
<maven.compiler.target>1.8</maven.compiler.target> | |
<junit.version>4.12</junit.version> | |
<log4j.version>1.2.17</log4j.version> | |
<lombok.version>1.16.18</lombok.version> | |
<mysql.version>8.0.17</mysql.version> | |
<druid.version>1.1.16</druid.version> | |
<mybatis.spring.boot.version>1.3.2</mybatis.spring.boot.version> | |
</properties> | |
<!--子模块继承后提供作用:锁定版本+子模块不用写GroupId和version--> | |
<dependencyManagement> | |
<dependencies> | |
<!-- springboot 2.2.2 --> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-dependencies</artifactId> | |
<version>2.2.2.RELEASE</version> | |
<type>pom</type> | |
<scope>import</scope> | |
</dependency> | |
<!-- springcloud cloud Hoxton.SR1 --> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-dependencies</artifactId> | |
<version>Hoxton.SR1</version> | |
<type>pom</type> | |
<scope>import</scope> | |
</dependency> | |
<!-- springcloud cloud alibaba 2.1.0.RELEASE --> | |
<dependency> | |
<groupId>com.alibaba.cloud</groupId> | |
<artifactId>spring-cloud-alibaba-dependencies</artifactId> | |
<version>2.1.0.RELEASE</version> | |
<type>pom</type> | |
<scope>import</scope> | |
</dependency> | |
<dependency> | |
<groupId>mysql</groupId> | |
<artifactId>mysql-connector-java</artifactId> | |
<version>${mysql.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>com.alibaba</groupId> | |
<artifactId>druid</artifactId> | |
<version>${druid.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.mybatis.spring.boot</groupId> | |
<artifactId>mybatis-spring-boot-starter</artifactId> | |
<version>${mybatis.spring.boot.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>log4j</groupId> | |
<artifactId>log4j</artifactId> | |
<version>${log4j.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>${junit.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.projectlombok</groupId> | |
<artifactId>lombok</artifactId> | |
<version>${lombok.version}</version> | |
<optional>true</optional> | |
</dependency> | |
</dependencies> | |
</dependencyManagement> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-maven-plugin</artifactId> | |
<version>1.3.5.RELEASE</version> | |
<configuration> | |
<fork>true</fork> | |
<addResources>true</addResources> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment