架构:第四章:微服务架构下的分布式架构之搭建环境,java在线编译器原理

ConsumerPortal

org.csource

fastdfs-client-java

org.springframework.boot

spring-boot-starter-web

org.springframework.cloud

spring-cloud-starter-eureka

org.springframework.cloud

spring-cloud-starter-ribbon

org.springframework.cloud

spring-cloud-starter-config

org.springframework.boot

spring-boot-starter-freemarker

com

CommonBean

0.0.1-SNAPSHOT

com

CommonFeign

0.0.1-SNAPSHOT

com

CommonUtil

0.0.1-SNAPSHOT

jar包出错

网上解决方案 如果还有问题可能是maven环境配置有问题,或者是父工程没有加版本号

在ConsumerManager子工程的pom.xml中创建依赖管理和构建管理

4.0.0

com

CrowdFundingParent

0.0.1-SNAPSHOT

ConsumerManager

org.springframework.boot

spring-boot-starter-web

org.springframework.cloud

spring-cloud-starter-eureka

org.springframework.cloud

spring-cloud-starter-ribbon

org.springframework.cloud

spring-cloud-starter-config

org.springframework.boot

spring-boot-starter-freemarker

com

CommonBean

0.0.1-SNAPSHOT

com

CommonFeign

0.0.1-SNAPSHOT

com

CommonUtil

0.0.1-SNAPSHOT

在ProviderActiviti子工程的pom.xml中创建依赖管理和构建管理

4.0.0

com

CrowdFundingParent

0.0.1-SNAPSHOT

ProviderActiviti

mysql

mysql-connector-java

com.alibaba

druid

org.mybatis.spring.boot

mybatis-spring-boot-starter

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-test

test

org.springframework.cloud

spring-cloud-starter-eureka

org.springframework.cloud

spring-cloud-starter-config

com

CommonBean

0.0.1-SNAPSHOT

com

CommonFeign

0.0.1-SNAPSHOT

com

CommonUtil

0.0.1-SNAPSHOT

org.activiti

activiti-spring-boot-starter-basic

在ProviderDatabase子工程的pom.xml中创建依赖管理和构建管理

4.0.0

com

CrowdFundingParent

0.0.1-SNAPSHOT

ProviderDatabase

mysql

mysql-connector-java

com.alibaba

druid

org.mybatis.spring.boot

mybatis-spring-boot-starter

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-starter-test

test

org.springframework.cloud

spring-cloud-starter-eureka

org.springframework.cloud

spring-cloud-starter-config

com

CommonBean

0.0.1-SNAPSHOT

com

CommonFeign

0.0.1-SNAPSHOT

com

CommonUtil

0.0.1-SNAPSHOT

在RegisterCenterEureka子工程的pom.xml中创建依赖管理和构建管理

4.0.0

com

CrowdFundingParent

0.0.1-SNAPSHOT

RegisterCenterEureka

org.springframework.cloud

spring-cloud-starter-eureka-server

在CommonFeign子工程的pom.xml中创建依赖管理和构建管理

4.0.0

com

CrowdFundingParent

0.0.1-SNAPSHOT

CommonFeign

org.springframework.cloud

spring-cloud-starter-feign

com

CommonBean

0.0.1-SNAPSHOT

其他工程无依赖管理和构建管理,后期如果需要在加即可

创建各工程主启动类

RegisterCenterEureka

@EnableEurekaServer

@SpringBootApplication

ProviderDatabase

@EnableEurekaClient

@MapperScan(“com.mapper”)

@SpringBootApplication

ProviderActiviti

@EnableEurekaClient

@EnableFeignClients

@SpringBootApplication

ConsumerPortal

@EnableEurekaClient

@EnableFeignClients

@SpringBootApplication

ConsumerManager

@EnableEurekaClient

@EnableFeignClients

@SpringBootApplication

例图:

创建各工程yml文件

RegisterCenterEureka

server:

