通向架构师的道路(第二十天)万能框架spring(二)maven结合spring与ibatis

简介: 一、前言 上次讲了Struts结合Spring并使用Spring的JdbcTemplate来搭建工程框架后我们面临着jar库无法管理,工程发布不方便,jar包在工程内太占空间,jar包冲突,管理,甚至漏包都问题。

一、前言

上次讲了Struts结合Spring并使用Spring的JdbcTemplate来搭建工程框架后我们面临着jar库无法管理,工程发布不方便,jar包在工程内太占空间,jar包冲突,管理,甚至漏包都问题。于是我们在讲“万能框架spring(二)”前,传授了一篇番外篇,即讲利用maven来管理我们的jar库。

从今天开始我们将结合“万能框架spring(一)”与番外篇maven来更进一步丰富我们的ssx框架,那么今天讲的是使用iBatis3结合SS来构建我们的ssi框架,我们把这个框架命名为beta吧。

二、SSI框架


还记得我们在第十八天中讲到的我们的框架的架构图吗?上面这张是我们今天的架构图,除了Struts,Spring层,我们需要变换的是DAO层即把原来的SQL这部分换成iBatis,我们在次使用的是iBatis版本3。

由于我们在第十八天中已经说了这样的一个框架的好处其中就有:

层中相关技术的替换不影响到其它层面

所以对于我们来说我们需要改动的代码只有datasource.xmldao层的2个接口两个类,那我们就一起来看看这个基于全注解的SSi框架是怎么样搭起来的吧。

三、搭建SSI框架

3.1建立工程

我们还是使用maven来建立我们的工程


建完后照着翻外篇《第十九天》中的“四、如何让Maven构建的工程在eclipse里跑起来”对工程进行设置。




3.2 增加iBatis3的jar相关包

打开pom.xml

第一步

找到“slf4j”,将它在pom中的描述改成如下内容:

<dependency>

                        <groupId>org.slf4j</groupId>

                        <artifactId>slf4j-api</artifactId>

                        <version>1.5.10</version>

</dependency>

第二步

增加两个jar包

<dependency>

                        <groupId>org.slf4j</groupId>

                        <artifactId>slf4j-log4j12</artifactId>

                        <version>1.5.10</version>

</dependency>

<dependency>

                        <groupId>org.apache.ibatis</groupId>

                        <artifactId>ibatis-core</artifactId>

                        <version>3.0</version>

</dependency>

3.3 开始配置ibatis与spring结合

打开/src/main/resources/spring/datasource下的datasource.xml,增加如下几行

<bean id="iBatisSessionFactory" class="org.sky.ssi.ibatis.IBatis3SQLSessionFactoryBean" scope="singleton">

                                                <property name="configLocation" value="sqlmap.xml"></property>

                                                <property name="dataSource" ref="dataSource"></property>

</bean>

<bean id="iBatisDAOSupport" class="org.sky.ssi.ibatis.IBatisDAOSupport">

</bean>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

                        <property name="dataSource" ref="dataSource" />

</bean>

此处,我们需要4个类,它们是:

org.sky.ssi.ibatis.IBatis3SQLSessionFactoryBean

package org.sky.ssi.ibatis;

 

import java.io.IOException;

import java.io.Reader;

import javax.sql.DataSource;

import org.apache.ibatis.builder.xml.XMLConfigBuilder;

import org.apache.ibatis.io.Resources;

import org.apache.ibatis.mapping.Environment;

import org.apache.ibatis.session.Configuration;

import org.apache.ibatis.session.SqlSessionFactory;

import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory;

import org.springframework.beans.factory.FactoryBean;

import org.springframework.beans.factory.InitializingBean;

import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;

 

/**

 *

 * IBatis3SQLSessionFactoryBean is responsible for integrating iBatis 3 <p>

 * with spring 3. Since all environment configurations have been moved to <p>

 * spring, this class takes the responsibility to get environment information<p>

 *  from spring configuration to generate SqlSessionFactory.

 * @author lifetragedy

 *

 */

public class IBatis3SQLSessionFactoryBean implements FactoryBean<SqlSessionFactory>, InitializingBean{

                        private String configLocation;   

