Commit fc4c9918befb2fe4c2077f6a4cc87f50ebd22807
1 parent
faab39dd
Exists in
master
增加服务注册功能
Showing
4 changed files
with
35 additions
and
11 deletions
Show diff stats
springboot/pom.xml
@@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
17 | 17 | ||
18 | <properties> | 18 | <properties> |
19 | <java.version>1.8</java.version> | 19 | <java.version>1.8</java.version> |
20 | + <spring-cloud.version>Greenwich.SR1</spring-cloud.version> | ||
20 | </properties> | 21 | </properties> |
21 | 22 | ||
22 | <dependencies> | 23 | <dependencies> |
@@ -124,8 +125,25 @@ | @@ -124,8 +125,25 @@ | ||
124 | <artifactId>commons-lang3</artifactId> | 125 | <artifactId>commons-lang3</artifactId> |
125 | <version>3.1</version> | 126 | <version>3.1</version> |
126 | </dependency> | 127 | </dependency> |
128 | + <!--注册中心--> | ||
129 | + <dependency> | ||
130 | + <groupId>org.springframework.cloud</groupId> | ||
131 | + <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> | ||
132 | + </dependency> | ||
127 | </dependencies> | 133 | </dependencies> |
128 | 134 | ||
135 | + <dependencyManagement> | ||
136 | + <dependencies> | ||
137 | + <dependency> | ||
138 | + <groupId>org.springframework.cloud</groupId> | ||
139 | + <artifactId>spring-cloud-dependencies</artifactId> | ||
140 | + <version>${spring-cloud.version}</version> | ||
141 | + <type>pom</type> | ||
142 | + <scope>import</scope> | ||
143 | + </dependency> | ||
144 | + </dependencies> | ||
145 | + </dependencyManagement> | ||
146 | + | ||
129 | <build> | 147 | <build> |
130 | <finalName>springboot-sincere</finalName> | 148 | <finalName>springboot-sincere</finalName> |
131 | <plugins> | 149 | <plugins> |
springboot/src/main/java/com/sincre/springboot/ApiModel/UserInfo.java
@@ -10,7 +10,7 @@ public class UserInfo { | @@ -10,7 +10,7 @@ public class UserInfo { | ||
10 | * */ | 10 | * */ |
11 | private String country_code; | 11 | private String country_code; |
12 | /** | 12 | /** |
13 | - * 用户名,业务方md5加密 是 | 13 | + * 用户名 当用户名类型=1,用户名=mobile,当用户类型 = 2,用户名=email,当用户类型=3,用户名=username, 默认:3 |
14 | */ | 14 | */ |
15 | private String username; | 15 | private String username; |
16 | /** | 16 | /** |
springboot/src/main/java/com/sincre/springboot/SpringbootApplication.java
@@ -7,6 +7,7 @@ import org.springframework.boot.SpringApplication; | @@ -7,6 +7,7 @@ import org.springframework.boot.SpringApplication; | ||
7 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
8 | import org.springframework.boot.builder.SpringApplicationBuilder; | 8 | import org.springframework.boot.builder.SpringApplicationBuilder; |
9 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | 9 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
10 | +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
10 | 11 | ||
11 | import javax.swing.*; | 12 | import javax.swing.*; |
12 | import java.awt.*; | 13 | import java.awt.*; |
@@ -15,12 +16,13 @@ import java.util.Date; | @@ -15,12 +16,13 @@ import java.util.Date; | ||
15 | 16 | ||
16 | @MapperScan("com.sincre.springboot.mapper") | 17 | @MapperScan("com.sincre.springboot.mapper") |
17 | @SpringBootApplication | 18 | @SpringBootApplication |
19 | +@EnableDiscoveryClient | ||
18 | public class SpringbootApplication extends SpringBootServletInitializer { | 20 | public class SpringbootApplication extends SpringBootServletInitializer { |
19 | 21 | ||
20 | public static void main(String[] args) { | 22 | public static void main(String[] args) { |
21 | 23 | ||
22 | SpringApplication.run(SpringbootApplication.class, args); | 24 | SpringApplication.run(SpringbootApplication.class, args); |
23 | - new YinShiController().GetYinShiToken();//获取萤石云token | 25 | + //new YinShiController().GetYinShiToken();//获取萤石云token |
24 | } | 26 | } |
25 | 27 | ||
26 | } | 28 | } |
springboot/src/main/resources/application.properties
1 | -server.port=1111 | ||
2 | -# 设置数据库相关属性 | ||
3 | -spring.datasource.username=thd | ||
4 | -spring.datasource.password=pmd19930415A | ||
5 | -spring.datasource.url=jdbc:sqlserver://60.190.202.57:14333;database=test | ||
6 | -spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver | ||
7 | -mybatis.config-location=classpath:mybatis-config.xml | ||
8 | -mybatis.mapper-locations=classpath:/mapper/*.xml | ||
9 | -mybatis.type-aliases-package=com.sincre.springboot.model | ||
10 | \ No newline at end of file | 1 | \ No newline at end of file |
2 | +spring.application.name=iot-api | ||
3 | +#server.port=8088 | ||
4 | +# 设置数据库相关属性 | ||
5 | +spring.datasource.username=thd | ||
6 | +spring.datasource.password=pmd19930415A | ||
7 | +spring.datasource.url=jdbc:sqlserver://60.190.202.57:14333;database=test | ||
8 | +spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver | ||
9 | +mybatis.config-location=classpath:mybatis-config.xml | ||
10 | +mybatis.mapper-locations=classpath:/mapper/*.xml | ||
11 | +mybatis.type-aliases-package=com.sincre.springboot.model | ||
12 | + | ||
13 | +#对应服务注册中心的配置内容,指定服务注册中心的位置。 | ||
14 | +eureka.client.serviceUrl.defaultZone=http://localhost:8001/eureka/ | ||
11 | \ No newline at end of file | 15 | \ No newline at end of file |