port: 84

eureka:

instance:

hostname: localhost

client:

register-with-eureka: false

fetch-registry: false

service-url:

defaultZone: http://localhost:84/eureka

ProviderDatabase

server:

port: 83

mybatis:

config-location: classpath:mybatis/mybatis.cfg.xml

mapper-locations:

  • classpath:mybatis/mapper/*Mapper.xml

spring:

application:

name: ProviderDatabase

datasource:

type: com.alibaba.druid.pool.DruidDataSource

driver-class-name: org.gjt.mm.mysql.Driver

url: jdbc:mysql://localhost:3306/atcrowdfunding?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8

username: root

password: root

dbcp2:

min-idle: 5

initial-size: 5

max-total: 5

max-wait-millis: 200

eureka:

client:

service-url:

defaultZone: http://localhost:84/eureka

创建mybatis目录

创建mybatis.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>

ProviderActiviti

server:

port: 82

spring:

application:

name: ProviderActiviti

datasource:

type: com.alibaba.druid.pool.DruidDataSource

driver-class-name: org.gjt.mm.mysql.Driver

url: jdbc:mysql://localhost:3306/atcrowdfunding?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8

username: root

password: root

dbcp2:

min-idle: 5

initial-size: 5

max-total: 5

max-wait-millis: 200

eureka:

client:

service-url:

defaultZone: http://localhost:84/eureka

ConsumerPortal

server:

port: 80

eureka:

client:

register-with-eureka: false

service-url:

defaultZone: http://localhost:84/eureka

spring:

freemarker:

template-loader-path: classpath:/templates/

suffix: .page

crowdfunding.tracker.config.location: classpath:/tracker.conf

创建templates目录

创建tracker.conf

tracker_server=192.168.0.100:22122

ConsumerManager

server:

port: 81

eureka:

client:

register-with-eureka: false

service-url:

defaultZone: http://localhost:84/eureka

spring:

freemarker:

template-loader-path: classpath:/templates/

suffix: .page

创建templates目录

现在写一个首页显示功能测试一下

显示首页:使用Freemarker作为SpringBoot环境下的视图技术,创建一个index.page,将前端页面摸板的index.html复制j进去

修改页面

修改后

在路径前加/表示在类路径下

修改后

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
搭建Java开发的BS架构环境,你需要安装以下几个组件: 1. Java Development Kit (JDK):JDK是Java开发的核心工具包,包含了Java编译器、运行时环境和相关工具。你可以从Oracle官网下载并安装适合你操作系统的JDK版本。 2. Eclipse或者IntelliJ IDEA:这是两个常用的Java集成开发环境(IDE),你可以根据个人喜好选择其中一个进行安装。Eclipse和IntelliJ IDEA都提供了丰富的功能和插件,方便开发和调试Java应用程序。 3. Apache Tomcat:Tomcat是一个开源的Java Servlet容器,用于运行Java Web应用程序。你可以从Apache官网下载并安装适合你操作系统的Tomcat版本。 4. 数据库:如果你的BS架构需要使用数据库,你还需要安装并配置一个数据库服务器,比如MySQL或者Oracle。 安装完以上组件后,你可以按照以下步骤进行配置: 1. 配置JDK:将JDK安装目录添加到系统环境变量中,以便在命令行中可以使用javac和java命令。 2. 配置IDE:打开Eclipse或者IntelliJ IDEA,根据提示进行初始化设置,并配置JDK路径。 3. 配置Tomcat:将Tomcat解压到指定目录,然后在IDE中配置Tomcat服务器,指定Tomcat的安装路径。 4. 创建Java Web项目:在IDE中创建一个新的Java Web项目,选择Tomcat作为服务器,并配置项目的相关设置。 5. 开发和调试:使用IDE进行Java代码的编写、调试和测试,可以使用Servlet、JSP等技术进行开发。 这样,你就可以开始使用Java开发BS架构的应用程序了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值