    private DataSource dataSource;   

    private SqlSessionFactory sqlSessionFactory;   

    private boolean useTransactionAwareDataSource = true;   

    private String environmentId = "development";

                        public String getConfigLocation() {

                                                return configLocation;

                        }

                        public void setConfigLocation(String configLocation) {

                                                this.configLocation = configLocation;

                        }

                        public DataSource getDataSource() {

                                                return dataSource;

                        }

                        public void setDataSource(DataSource dataSource) {

                                                this.dataSource = dataSource;

                        }

                        public SqlSessionFactory getSqlSessionFactory() {

                                                return sqlSessionFactory;

                        }

                        public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {

                                                this.sqlSessionFactory = sqlSessionFactory;

                        }

                        public boolean isUseTransactionAwareDataSource() {

                                                return useTransactionAwareDataSource;

                        }

                        public void setUseTransactionAwareDataSource(

                                                                        boolean useTransactionAwareDataSource) {

                                                this.useTransactionAwareDataSource = useTransactionAwareDataSource;

                        }

                        public String getEnvironmentId() {

                                                return environmentId;

                        }

                        public void setEnvironmentId(String environmentId) {

                                                this.environmentId = environmentId;

                        }

                       

                        public SqlSessionFactory getObject() throws Exception {   

        return this.sqlSessionFactory;   

    }   

  

    public Class<SqlSessionFactory> getObjectType() {   

        return  SqlSessionFactory.class;   

    }

   

    public boolean isSingleton() {   

        return true;   

    }   

  

    public void afterPropertiesSet() throws Exception {   

        this.sqlSessionFactory = this.buildSqlSessionFactory(configLocation);   

    }

   

    protected SqlSessionFactory buildSqlSessionFactory(String configLocation)   

    throws IOException {   

                        if (configLocation == null) {   

                                                throw new IllegalArgumentException(   

                                                "configLocation entry is required");   

                        }   

                        DataSource dataSourceToUse = this.dataSource;   

                        if (this.useTransactionAwareDataSource   

                                                                        && !(this.dataSource instanceof TransactionAwareDataSourceProxy)) {   

                                                dataSourceToUse = new TransactionAwareDataSourceProxy(   

                                                                                                this.dataSource);   

                        }   

 

                        Environment environment = new Environment(environmentId,   

                                                                        new IBatisTransactionFactory(dataSourceToUse), dataSourceToUse);   

 

                        Reader reader = Resources.getResourceAsReader(configLocation);   

                        XMLConfigBuilder parser = new XMLConfigBuilder(reader, null, null);   

                        Configuration config = parser.parse();   

                        config.setEnvironment(environment);   

 

                        return new DefaultSqlSessionFactory(config);   

    }

 

}

org.sky.ssi.ibatis.IBatisDAOSupport

package org.sky.ssi.ibatis;

 

import javax.annotation.Resource;

 

import org.apache.ibatis.session.SqlSession;

import org.apache.ibatis.session.SqlSessionFactory;

import org.apache.log4j.Logger;

 

 

/**

 * Base class for all DAO class. The subclass extends this class to get

 * <p>

 * DAO implementation proxy.

 *

 * @author lifetragedy

 *

 * @param <T>

 */

public class IBatisDAOSupport<T> {

 

                        protected Logger log = Logger.getLogger(this.getClass());

 

                        @Resource

                        private SqlSessionFactory ibatisSessionFactory;

 

                        private T mapper;

 

                        public SqlSessionFactory getSessionFactory() {

                                                return ibatisSessionFactory;

                        }

 

                        protected SqlSession getSqlSession() {

                                                return ibatisSessionFactory.openSession();

                        }

 

                        public T getMapper(Class<T> clazz) {

                                                mapper = getSqlSession().getMapper(clazz);

                                                return mapper;

                        }

 

                        public T getMapper(Class<T> clazz, SqlSession session) {

                                                mapper = session.getMapper(clazz);

                                                return mapper;

                        }

 

                        /**

                         * close SqlSession

                         */

                        protected void closeSqlSession(SqlSession sqlSession) throws Exception {

                                                try {

                                                                        if (sqlSession != null) {

                                                                                                sqlSession.close();

                                                                                                sqlSession = null;

                                                                        }

                                                } catch (Exception e) {

                                                }

                        }

}

