# bss-cloud **Repository Path**: siguohui/bss-cloud ## Basic Information - **Project Name**: bss-cloud - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-27 - **Last Updated**: 2024-04-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README https://gitee.com/youlaiorg/youlai-boot https://gitee.com/youlaiorg/vue3-element-admin https://youlai.blog.csdn.net/ https://gitee.com/youlaitech/youlai-mall https://gitee.com/youlaiorg/mall-admin https://gitee.com/youlaiorg/mall-app https://gitee.com/newbee-ltd https://gitee.com/macrozheng https://www.jianshu.com/p/1a6ddc44a37c https://blog.csdn.net/datastructure18/article/details/120208842 https://blog.csdn.net/qq_44732146/article/details/119968376 https://www.51cto.com/article/755973.html 从MapStruct 1.2.0. Beta1和Lombok 1.16.14版本开始,并分两种情况 1、如果您使用的是Lombok 1.18.16或更新版本,您还需要添加lombok-mapstruct-binding才能使Lombok和MapStruct一起工作。 2、如果您使用的是较旧的MapStruct或Lombok版本,解决方案是将要由Lombok修改的JavaBeans和要由MapStruct处理的映射器接口分成您项目的两个单独模块。 然后Lombok将在第一个模块的编译期间运行,在第二个模块的编译期间运行MapStruct时,使bean类完整。 结论: 1、Lombok 1.18.16或更新版本,需要添加lombok-mapstruct-binding一起使用; 2、低版本由Lombok修改的JavaBeans和要由MapStruct处理的映射器接口分成您项目的两个单独模块。然后Lombok将在第一个模块的编译期间运行,在第二个模块的编译期间运行MapStruct时,使bean类完整。 (2020.0.4之后版本的IDEA已内置Lombok,老版本的请自行下载插件) mapstruct是基于JSR 269实现的,JSR 269是JDK引进的一种规范。有了它,能够实现在编译期处理注解,并且读取、修改和添加抽象语法树中的内容。 JSR 269使用Annotation Processor在编译期间处理注解,Annotation Processor相当于编译器的一种插件, 因此又称为插入式注解处理。想要实现JSR 269,主要有以下几个步骤: 继承AbstractProcessor类,并且重写process方法,在process方法中实现自己的注解处理逻辑。 在META-INF/services目录下创建javax.annotation.processing.Processor文件注册自己实现的Annotation Processor 前端以blob格式接收response,并设置type为application/msexcel handleExport(){ exportData({id: this.id}).then(res => { if(res){ const fileName = this.name + '.xlsx'; var blob = new Blob([res], { type: "application/msexcel;charset=utf-8", }); const URL = window.URL || window.webkitURL; const downloadElement = document.createElement("a"); const href = URL.createObjectURL(blob); // 创建下载的链接 downloadElement.href = href; downloadElement.download = fileName; // 下载后文件名 document.body.appendChild(downloadElement); downloadElement.click(); // 点击下载 document.body.removeChild(downloadElement); // 下载完成移除元素 URL.revokeObjectURL(href); // 释放掉blob对象 } }) }, @Value("#{${app.properties:{key1:'value1', key2:'value2'}}}") private Map appProperties; https://youlai.blog.csdn.net/article/details/130864925 https://blog.csdn.net/weixin_38405253/article/details/112597839 https://blog.csdn.net/en_joker/article/details/109186814 https://blog.csdn.net/qq_43720551/article/details/132679766 https://www.jb51.net/article/255799.htm https://blog.csdn.net/weixin_38860401/article/details/131870592 https://www.cnblogs.com/kukuxjx/p/17401029.html https://www.51cto.com/article/755973.html https://blog.51cto.com/u_15315026/3206961 https://blog.csdn.net/weixin_45188218/article/details/135556022 ObjectPostProcessor AutowireBeanFactoryObjectPostProcessor 相关的Filter都是以new的形式创建的,作为Java服务端开发,我们知道,new出来的对象是不受Spring Bean生命周期管控的。 为了使这些Filter实例能够被Spring Bean容器管理,Spring Security定义了一个接口ObjectPostProcessor, AutowireBeanFactoryObjectPostProcessor实现了这个接口,通过postProcess方法手把Bean注入到spring容器进行管理。 https://blog.csdn.net/liuyanglglg/article/details/104761761/ EnableWebSecurity EnableGlobalAuthentication AuthenticationConfiguration ObjectPostProcessorConfiguration ObjectPostProcessor AutowireBeanFactoryObjectPostProcessor @Bean public ObjectPostProcessor objectPostProcessor( AutowireCapableBeanFactory beanFactory) { return new AutowireBeanFactoryObjectPostProcessor(beanFactory); } SmartInitializingSingleton SmartInitializingSingleton 接口非常简单,只有一个方法:afterSingletonsInstantiated()。 在 Spring 容器中所有的单例 Bean 都初始化完成之后, Spring 容器会回调实现了 SmartInitializingSingleton 接口的类的 afterSingletonsInstantiated() 方法, 从而触发相应的初始化逻辑。 @Component public class MyInitializer implements SmartInitializingSingleton { private static final Logger logger = LoggerFactory.getLogger(MyInitializer.class); @Override public void afterSingletonsInstantiated() { // 执行初始化逻辑 logger.info("All singleton beans have been instantiated."); // 可以在这里执行一些初始化操作,如加载配置文件、初始化缓存等 } } @Component public class ProductCache implements SmartInitializingSingleton { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); /** * 商品缓存Map */ private static final Map goodMap = new HashMap<>(); /** * 添加商品到缓存 * @param product */ public void addGood(Product product){ // 添加商品到缓存 goodMap.put(product.getGoodId(),product); } /** * 根据商品id获取商品 */ public Product getGoods(String goodId){ Product product = goodMap.get(goodId); if (product == null){ logger.error("未查询到商品!"); } return product; } public void initializingGoods(){ // 初始化商品信息 Product product1 = new Product("1", "手机", new BigDecimal("111.23")); Product product2 = new Product("2", "笔记本", new BigDecimal("1121.23")); Product product3 = new Product("3", "相机", new BigDecimal("3331.23")); Product product4 = new Product("4", "游戏机", new BigDecimal("12111.23")); addGood(product1); addGood(product2); addGood(product3); addGood(product4); logger.error("=========== 初始化商品信息完成 ==========="); } /** * 在项目启动时,所有的单例bean都实例化完成后,会调用该方法 */ @Override public void afterSingletonsInstantiated() { // 初始化商品信息 initializingGoods(); } } 4.1 加载配置信息 在应用程序启动时,可能需要加载一些配置信息,如数据库连接信息、系统参数等。SmartInitializingSingleton 接口可以用来执行这些初始化操作, 确保在所有单例 Bean 初始化完成之后再加载配置信息。 4.2 初始化缓存 在应用程序启动时,可以使用 SmartInitializingSingleton 接口来初始化缓存,以提高系统的性能和响应速度。 通过在所有单例 Bean 初始化完成后执行初始化缓存的操作,可以确保缓存数据已经准备就绪,从而避免了在系统运行时动态加载数据造成的性能损耗。 4.3. 执行定时任务 在某些情况下,可能需要在应用程序启动时执行一些定时任务,如数据同步、数据清理等。SmartInitializingSingleton 接口可以用来执行这些定时任务, 以确保它们在所有单例 Bean 初始化完成之后立即执行。 https://blog.csdn.net/fox9916/article/details/129042652 DefaultListableBeanFactory BeanPostProcessor ObjectPostProcessor AbstractConfiguredSecurityBuilder https://blog.csdn.net/u013737132/category_10368316.html https://github.com/wanglong/youlai-mall OAuth2ClientAuthenticationFilter