
Spring
文章平均质量分 89
Java Spring 框架学习
汪子熙
Jerry Wang,2007 年从电子科技大学计算机专业硕士毕业后加入 SAP 成都研究院工作至今。Jerry 是 SAP 社区导师,SAP 中国技术大使。在长达16年的 SAP 产品开发生涯里,Jerry 曾经先后参与 SAP Business ByDesign,SAP CRM,SAP Cloud for Customer,SAP S/4HANA,SAP Commerce Cloud(电商云)等标准产品的研发工作。
Jerry 工作中使用 ABAP, Java, JavaScript 和 TypeScript 进行开发, 对包括 SAP UI5 在内的多款 SAP 自研框架有深入的研究。
展开
-
关于 Commerce 启动时遇到的错误消息 failed to initialize connector HTTP 9001
在Spring应用程序启动过程中遇到连接器初始化失败的错误消息时,你需要仔细检查可能导致这个问题的各种原因。这可能涉及端口冲突、网络配置问题、SSL证书问题或配置错误。通过仔细排查和逐一解决这些问题,你可以成功地启动你的Spring应用程序并修复这个错误。希望这篇文章能够帮助你更好地理解和解决Spring应用程序启动时的连接器初始化问题。原创 2023-09-04 10:17:16 · 46 阅读 · 0 评论 -
Java SpringBoot 应用使用命令行 mvn spring-boot run 启动的原理
将应用程序打包为 jar 并使用嵌入式 HTTP 服务器的最大优势之一是可以像运行其他任何应用程序一样运行这些提供了 Web 功能的应用程序。 调试 Spring Boot 应用程序也很容易; 不需要任何特殊的 IDE 插件或扩展。spring-boot:run 是 steroïd 上的 java -jar 命令,作为 Maven 构建的一部分运行,确保所有必需的参数都传递给应用程序(例如资源)。 spring-boot:run 还将通过在运行应用程序之前执行测试编译生命周期目标来确保项目被编译。当运行原创 2022-04-27 11:00:17 · 1169 阅读 · 1 评论 -
浅谈电商网站开发中用户会话管理机制的设计和实现原理
笔者由于工作需要,最近对国内外两款知名的电商网站的用户会话管理(User Session Management) 的实现机制做了一些调研,这里把我学习到的一些知识分享给各位同行,希望起到抛砖引玉的作用。我们首先看看大家日常生活中都会使用的某宝网站的用户会话管理机制。在电脑端访问某宝网,输入用户名和密码,点击登录:会观察到一个 HTTP Post 请求,login,发送往后台服务器:https://login.taobao.com/newlogin/login.do?appName=taobao&原创 2022-04-07 10:36:55 · 1411 阅读 · 1 评论 -
SAP ABAP 业务开关和 SAP 电商云的 Feature Level
这是 Jerry 2021 年的第 72 篇文章,也是汪子熙公众号总共第 349 篇原创文章。基于 ABAP 技术栈的 SAP 产品,客户可以通过安装 Enhancement Package(增强包)的方式,为当前使用的应用导入新的功能。Enhancement Package(增强包),顾名思义,包含了应用程序增强功能的集合。客户可以根据企业实际的业务流程,有选择性的启用增强包里的部分新功能。每个新增的功能,都对应着一个 Business Function.只有在系统中激活 Business Funct原创 2022-01-24 14:40:04 · 485 阅读 · 0 评论 -
Could not load JDBC driver class [com.mysql.jdbc.Driver]
我使用Spring JDBC编程时,遇到一个错误消息:Could not load JDBC driver class [com.mysql.jdbc.Driver]完整的错误为:Jul 27, 2020 12:22:26 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefreshINFO: Refreshing org.springframework.context.support.Cla原创 2020-07-27 16:45:59 · 3134 阅读 · 0 评论 -
Spring JDBC 框架一个最简单的Hello World级别的例子
本地安装mySQL数据库社区版,如果不知道如何安装,可以查看我这篇文章:MySQL社区版的下载和安装https://blog.csdn.net/i042416/article/details/107600796使用普通的 JDBC 数据库时,需要繁琐地写很多代码来处理异常,打开和关闭数据库连接等。但 Spring JDBC 框架负责所有的底层细节,从开始打开连接,准备和执行 SQL 语句,处理异常,处理事务,到最后关闭连接。Spring JDBC的JdbcTemplate 类执行 SQL 查询、更新原创 2020-07-27 18:05:05 · 1541 阅读 · 0 评论 -
如何在MySQL中创建存储过程
看个具体的例子:在TEST数据库中创建一个存储过程,名为getRecord:DELIMITER $$DROP PROCEDURE IF EXISTS `TEST`.`getRecord` $$CREATE PROCEDURE `TEST`.`getRecord` (IN in_id INTEGER,OUT out_name VARCHAR(20),OUT out_age INTEGER)BEGIN SELECT name, age INTO out_name, out_age原创 2020-07-30 11:27:28 · 1335 阅读 · 0 评论 -
Spring JDBC 框架,我的学习笔记
Student.java:StudentDAO: 一个接口setDataSource方法注入javax.sql.DataSource的依赖:StudentMapper: java.sql.ResultSet包含的是单条记录:StudentJDBCTemplate: 是接口StudentDAO的实现类。关键就是setDataSource方法,需要研究其是何时被调用的。DataSource被注入之后,基于这个注入的DataSource创建jdbcTemplateObject实例。Java代码里原创 2020-07-30 11:35:14 · 1246 阅读 · 0 评论 -
使用Java Spring消费MySQL中的数据库存储过程
进行这个练习的一些先决条件。创建一张student数据库表:CREATE TABLE Student( ID INT NOT NULL AUTO_INCREMENT, NAME VARCHAR(20) NOT NULL, AGE INT NOT NULL, PRIMARY KEY (ID));创建一个存储过程:DELIMITER $$DROP PROCEDURE IF EXISTS `TEST`.`getRecord` $$CREATE PROCEDURE `T原创 2020-07-30 21:19:50 · 1262 阅读 · 0 评论 -
SAP Spartacus的Component 请求
请求的url:https://spartacus-dev0.eastus.cloudapp.azure.com:9002/occ/v2/electronics-spa/cms/components?fields=DEFAULT¤tPage=0&pageSize=26&componentIds=AllBrandsCategoryLink%2CCanonBrandCategoryLink%2CSonyBrandCategoryLink%2CKodakBrandCategor原创 2020-09-03 13:15:44 · 914 阅读 · 0 评论 -
如何自定义SAP Spartacus店铺的界面颜色风格
SAP Spartacus电商页面默认的颜色风格:注意下图红色高亮部分的颜色风格:在项目文件夹的style.scss里,添加如下代码片段::root { --cx-color-primary: blue; --cx-color-secondary: green; }更改之后的颜色效果:以这个蓝色的购物车为例,其css background属性的值来自变量–cx-color-primary,后者定义在文件_mini-cart.scss里:searchbox的原创 2020-09-01 13:42:53 · 979 阅读 · 0 评论 -
如何进行Java的Remote调试
(1) start Jetty server under debug mode via mvn jetty:run(2) In Eclipse, create a new Debug configuration->Remote Java ApplicationSpecify Host as localhost and port 8000:Click debug button:You should observe that the Jetty server listening to po原创 2020-09-01 12:18:07 · 828 阅读 · 0 评论 -
微信开发系列之五 - 将SAP UI5应用嵌入到微信中
文章系列目录Wechat development series 1 – setup your development environmentWechat development series 2 – development Q&A service using nodejsWechat development series 3 – Trigger C4C Account creation in Wechat appWechat development series 4 – Send C4C原创 2020-08-29 18:02:32 · 354 阅读 · 0 评论 -
SAP Commerce开发之如何找到某个页面对应的JSP实现页面
For example here below is the product detail page of Hybris Storefront. The requirement is to figure out which JSP page has implemented this UI.In some other SAP product it is quite straightforward to achieve.For example in CRM WebClient UI, simply pres原创 2020-08-29 17:23:03 · 362 阅读 · 0 评论 -
使用jconsole监测SAP commerce运行时
It is known that we can use Hybris Administration Console to monitor the runtime behavior of installed Hybris Commerce instance such as Memory, CPU load and thread overview.Meanwhile as Hybris Commerce is implemented in Java, there is another approach to原创 2020-08-29 17:17:46 · 310 阅读 · 1 评论 -
Java Volatile的一个实际应用场合
Consider the following example:package thread;public class ThreadVerify { public static boolean stop = false; public static void main(String args[]) throws InterruptedException { Thread testThread = new Thread(){ @Override原创 2020-08-19 14:17:43 · 319 阅读 · 0 评论 -
Spring框架里解析配置文件的准确位置
We can define bean configuration in xml and then can get instantiated bean instance with help of all kinds of containers for example ClassPathXmlApplicationContext as displayed below:The content of Beans.xml:<?xml version="1.0" encoding="UTF-8"?>原创 2020-08-19 14:15:34 · 271 阅读 · 0 评论 -
Spring里component-scan的工作原理
In Spring configuration xml file, we can define a package for tag component-scan, which tells Spring framework to search all classes within this specified package, to look for those classes which are annotated with @Named or @Component.I am very curious原创 2020-08-19 14:09:30 · 396 阅读 · 0 评论 -
使用Java JdbcTemplate对mySQL进行CRUD增删改查操作
create方法:用字符串拼接构造一个SQL命令:“insert into Student (name, age) values (?, ?)”然后传入jdbcTemplateObject, 后者基于一个定义在Beans.xml里的bean创建的:而jdbcTemplate是包org.springframework.jdbc.core里提供的api:批量读取和创建接口不同,批量读取需要给Java layer返回数据,所以需要一个Mapper:StudentMapper具体执行逻辑,和ABA原创 2020-08-03 21:11:26 · 600 阅读 · 0 评论 -
Java Spring里com.mysql.jdbc.Driver的加载时机
Beans.xml里定义的dataSource bean:通过调试,发现AbstractApplicationContext的finishBeanFactoryInitialization方法执行完之后,INFO: Loaded JDBC driver: com.mysql.jdbc.Driver就打印了出来:beanFactory.preInstantiateSingletons():DefaultListableBeanFactory里维护了从Beans.xml里成功解析出的bean 定原创 2020-08-01 22:27:05 · 1014 阅读 · 0 评论 -
Java Spring里getBean方法的实现
位于DefaultListableBeanFactory:getBeanAbstractBeanFactory.java: doGetBeanBeans.xml里如无特殊声明,定义的bean默认都是singleton,故执行310行的getSingleton:虽然方法名称为get,但是注释写得很清楚,如果Bean尚未被注册,就register a new one:准备创建名为dataSource的singleton bean了:奥妙在这个singletonFactory里:终于看到c原创 2020-08-01 13:19:47 · 1823 阅读 · 0 评论 -
Java Spring Beans.xml里的Bean定义是如何被解析出来的
ClassPathXmlApplicationContext的构造函数里,一部分逻辑是给各个成员变量赋上初始值:然后是执行refresh操作。获取ConfigurableListableBeanFactory:来自Beans.xml的bean,被解析出来后,就存储在BeanFactory的成员变量beanDefinitionMap里。那么Beans.xml里的bean定义,是如何被解析的呢?进入abstractApplicationContext里看个究竟:loadBeanDefinti原创 2020-08-01 11:27:48 · 1189 阅读 · 0 评论 -
Java Spring初学者之调试器里括号包含的类含义
如图:表示在执行类的构造函数。圆括号里代表执行的构造函数是定义在哪个实际类里的:从继承树可以看出,ClassPathXmlApplicationContext最终的父类为AbstractApplicationContext:要获取更多Jerry的原创文章,请关注公众号"汪子熙":...原创 2020-07-31 14:56:29 · 981 阅读 · 0 评论 -
Java Spring ClassPathXmlApplicationContext是如何判断容器内包含某个Bean的
ClassPathXmlApplicationContext的获得方式:ClassPathXmlApplicationContext context =new ClassPathXmlApplicationContext(“Beans.xml”);重要的成员变量:beanFactory: DefaultListableBeanFactorybeanFactoryPostProcessors: ArrayListclassLoader: sun.misc.Launcher$AppClassLoad原创 2020-07-31 14:35:26 · 1951 阅读 · 0 评论