org.sky.ssi.ibatis.IBatisTransaction

package org.sky.ssi.ibatis;

import java.sql.Connection;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.ibatis.transaction.Transaction;

import org.springframework.jdbc.datasource.DataSourceUtils;

public class IBatisTransaction implements Transaction{

                        private DataSource dataSource;

                        private Connection connection;

                        public IBatisTransaction(DataSource dataSource, Connection con, boolean autoCommit){

                                                this.dataSource = dataSource;

                                                this.connection = con;

                        }

 

                        public Connection getConnection(){

                                                return connection;

                        }

 

    public void commit()

        throws SQLException{                        }

 

    public void rollback()

        throws SQLException{                        }

 

    public void close()

        throws SQLException{

                        if(dataSource != null && connection != null){

                                                DataSourceUtils.releaseConnection(connection, dataSource);

                        }

    }

}

org.sky.ssi.ibatis.IBatisTransactionFactory

package org.sky.ssi.ibatis;

 

import java.sql.Connection;

import java.util.Properties;

 

import javax.sql.DataSource;

 

import org.apache.ibatis.transaction.Transaction;

import org.apache.ibatis.transaction.TransactionFactory;

 

public class IBatisTransactionFactory implements TransactionFactory{

                       

                         private DataSource dataSource;

                       

                         public IBatisTransactionFactory(DataSource dataSource){

                                                 this.dataSource = dataSource;

                         }

                         

                         public void setProperties(Properties properties){      }

                         

                         public Transaction newTransaction(Connection connection, boolean flag){

                                                 return new IBatisTransaction(dataSource,connection,flag);

                         }

 

}

此三个类的作用就是在datasource.xml文件中描述的,把spring与datasource.xml中的datasource和transaction连接起来,此处尤其是“IBatis3SQLSessionFactoryBean”的写法,它通过spring中的“注入”特性,把iBatis的配置注入进spring并委托spring的context来管理iBatis(此属网上没有的资料,全部为本人在历年工程中的经验总结,并且已经在至少3个项目中进行了集成使用与相关测试)。

建立iBatis配置文件

我们先在/src/main/resources目录下建立一个叫sqlmap.xml的文件,内容如下:

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

<!DOCTYPE configuration PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-config.dtd">

<configuration>

                        <mappers>

                                                <mapper resource="ibatis/index.xml" />

                                                <mapper resource="ibatis/login.xml" />

                        </mappers>

</configuration>

然后我们在/src/main/resources 目录下建立index.xml与login.xml这2个xml文件。


看到这儿,有人会问了:为什么不把这两个xml文件也建立在spring目录下?

原因很简单:

在datasource.xml文件内我们已经通过

<bean id="iBatisSessionFactory" class="org.sky.ssi.ibatis.IBatis3SQLSessionFactoryBean" scope="singleton">

                                <property name="configLocation" value="sqlmap.xml"></property>

                                <property name="dataSource" ref="dataSource"></property>

</bean>

这样的方式把iBatis委托给了spring,iBatis的核心就是这个sqlmap.xml文件了,而在这个sqlmap.xml文件已经引用了login.xml与index.xml文件了。

而我们的web.xml文件里有这么一句:

<context-param>

                                <param-name>contextConfigLocation</param-name>

                                <param-value>/WEB-INF/classes/spring/**/*.xml</param-value>

</context-param>

因此如果我们再把ibatis/index.xml与ibatis/login.xml再建立到src/main/resources/spring目录下,spring于是会在容器启动时试图加载这两个xml文件,然后一看这两个xml文件不是什么spring的bean,直接抛错,对吧?

其们等一会再来看login.xml文件与index.xml文件,我们先来搞懂iBatis调用原理.

3.4 iBatis调用原理

1)iBatis就是一个dao层,它又被称为sqlmapping,它的sql是书写在一个.xml文件内的,在该xml文件内会将相关的sql绑定到相关的dao类的方法。

2)在调用结束时我们需要在finally块中关闭相关的sql调用。

我们来看一个例子。

login.xml文件

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

<!DOCTYPE mapper

PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"

"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">

<mapper namespace="org.sky.ssi.dao.LoginDAO">

                        <select id="validLogin" resultType="int" parameterType="java.util.Map">

                                                <![CDATA[

                                                SELECT count(1) from t_login where login_id= #{loginId} and login_pwd=#{loginPwd}

                                                ]]>

                        </select>

</mapper>

该DAO指向了一个接口org.sky.ssi.dao.LoginDAO,该dao接受一个sql,并且接受一个Map类型的参数。

那么我们来看该DAO

LoginDao.java

package org.sky.ssi.dao;

 

import java.util.Map;

 

public interface LoginDAO {

                public int validLogin(Map<String, Object> paraMap) throws Exception;

}

 

LoginImpl.java

package org.sky.ssi.dao.impl;

 

import java.util.Map;

 

import org.apache.ibatis.session.SqlSession;

import org.sky.ssi.dao.LoginDAO;

import org.sky.ssi.ibatis.IBatisDAOSupport;

import org.springframework.stereotype.Repository;

 

@Repository

public class LoginDAOImpl extends IBatisDAOSupport<LoginDAO> implements LoginDAO {

 

                public int validLogin(Map<String, Object> paraMap) throws Exception {

                                SqlSession session = this.getSqlSession();

                                try {

                                                return this.getMapper(LoginDAO.class, session).validLogin(paraMap);

                                } catch (Exception e) {

                                                log.error(e.getMessage(), e);

                                                throw new Exception(e);

                                } finally {

                                                this.closeSqlSession(session);

                                }

                }

 

}

很简单吧,一切逻辑都在xml文件内。

一定记得不要忘了在finally块中关闭相关的sql调用啊,要不然将来工程出了OOM的错误不要怪我啊.

3.5 index模块

Index.xml文件

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

<!DOCTYPE mapper

PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"

"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">

