Commit a10dd6db by zhoujinghao

app

模块提交
1 parent d65be11d
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
<dependency> <dependency>
<groupId>org.mybatis.generator</groupId> <groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId> <artifactId>mybatis-generator-core</artifactId>
<version>${mybatis-generator.version}</version>
</dependency> </dependency>
<!-- MyBatis--> <!-- MyBatis-->
<dependency> <dependency>
......
package org.nafmii.nafmiiadmin.controller; package org.nafmii.nafmiiadmin.controller;
import org.nafmii.nafmiiadmin.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
...@@ -13,9 +16,14 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -13,9 +16,14 @@ import org.springframework.web.bind.annotation.RestController;
* @remark: * @remark:
*/ */
@RestController @RestController
@RequestMapping("web/nafmii/test/")
public class TestController { public class TestController {
@GetMapping("/test")
public String test(){ @Autowired
return "test"; private TestService service;
@GetMapping("search")
public String search(){
String test = service.search();
return test;
} }
} }
package org.nafmii.nafmiiadmin.service;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/22 8:57
* @ClassName:
* @version:
* @remark:
*/
public interface TestService {
String search();
}
package org.nafmii.nafmiiadmin.service.impl;
import org.nafmii.nafmiiadmin.service.TestService;
import org.springframework.stereotype.Service;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/22 8:58
* @ClassName:
* @version:
* @remark:
*/
@Service
public class TestServiceImpl implements TestService {
@Override
public String search() {
return "成功";
}
}
...@@ -14,40 +14,93 @@ ...@@ -14,40 +14,93 @@
<description>Demo project for Spring Boot</description> <description>Demo project for Spring Boot</description>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<spring-cloud.version>2020.0.2</spring-cloud.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!--MyBatis分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
</dependency>
<!--feign -->
<dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
<scope>test</scope> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
</dependency>
<!-- MyBatis-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</dependency>
<!--SpringData工具包-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
</dependency>
<!--JWT(Json Web Token)登录支持-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<!--JWT(Json Web Token)登录支持-->
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
</dependency>
<!--集成logstash-->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
</dependency>
<!--集成SpringBoot Admin监控-->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build> <build>
<plugins> <plugins>
......
...@@ -2,8 +2,13 @@ package org.nafmii; ...@@ -2,8 +2,13 @@ package org.nafmii;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableEurekaClient
@EnableFeignClients
public class NafmiiAppApplication { public class NafmiiAppApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package org.nafmii.adminService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/22 9:04
* @ClassName:
* @version:
* @remark:
*/
@FeignClient(value = "nafmii-admin")
public interface AdminService {
//测试feign
@GetMapping("web/nafmii/test/search")
public String search();
}
package org.nafmii.controller;
import org.nafmii.adminService.AdminService;
import org.nafmii.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/22 9:08
* @ClassName:
* @version:
* @remark:
*/
@RestController
@RequestMapping("app/nafmii/test/")
public class AppController {
@Autowired
private AppService appService;
@GetMapping("search")
public String search(){
String test = appService.search();
return test;
}
}
package org.nafmii.service;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/22 9:29
* @ClassName:
* @version:
* @remark:
*/
public interface AppService {
String search();
}
package org.nafmii.service.impl;
import org.nafmii.adminService.AdminService;
import org.nafmii.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/22 9:30
* @ClassName:
* @version:
* @remark:
*/
@Service
public class AppServiceImpl implements AppService {
@Autowired
private AdminService adminService;
@Override
public String search() {
String search = adminService.search();
return search;
}
}
server.port=8002
eureka.client.serviceUrl.defaultZone=http://127.0.0.1:8761/eureka
spring.application.name=nafmii-app
...@@ -21,6 +21,12 @@ spring: ...@@ -21,6 +21,12 @@ spring:
- Path=/nafmii-admin/** - Path=/nafmii-admin/**
filters: filters:
- StripPrefix=1 - StripPrefix=1
- id: nafmii-app
uri: lb://nafmii-app
predicates:
- Path=/nafmii-app/**
filters:
- StripPrefix=1
application: application:
name: nafmii-gateway name: nafmii-gateway
management: #开启SpringBoot Admin的监控 management: #开启SpringBoot Admin的监控
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<module>nafmii-gateway</module> <module>nafmii-gateway</module>
<module>nafmii-common</module> <module>nafmii-common</module>
<module>nafmii-quartz</module> <module>nafmii-quartz</module>
<module>nafmii-app</module>
</modules> </modules>
<properties> <properties>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!