Spring
文章平均质量分 55
飞翔的咩咩
我家傻咩咩啊!飞在花丛中啊
展开
-
SpringBoot事务原理解析
Spring中使用事务需要添加注解,表示开启事务@EnableTransactionManagement这个注解有个默认属性AdviceMode mode() default AdviceMode.PROXY;说明默认是使用JDK代理的通知模式。然后注解上面使用了@Import注解@Import(TransactionManagementConfigurationSelector.class)我们再来看TransactionManagementConfigurationSe原创 2022-04-16 14:17:51 · 1943 阅读 · 0 评论 -
Spring注解@Scheduled的属性介绍
何处使用: 必须标记在方法上,并且方法必须没有返回值,也就是必须是void方法.怎么使用:1.需要有@EnableScheduling注解,或者<task:annotation-driven/>配置2.@Scheduled必须指定三个属性cron(), fixedDelay(),fixedRate()其中之一cron属性:格式如"0 * * * * MON-FRI"分别表示 秒,分钟,小时,月份的某天,月份,星期fixedDelay属性:上一次执行结束与下一次开原创 2021-11-08 18:42:13 · 515 阅读 · 0 评论 -
Spring AOP报错Set ‘exposeProxy‘ property on Advised to ‘true‘ to make it available问题
使用AopContext.currentProxy()时报错了.如下Cannot find current proxy: Set 'exposeProxy' property on Advised to 'true' to make it available,and ensure that AopContext.currentProxy() is invoked in the same thread as the AOP invocation context.看意思就是 没用设置exposePro..原创 2021-03-10 18:09:00 · 5685 阅读 · 0 评论 -
Spring中RestTemplate源码解析
在实现客户端的负载均衡中,有一种简单的方式就是通过调用被@LoadBalanced注解过的RestTemplate来实现面向服务的接口调用。例如:@Bean@LoadBalancedRestTemplate restTemplate() { //return new RestTemplate(); return new SimpleRestTemplateBuilder().build();}这里我没有使用默认的new RestTemplate(),我使用了自定义的配原创 2020-10-21 00:03:00 · 247 阅读 · 0 评论 -
Spring启动异常之ConflictingBeanDefinitionException: Annotation-specified bean name ‘XXXXXService‘
启动Spring项目报错ConflictingBeanDefinitionExceptionCaused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'XXXXXService' for bean class [com.service.common.MgrFileService] conflicts with existing.原创 2020-10-10 18:57:26 · 16395 阅读 · 0 评论 -
SpringBoot与Spring Cloud参考文档汇总
1.Spring Boot参考文档https://docs.spring.io/spring-boot/docs/2.2.6.RELEASE/reference/html/index.html2.Spring Cloud参考文档.https://docs.spring.io/spring-cloud/docs/后面选择版本.例如:https://docs.spring.io/spring-cloud/docs/Hoxton.SR7/reference/htmlsingle/3.Spri原创 2020-08-27 00:05:41 · 225 阅读 · 0 评论 -
Xml与Bean转换
有些接口接收参数是Xml格式,可以通过实现这个基础类转换.减少冗余代码/** * Xml Bean转换基础类 * */public abstract class MarshallAble{ public String marshallToString() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(ClassUtils.getUserClass(childClass.原创 2020-07-06 10:06:32 · 393 阅读 · 0 评论 -
解决SpringMVC报错Can not deserialize instance of java.util.ArrayList out of START_OBJECT token问题
SpringMVC请求报错Can not deserialize instance of java.util.ArrayList out of START_OBJECT token.请求参数是json格式:{ "busiOrderNoList": ["ord1526358029166", "ord1526358060543"]}接收是POST 方法: @ApiOperation(tags = {Constants.API_RequiresNoPermission}, value =原创 2020-06-04 18:11:08 · 6408 阅读 · 1 评论