org.springframework
spring-jdbc
${spring.version}
org.springframework
spring-aspects
${spring.version}
jstl
jstl
${jstl.version}
javax.servlet
servlet-api
${servlet-api.version}
provided
javax.servlet
jsp-api
${jsp-api.version}
provided
com.alibaba
dubbo
${dubbo-version}
com.101tec
zkclient
${zkClient-version}
src/main/java
**/*.xml
src/main/resources
**/*.xml
**/*.properties
org.apache.tomcat.maven
tomcat7-maven-plugin
${tomcat.version}
2.1 创建项目
2.2 创建实体类
package com.bobo.pojo;
public class User {
private int id;
private String username;
private int userage;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getUserage() {
return userage;
}
public void setUserage(int userage) {
this.userage = userage;
}
}
3.1 创建项目
3.2 创建UserMapper接口
package com.bobo.mapper;
/**
-
UsersMapper接口文件
-
@author dengp
*/
public interface UsersMapper {
}
3.3 创建 UsersMapper 映射配置文件
<?xml version="1.0" encoding="UTF-8" ?>3.4 4修改 POM 文件
com.bobo
dubbo-pojo
0.0.1-SNAPSHOT
org.mybatis
mybatis
org.mybatis
mybatis-spring
mysql
mysql-connector-java
com.alibaba
druid
src/main/java
**/*.xml
4.1创建dubbo-user-provider
4.1.1 创建项目
4.2创建dubbo-user-interface
4.2.1 创建项目
4.2.2 修改POM文件
com.bobo
dubbo-pojo
0.0.1-SNAPSHOT
4.3创建dubbo-user-service
4.3.1 创建项目
4.3.2 修改POM文件
com.bobo
dubbo-user-interface
0.0.1-SNAPSHOT
com.bobo
dubbo-mapper
0.0.1-SNAPSHOT
com.alibaba
dubbo
com.101tec
zkclient
org.springframework
spring-jdbc
org.springframework
spring-aspects
4.3.3 配置MyBatis与Dubbo
db.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8
jdbc.username=root
jdbc.password=123456
applicationContext-dao.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:p=“http://www.springframework.org/schema/p”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:mvc=“http://www.springframework.org/schema/mvc”
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location=“classpath:db.properties”/>
classpath:SqlMapperClient.xml
applicationContext-service.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:p=“http://www.springframework.org/schema/p”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:mvc=“http://www.springframework.org/schema/mvc”
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package=“com.bobo.dubbo.service.impl”/>
applicationContext-trans.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:p=“http://www.springframework.org/schema/p”
xmlns:aop=“http://www.springframework.org/schema/aop”
xmlns:tx=“http://www.springframework.org/schema/tx”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<tx:advice id=“advice” transaction-manager=“transactionMananger”>
tx:attributes
<tx:method name=“add*” propagation=“REQUIRED”/>
<tx:method name=“modify*” propagation=“REQUIRED”/>
<tx:method name=“update*” propagation=“REQUIRED”/>
<tx:method name=“dorp*” propagation=“REQUIRED”/>
<tx:method name=“del*” propagation=“REQUIRED”/>
<tx:method name=“find*” read-only=“true”/>
</tx:attributes>
</tx:advice>
aop:config
<aop:advisor advice-ref=“advice” pointcut=“execution(* com.bobo.dubbo.service.impl*.*(…))”/>
</aop:config>
SqlMapperClient.xml
<?xml version="1.0" encoding="UTF-8"?>application-dubbo.xml
服务提供者的配置文件我们放到META-INF/spring/目录下,我们通过main方法启动会自动加载该文件。
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:aop=“http://www.springframework.org/schema/aop”
xmlns:context=“http://www.springframework.org/schema/context” xmlns:tx=“http://www.springframework.org/schema/tx”
xmlns:dubbo=“http://code.alibabatech.com/schema/dubbo”
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name=“user-provider” />
<dubbo:registry protocol=“zookeeper”
address=“192.168.88.171:2181,192.168.88.172:2181,192.168.88.173:2181”/>
<dubbo:protocol name=“dubbo” port=“20880”/>
4.3.3 测试整合
package com.bobo;
import com.alibaba.dubbo.container.Main;
public class Start {
/**
-
特点:
-
1,自带线程阻塞
-
2,支持优雅关系
-
Main 类下的 main 方法在启动时默认的回去 classpath:/META-INF/spring/*.xml
-
@param args
*/
public static void main(String[] args) {
Main.main(args);
}
}
创建消费者相关的服务。
5.1创建dubbo-user-consumer
5.1.1 创建项目
5.2创建dubbo-user-portal-service
5.2.1 创建项目
5.2.2 修改POM文件
com.bobo
dubbo-user-interface
0.0.1-SNAPSHOT
com.bobo
dubbo-pojo
0.0.1-SNAPSHOT
org.springframework
spring-context
org.springframework
spring-beans
5.3创建dubbo-user-portal
5.3.1 创建项目(war)
5.3.2 修改POM文件
<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”>
4.0.0
com.bobo
dubbo-user-consumer
0.0.1-SNAPSHOT
dubbo-user-portal
war
com.bobo
dubbo-user-portal-service
0.0.1-SNAPSHOT
junit
junit
org.slf4j
slf4j-log4j12
org.springframework
spring-webmvc
jstl
jstl
javax.servlet
servlet-api
provided
javax.servlet
jsp-api
provided
com.alibaba
dubbo
com.101tec
zkclient
org.apache.tomcat.maven
tomcat7-maven-plugin
8082
项目报错手动添加web.xml文件
5.3.3 配置 SpringMVC,Spring,web.xml,Dubbo
applicationContext-dubbo.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:aop=“http://www.springframework.org/schema/aop”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:tx=“http://www.springframework.org/schema/tx”
xmlns:dubbo=“http://code.alibabatech.com/schema/dubbo”
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name=“dubbo-consumer”/>
<dubbo:registry protocol=“zookeeper”
address=“192.168.88.171:2181,192.168.88.172:2181,192.168.88.173:2181” />
applicationContext-service.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:p=“http://www.springframework.org/schema/p”
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Java)
总结
这个月马上就又要过去了,还在找工作的小伙伴要做好准备了,小编整理了大厂java程序员面试涉及到的绝大部分面试题及答案,希望能帮助到大家
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
ocol=“zookeeper”
address=“192.168.88.171:2181,192.168.88.172:2181,192.168.88.173:2181” />
applicationContext-service.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:p=“http://www.springframework.org/schema/p”
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。[外链图片转存中…(img-zIOI5HYT-1713826960737)]
[外链图片转存中…(img-GdoOtKb7-1713826960738)]
[外链图片转存中…(img-UYgZNBgv-1713826960738)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Java)
[外链图片转存中…(img-6w8Z4AZm-1713826960738)]
总结
这个月马上就又要过去了,还在找工作的小伙伴要做好准备了,小编整理了大厂java程序员面试涉及到的绝大部分面试题及答案,希望能帮助到大家
[外链图片转存中…(img-zRHDWw5B-1713826960739)]
[外链图片转存中…(img-AqnHyGeg-1713826960739)]
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!