<mapper namespace="org.sky.ssi.dao.StudentDAO">

                        <select id="getAllStudent" resultType="org.sky.ssi.dbo.StudentDBO">

                                                <![CDATA[

                                                SELECT student_no studentNo, student_name studentName from t_student

                                                ]]>

                        </select>

 

                        <update id="addStudent" parameterType="java.util.Map">

                                                insert into t_student(student_no, student_name)values(seq_student_no.nextval,#{stdName})

                        </update>

 

                        <update id="delStudent" parameterType="java.util.Map">

                                                delete from t_student where student_no=#{stdNo}

                        </update>

</mapper>

它指向了StudentDAO这个接口

StudentDAO.java

package org.sky.ssi.dao;

 

import org.sky.ssi.dbo.StudentDBO;

import org.sky.ssi.student.form.*;

import java.util.*;

 

public interface StudentDAO {

 

                        public List<StudentDBO> getAllStudent() throws Exception;

 

                        public void addStudent(Map<String, Object> paraMap) throws Exception;

 

                        public void delStudent(Map<String, Object> paraMap) throws Exception;

}

StudentDAOImpl.java

package org.sky.ssi.dao.impl;

 

import java.util.List;

import java.util.Map;

 

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.apache.ibatis.session.SqlSession;

import org.sky.ssi.dao.StudentDAO;

import org.sky.ssi.ibatis.IBatisDAOSupport;

import org.sky.ssi.dbo.StudentDBO;

 

import org.springframework.stereotype.Repository;

 

@Repository

public class StudentDAOImpl extends IBatisDAOSupport<StudentDAO> implements StudentDAO {

 

                        @Override

                        public List<StudentDBO> getAllStudent() throws Exception {

                                                SqlSession session = this.getSqlSession();

                                                try {

                                                                        return this.getMapper(StudentDAO.class, session).getAllStudent();

                                                } catch (Exception e) {

                                                                        throw new Exception(e);

                                                } finally {

                                                                        this.closeSqlSession(session);

                                                }

                        }

 

                        public void addStudent(Map<String, Object> paraMap) throws Exception {

                                                SqlSession session = this.getSqlSession();

                                                try {

                                                                        this.getMapper(StudentDAO.class, session).addStudent(paraMap);

                                                } catch (Exception e) {

                                                                        throw new Exception(e);

                                                } finally {

                                                                        this.closeSqlSession(session);

                                                }

                        }

 

                        public void delStudent(Map<String, Object> paraMap) throws Exception {

                                                SqlSession session = this.getSqlSession();

                                                try {

                                                                        this.getMapper(StudentDAO.class, session).delStudent(paraMap);

                                                } catch (Exception e) {

                                                                        throw new Exception(e);

                                                } finally {

                                                                        this.closeSqlSession(session);

                                                }

                        }

}

3.6 Service接口微微有些改变

为了演示给大家看 iBatis接受多个参数的例子因此我们把原来的如:login(String loginId, String loginPwd)这样的方法改成了public int validLogin(Map<String, Object> paraMap) throws Exception;这样的结构,请大家注意。

四、beta工程中的增加功能

4.1 增加了一个filter

在我们的web.xml文件中

<filter>

                        <filter-name>LoginFilter</filter-name>

                        <filter-class>org.sky.ssi.filter.LoginFilter</filter-class>

                        <init-param>

                                                <param-name>exclude</param-name>

                                                <param-value>/jsp/login/login.jsp,

                                                             /login.do

                                                </param-value>

                        </init-param>

</filter>

<filter-mapping>

                        <filter-name>LoginFilter</filter-name>

                        <url-pattern>*.jsp</url-pattern>

</filter-mapping>

<filter-mapping>

                        <filter-name>LoginFilter</filter-name>

                        <url-pattern>/servlet/*</url-pattern>

</filter-mapping>

<filter-mapping>

                        <filter-name>LoginFilter</filter-name>

                        <url-pattern>*.do</url-pattern>

</filter-mapping>

有了这个filter我们就不用在我们的web工程中每一个action、每 个jsp里进行“用户是否登录”的判断了,它会自动根据配置除去“exclude”中的相关web resource,全部走这个“是否登录”的判断。

注意此处这个exclude是笔者自己写的,为什么要exclude?

如果你不exclude,试想一个用户在login.jsp中填入相关的登录信息后点一下login按钮跳转到了login.do,而这两个web resource由于没有被“排除”出“需要登录校验”,因此每次你一调用login.jsp, login.do这个filter就都会强制要求你再跳转到login.jsp,那么我们一个用户从login.jsp登录完后再跳回login.jsp再跳回,再跳回,如此重复,进入死循环。

4.2 增加了一个自动记录异常的日志功能

在我们的applicationContext.xml文件中

    <bean

        id="methodLoggerAdvisor"

        class="org.sky.ssi.util.LoggerAdvice" >

    </bean>

    <aop:config>

        <aop:aspect

            id="originalBeanAspect"

            ref="methodLoggerAdvisor" >

            <aop:pointcut

                id="loggerPointCut"

                expression="execution(* org.sky.ssi.service.impl.*.*(..))" />

            <aop:around

                method="aroundAdvice"

                pointcut-ref="loggerPointCut" />

        </aop:aspect>

    </aop:config>

这样,我们的dao层、service层、有错就只管往外throw,框架一方面在接到相关的exception会进行数据库事务的自动回滚外,还会自动把service层抛出的exception记录在log文件中。

五、测试我们的工程

确认我们的StudentServiceImpl中删除学生的delStudent方法内容如下:

public void delStudent(String[] stdNo) throws Exception {

              for (String s : stdNo) {

                     Map<String, Object> paraMap = new HashMap<String, Object>();

                     paraMap.put("stdNo", s);

                     studentDAO.delStudent(paraMap);

                     throw new Exception("force system to throw a exception");

              }

}

 

我们把beta工程添加入我们在eclipse中配好的j2eeserver中去并启动起来。


在IE中输入:http://localhost:8080/beta/index.do。 系统直接跳到login界面


我们输入相关的用户名写密码。


我们选中“13号学生高乐高”与“9号学生”,点“deletestudent”按钮。



后台抛错了,查看数据库内的数据


数据还在,说明我们的iBatis的事务已经在spring中启作用了.

再次更改StudentServiceImpl.java类中的delStudent方法,把“throw new Exception("force system to throw a exception");”注释掉,再来运行



我们再次选 中9号和13号学生,点deletestudent按钮,删除成功,这个够13的人终于被删了,呵呵。



目录
相关文章
|
13天前
|
存储 安全 Java
事件的力量:探索Spring框架中的事件处理机制
事件的力量:探索Spring框架中的事件处理机制
27 0
|
23天前
|
缓存 Java Spring
Spring 框架中 Bean 的生命周期
Spring 框架中 Bean 的生命周期
30 1
|
1月前
|
分布式计算 算法 调度
课3-详解隐私计算框架的架构和技术要点
隐语架构涵盖产品、算法、计算、资源和硬件五层,旨在实现互联互通和跨域管控。产品层包括SecretPad等,简化用户和集成商体验。算法层涉及PSI/PIR、SCQL和联邦学习,提供隐私保护的数据分析和学习。计算层如RayFed、SPU、HEU等,支持分布式计算和密态处理。资源层的KUSCIA用于跨机构任务编排,硬件层涉及FPGA等加速器。互联互通支持黑盒和白盒模式,确保不同平台协作。跨域管控则强调数据流转控制,保护数据权益。
|
7天前
|
负载均衡 Java 开发者
细解微服务架构实践:如何使用Spring Cloud进行Java微服务治理
【4月更文挑战第17天】Spring Cloud是Java微服务治理的首选框架,整合了Eureka(服务发现)、Ribbon(客户端负载均衡)、Hystrix(熔断器)、Zuul(API网关)和Config Server(配置中心)。通过Eureka实现服务注册与发现,Ribbon提供负载均衡,Hystrix实现熔断保护,Zuul作为API网关,Config Server集中管理配置。理解并运用Spring Cloud进行微服务治理是现代Java开发者的关键技能。
|
8天前
|
敏捷开发 监控 前端开发
深入理解自动化测试框架Selenium的架构与实践
【4月更文挑战第16天】 在现代软件开发过程中,自动化测试已成为确保产品质量和加快迭代速度的关键手段。Selenium作为一种广泛使用的自动化测试工具,其开源、跨平台的特性使得它成为业界的首选之一。本文旨在剖析Selenium的核心架构,并结合实际案例探讨其在复杂Web应用测试中的高效实践方法。通过详细解读Selenium组件间的交互机制以及如何优化测试脚本,我们希望为读者提供深入理解Selenium并有效运用于日常测试工作的参考。
14 1
|
21天前
|
开发框架 安全 Java
探索 Spring 框架:企业级应用开发的强大工具
探索 Spring 框架:企业级应用开发的强大工具
19 1
|
22天前
|
负载均衡 网络协议 Java
构建高效可扩展的微服务架构:利用Spring Cloud实现服务发现与负载均衡
本文将探讨如何利用Spring Cloud技术实现微服务架构中的服务发现与负载均衡,通过注册中心来管理服务的注册与发现,并通过负载均衡策略实现请求的分发,从而构建高效可扩展的微服务系统。
|
28天前
|
敏捷开发 监控 前端开发
Spring+SpringMVC+Mybatis的分布式敏捷开发系统架构
Spring+SpringMVC+Mybatis的分布式敏捷开发系统架构
63 0
|
4天前
|
敏捷开发 监控 数据管理
构建高效微服务架构的五大关键策略
【4月更文挑战第20天】在当今软件开发领域,微服务架构已经成为一种流行的设计模式,它允许开发团队以灵活、可扩展的方式构建应用程序。本文将探讨构建高效微服务架构的五大关键策略,包括服务划分、通信机制、数据管理、安全性考虑以及监控与日志。这些策略对于确保系统的可靠性、可维护性和性能至关重要。
|
16天前
|
API 数据库 开发者
构建高效可靠的微服务架构:后端开发的新范式
【4月更文挑战第8天】 随着现代软件开发的复杂性日益增加,传统的单体应用架构面临着可扩展性、维护性和敏捷性的挑战。为了解决这些问题,微服务架构应运而生,并迅速成为后端开发领域的一股清流。本文将深入探讨微服务架构的设计原则、实施策略及其带来的优势与挑战,为后端开发者提供一种全新视角,以实现更加灵活、高效和稳定的系统构建。
20 0

推荐镜像

更多