zno2

2023年7月13日 #

SpEL (Spring Expression Language)

摘要: https://docs.spring.io/spring-framework/docs/3.0.x/reference/expressions.html 6.1 Introduction The Spring Expression Language (SpEL for short) is a po 阅读全文

posted @ 2023-07-13 18:02 zno2 阅读(25) 评论(0) 推荐(0) 编辑

@ConfigurationProperties 前缀注入属性

摘要: import java.util.LinkedHashMap; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springfra 阅读全文

posted @ 2023-07-13 18:01 zno2 阅读(66) 评论(0) 推荐(0) 编辑

spring test @ContextConfiguration(locations = { "classpath:private-*.xml" }) 不生效

摘要: 查找资料该种写法未被授权,可以增加至少一级目录,或者使用具体名称 classpath:foo/private-*.xml 或者 classpath:private-sss.xml 源码中查到的资料,找到一些蛛丝马迹,但是debug断点时没有调用这个类的方法: org.springframework. 阅读全文

posted @ 2023-07-13 18:01 zno2 阅读(38) 评论(0) 推荐(0) 编辑

spring 静态变量方式加载properties 文件(支持profile)

摘要: foo-test.properties (测试环境) foo-pro.properties (生产环境) 需要根据spring.profiles.active 切换 import java.io.IOException; import java.util.Properties; import org 阅读全文

posted @ 2023-07-13 18:01 zno2 阅读(114) 评论(0) 推荐(0) 编辑

@Configration

摘要: Open Declaration org.springframework.context.annotation.Configuration @Target(value={TYPE}) @Retention(value=RUNTIME) @Documented @Component Indicates 阅读全文

posted @ 2023-07-13 18:01 zno2 阅读(16) 评论(0) 推荐(0) 编辑

Spring 方法命名为啥好多用post ?

摘要: 参考:JLSPreIncrementExpressionPostIncrementExpression int a = 0; a++; // post ++a; // pre 示例: @Test public void test() { int i = 0; System.out.println(i 阅读全文

posted @ 2023-07-13 18:01 zno2 阅读(15) 评论(0) 推荐(0) 编辑

spring bean 的属性为 java.util.Properties 时如何初始化该属性

摘要: public class FooBean { private java.util.Properties attr; public java.util.Properties getAttr() { return attr; } public void setAttr(java.util.Propert 阅读全文

posted @ 2023-07-13 18:00 zno2 阅读(30) 评论(0) 推荐(0) 编辑

spring 如何解析 xml 中的元素

摘要: org.springframework.beans.factory.xml.BeanDefinitionParser 举例说明: <tx:annotation-driven transaction-manager="txManager" /> org.springframework.transact 阅读全文

posted @ 2023-07-13 18:00 zno2 阅读(11) 评论(0) 推荐(0) 编辑

Spring 事务隔离级别

摘要: 其中 DEFAULT 的解释是:Use the default isolation level of the underlying datastore. 意思是不同数据库有其默认的隔离级别,使用对应数据库的默认隔离级别。 Tips: 数据库 默认隔离级别 参考文档 备注 MySQL REPEATAB 阅读全文

posted @ 2023-07-13 18:00 zno2 阅读(31) 评论(0) 推荐(0) 编辑

通过<util:property-path /> 动态配置JedisCluster 节点

摘要: 配置文件(统一命名): # redis cluster redis.node1.host=192.168.1.61 redis.node1.port=7000 redis.node2.host=192.168.1.62 redis.node2.port=7000 redis.node3.host=1 阅读全文

posted @ 2023-07-13 17:59 zno2 阅读(25) 评论(0) 推荐(0) 编辑

Spring 事务不起作用(二)

摘要: 当使用 spring root 和 mvc 时, mvc 一定要分开扫描组件,如果通过mvc 扫描所有组件会导致事务不起作用 一般 servlet 只扫描 web 的 组件,比如 Controller 等 其他组件如 Service 需要由 root 扫描 或者只使用 servlet @Enable 阅读全文

posted @ 2023-07-13 17:58 zno2 阅读(11) 评论(0) 推荐(0) 编辑

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema

摘要: Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring Na 阅读全文

posted @ 2023-07-13 17:57 zno2 阅读(63) 评论(0) 推荐(0) 编辑

BeanFactory 和 FactoryBean 的区别

摘要: 接口 用途 package org.springframework.scripting; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPa 阅读全文

posted @ 2023-07-13 17:55 zno2 阅读(11) 评论(0) 推荐(0) 编辑

导航