Tag:spring

  • Example of using resource as attribute operation in spring

    Time:2020-12-1

    This article describes how to use resource as an attribute operation in spring. For your reference, the details are as follows: 1. Configuration file <?xml version=”1.0″ encoding=”GBK”?> <beans xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://www.springframework.org/schema/beans” xmlns:p=”http://www.springframework.org/schema/p” xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd”> <bean p:res=”classpath:book.xml”/> </beans> 2. Attribute file <?xml version=”1.0″ encoding=”GBK”?> < Computer Book list > < book > < title > crazy Java […]

  • Example of spring boot using spring retry mechanism

    Time:2020-11-24

    When we call the interface, it may fail due to network reasons. If we try again, we will succeed. This is the retrial mechanism. Be careful to use retrying when it is not idempotent. Tips: idempotent The definition of idempotency in http / 1.1 is that one or more requests for a resource should have […]

  • Setting method of springboot + idea hot boot (auto loading)

    Time:2020-11-18

    Springboot + idea hot start 1. In pom.xml Introducing jar package in <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> Then set it in build / plugins / plugin <configuration> < fork > true < / fork > <! — without this configuration, hot deployment will not take effect — > </configuration> The effect after introduction is shown […]

  • Spring transaction propagation behavior problem solving

    Time:2020-11-16

    This article mainly introduces the spring transaction propagation behavior problem solving, the article introduces in detail through the example code, which has a certain reference learning value for everyone’s study or work, and friends in need can refer to it 1、 Introduction For details of spring transaction configuration and related instructions, please refer to: https://www.jb51.net/article/177710.htm […]

  • Explain how to use Java API to call Lucene in spring boot

    Time:2020-11-9

    Lucene is a sub project of 4 Jakarta project team of Apache Software Foundation. It is an open source full-text retrieval engine toolkit. However, it is not a complete full-text retrieval engine, but a full-text retrieval engine architecture. It provides a complete query engine and index engine, and some text analysis engines (English and German […]

  • Spring AOP defines before to add details of actual combat cases

    Time:2020-11-8

    This article describes the spring AOP definition before adding. For your reference, the details are as follows: 1. Configuration <?xml version=”1.0″ encoding=”GBK”?> <beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:context=”http://www.springframework.org/schema/context” xmlns:aop=”http://www.springframework.org/schema/aop” 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”> <! — specifies to automatically search bean components and facet classes — > <context:component-scan base-package=”org.crazyit.app.service ,org.crazyit.app.aspect”> <context:include-filter type=”annotation” expression=”org.aspectj.lang.annotation.Aspect” /> </context:component-scan> <! […]

  • Spring AOP defines afterreturning to add instance analysis

    Time:2020-10-28

    This article describes the spring AOP definition of afterreturning. For your reference, the details are as follows: 1. Configuration <?xml version=”1.0″ encoding=”GBK”?> <beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:context=”http://www.springframework.org/schema/context” xmlns:aop=”http://www.springframework.org/schema/aop” 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”> <! — specifies to automatically search bean components and facet classes — > <context:component-scan base-package=”org.crazyit.app.service ,org.crazyit.app.aspect”> <context:include-filter type=”annotation” expression=”org.aspectj.lang.annotation.Aspect” /> </context:component-scan> <! […]

  • Implementation of java interface example with BeanShell through spring

    Time:2020-10-26

    explain 1. Let Java execute dynamic code through script language2. The script language can be proxy to java interface implementation class with spring3. Spring 2.5.6 supports three scripting languages ruby, groovy and BeanShell4. In the example, spring is combined with BeanShell5. Rely on spring 2.5.6, bsh-2.0b4 Copy codeThe code is as follows: import org.junit.Test;import org.springframework.scripting.bsh.BshScriptUtils; […]

  • Spring dynamic bean registration example sharing

    Time:2020-10-25

    1. In some special scenarios, it is necessary to register beans with spring dynamically2. Spring version 2.5.6 Copy codeThe code is as follows: public class ServiceServiceImpl implements ServiceService, ApplicationContextAware {  @Override public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)   throws BeansException {  this.context = applicationContext; }  public void addBeanService(Service service) throws BVSException {  if (!context.containsBean(service.getServiceName())) {   Class<?> serviceClass = getServiceClass(service.getClassName());   BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(serviceClass);   beanDefinitionBuilder.addPropertyValue(“servicename”, service.getServiceName());   registerBean(service.getServiceName(), beanDefinitionBuilder.getRawBeanDefinition());  } […]

  • Detailed explanation of spring expression language

    Time:2020-10-23

    This article mainly introduces the spring expression language spel usage details, the article through the example code introduction is very detailed, to everybody’s study or the work has the certain reference study value, the need friend may refer to (1) Spring expression language is a powerful expression language that supports runtime query and object graph […]

  • Spring is java.util.Properties The property of type is parsed in the assignment process

    Time:2020-10-22

    This article mainly introduces that spring is a kind of java.util.Properties In this paper, the example code is introduced in detail, which has a certain reference learning value for everyone’s study or work, and friends in need can refer to it The properties class represents a persistent set of properties. Properties can be saved in […]

  • Analyzing the relationship between spring beans through examples

    Time:2020-10-21

    This article mainly introduces how to analyze the relationship between spring beans through examples. The example code is introduced in detail, which has certain reference value for everyone’s study or work. Friends in need can refer to it Two kinds of relations: Inheritance and dependence 1、 Inheritance relationship Address.java package com.gong.spring.beans.autowire; public class Address { […]