spring aop示例

Welcome to Spring Batch Example. Spring Batch is a spring framework module for execution of batch job. We can use spring batch to process a series of jobs.

欢迎使用Spring Batch示例。 Spring Batch是用于执行批处理作业的Spring 框架模块。 我们可以使用spring batch来处理一系列作业。

Spring批处理示例 (Spring Batch Example)

Before going through spring batch example program, let’s get some idea about spring batch terminologies.

在进行Spring批处理示例程序之前,让我们对Spring批处理术语有所了解。

  • A job can consist of ‘n’ number of steps. Each step contains Read-Process-Write task or it can have single operation, which is called tasklet.作业可以包含“ n”个步骤。 每个步骤都包含Read-Process-Write任务,也可以具有单个操作,称为tasklet。
  • Read-Process-Write is basically read from a source like Database, CSV etc. then process the data and write it to a source like Database, CSV, XML etc.基本上从诸如数据库,CSV等之类的源读取Read-Process-Write,然后处理数据并将其写入诸如数据库,CSV,XML等之类的源。
  • Tasklet means doing a single task or operation like cleaning of connections, freeing up resources after processing is done.Tasklet意味着执行单个任务或操作,例如清理连接,在处理完成后释放资源。
  • Read-Process-Write and tasklets can be chained together to run a job.可以将Read-Process-Write和Tasklet链接在一起以运行作业。

Spring批处理示例 (Spring Batch Example)

Let us consider a working example for implementation of spring batch. We will consider the following scenario for implementation purpose.

让我们考虑一个实现Spring Batch的可行示例。 为了实现目的,我们将考虑以下情形。

A CSV file containing data needs to be converted as XML along with the data and tags will be named after the column name.

包含数据的CSV文件需要与数据一起转换为XML,并且标记将以列名命名。

Below are the important tools and libraries used for spring batch example.

以下是用于Spring批处理示例的重要工具和库。

  1. Apache Maven 3.5.0 – for project build and dependencies management.Apache Maven 3.5.0 –用于项目构建和依赖关系管理。
  2. Eclipse Oxygen Release 4.7.0 – IDE for creating spring batch maven application.Eclipse Oxygen版本4.7.0 –用于创建spring batch maven应用程序的IDE。
  3. Java 1.8Java 1.8
  4. Spring Core 4.3.12.RELEASESpring Core 4.3.12。发布
  5. Spring OXM 4.3.12.RELEASESpring OXM 4.3.12。发布
  6. Spring JDBC 4.3.12.RELEASESpring JDBC 4.3.12。发布
  7. Spring Batch 3.0.8.RELEASESpring Batch 3.0.8。发布
  8. MySQL Java Driver 5.1.25 – use based on your MySQL installation. This is required for Spring Batch metadata tables.MySQL Java Driver 5.1.25 –根据您MySQL安装使用。 这是Spring Batch元数据表所必需的。

Spring Batch示例目录结构 (Spring Batch Example Directory Structure)

Below image illustrates all the components in our Spring Batch example project.

下图说明了我们的Spring Batch示例项目中的所有组件。

Spring Batch Maven依赖关系 (Spring Batch Maven Dependencies)

Below is the content of pom.xml file with all the required dependencies for our spring batch example project.

以下是pom.xml文件的内容,其中包含我们的Spring Batch示例项目所需的所有依赖项。

<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.journaldev.spring</groupId><artifactId>SpringBatchExample</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>SpringBatchDemo</name><url>https://maven.apache.org</url><properties><jdk.version>1.8</jdk.version><spring.version>4.3.12.RELEASE</spring.version><spring.batch.version>3.0.8.RELEASE</spring.batch.version><mysql.driver.version>5.1.25</mysql.driver.version><junit.version>4.11</junit.version></properties><dependencies><!-- Spring Core --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency><!-- Spring jdbc, for database --><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><!-- Spring XML to/back object --><dependency><groupId>org.springframework</groupId><artifactId>spring-oxm</artifactId><version>${spring.version}</version></dependency><!-- MySQL database driver --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.driver.version}</version></dependency><!-- Spring Batch dependencies --><dependency><groupId>org.springframework.batch</groupId><artifactId>spring-batch-core</artifactId><version>${spring.batch.version}</version></dependency><dependency><groupId>org.springframework.batch</groupId><artifactId>spring-batch-infrastructure</artifactId><version>${spring.batch.version}</version></dependency><!-- Spring Batch unit test --><dependency><groupId>org.springframework.batch</groupId><artifactId>spring-batch-test</artifactId><version>${spring.batch.version}</version></dependency><!-- Junit --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junit.version}</version><scope>test</scope></dependency><dependency><groupId>com.thoughtworks.xstream</groupId><artifactId>xstream</artifactId><version>1.4.10</version></dependency></dependencies><build><finalName>spring-batch</finalName><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-eclipse-plugin</artifactId><version>2.9</version><configuration><downloadSources>true</downloadSources><downloadJavadocs>false</downloadJavadocs></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><source>${jdk.version}</source><target>${jdk.version}</target></configuration></plugin></plugins></build>
</project>

Spring Batch处理CSV输入文件 (Spring Batch Processing CSV Input File)

Here is the content of our sample CSV file for spring batch processing.

这是用于Spring批处理的示例CSV文件的内容。

1001,Tom,Moody, 29/7/2013
1002,John,Parker, 30/7/2013
1003,Henry,Williams, 31/7/2013

Spring Batch作业配置 (Spring Batch Job Configuration)

We have to define spring bean and spring batch job in a configuration file. Below is the content of job-batch-demo.xml file, it’s the most important part of spring batch project.

我们必须在配置文件中定义spring bean和spring批处理作业。 以下是job-batch-demo.xml文件的内容,它是spring batch项目中最重要的部分。

<beans xmlns="https://www.springframework.org/schema/beans"xmlns:batch="https://www.springframework.org/schema/batch" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="https://www.springframework.org/schema/batchhttps://www.springframework.org/schema/batch/spring-batch-3.0.xsdhttps://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-4.3.xsd"><import resource="../config/context.xml" /><import resource="../config/database.xml" /><bean id="report" class="com.journaldev.spring.model.Report"scope="prototype" /><bean id="itemProcessor" class="com.journaldev.spring.CustomItemProcessor" /><batch:job id="DemoJobXMLWriter"><batch:step id="step1"><batch:tasklet><batch:chunk reader="csvFileItemReader" writer="xmlItemWriter"processor="itemProcessor" commit-interval="10"></batch:chunk></batch:tasklet></batch:step></batch:job><bean id="csvFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader"><property name="resource" value="classpath:csv/input/report.csv" /><property name="lineMapper"><bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"><property name="lineTokenizer"><beanclass="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"><property name="names" value="id,firstname,lastname,dob" /></bean></property><property name="fieldSetMapper"><bean class="com.journaldev.spring.ReportFieldSetMapper" /><!-- if no data type conversion, use BeanWrapperFieldSetMapper to map by name <bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper"> <property name="prototypeBeanName" value="report" /> </bean> --></property></bean></property></bean><bean id="xmlItemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter"><property name="resource" value="file:xml/outputs/report.xml" /><property name="marshaller" ref="reportMarshaller" /><property name="rootTagName" value="report" /></bean><bean id="reportMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"><property name="classesToBeBound"><list><value>com.journaldev.spring.model.Report</value></list></property></bean></beans>
  1. We are using FlatFileItemReader to read CSV file, CustomItemProcessor to process the data and write to XML file using StaxEventItemWriter.我们正在使用FlatFileItemReader读取CSV文件,使用CustomItemProcessor处理数据并使用StaxEventItemWriter写入XML文件。
  2. batch:job – This tag defines the job that we want to create. Id property specifies the ID of the job. We can define multiple jobs in a single xml file.batch:job –此标签定义我们要创建的作业。 Id属性指定作业的ID。 我们可以在一个xml文件中定义多个作业。
  3. batch:step – This tag is used to define different steps of a spring batch job.batch:step –此标签用于定义弹簧批处理作业的不同步骤。
  4. Two different types of processing style is offered by Spring Batch Framework, which are “TaskletStep Oriented” and “Chunk Oriented”. Chunk Oriented style is used in this example refers to reading the data one by one and creating ‘chunks’ that will be written out, within a transaction boundary.Spring Batch Framework提供了两种不同类型的处理样式,即“面向TaskletStep”和“面向块”。 在此示例中,使用的“面向块的”样式指的是在事务边界内一次读取数据并创建要写出的“块”。
  5. reader: spring bean used for reading the data. We have used csvFileItemReader bean in this example that is instance of FlatFileItemReader.reader:用于读取数据的spring bean。 在此示例中,我们使用了csvFileItemReader bean,它是FlatFileItemReader实例。
  6. processor: this is the class which is used for processing the data. We have used CustomItemProcessor in this example.处理器:这是用于处理数据的类。 在此示例中,我们使用了CustomItemProcessor
  7. writer: bean used to write data into xml file.writer:用于将数据写入xml文件的bean。
  8. commit-interval: This property defines the size of the chunk which will be committed once processing is done. Basically it means that ItemReader will read the data one by one and ItemProcessor will also process it the same way but ItemWriter will write the data only when it equals the size of commit-interval.commit-interval:此属性定义处理完成后将提交的块的大小。 基本上,这意味着ItemReader将一一读取数据,ItemProcessor也将以相同的方式处理数据,但ItemWriter仅在等于commit-interval大小时才写入数据。
  9. Three important interface that are used as part of this project are ItemReader, ItemProcessor and ItemWriter from org.springframework.batch.item package.用作该项目一部分的三个重要接口是来自org.springframework.batch.item包的ItemReaderItemProcessorItemWriter

Spring批模型类 (Spring Batch Model Class)

First of all we are reading CSV file into java object and then using JAXB to write it to xml file. Below is our model class with required JAXB annotations.

首先,我们将CSV文件读入java对象,然后使用JAXB将其写入xml文件。 下面是带有必需的JAXB 批注的模型类。

package com.journaldev.spring.model;import java.util.Date;import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;@XmlRootElement(name = "record")
public class Report {private int id;private String firstName;private String lastName;private Date dob;@XmlAttribute(name = "id")public int getId() {return id;}public void setId(int id) {this.id = id;}@XmlElement(name = "firstname")public String getFirstName() {return firstName;}public void setFirstName(String firstName) {this.firstName = firstName;}@XmlElement(name = "lastname")public String getLastName() {return lastName;}public void setLastName(String lastName) {this.lastName = lastName;}@XmlElement(name = "dob")public Date getDob() {return dob;}public void setDob(Date dob) {this.dob = dob;}@Overridepublic String toString() {return "Report [id=" + id + ", firstname=" + firstName + ", lastName=" + lastName + ", DateOfBirth=" + dob+ "]";}}

Note that the model class fields should be same as defined in the spring batch mapper configuration i.e. property name="names" value="id,firstname,lastname,dob" in our case.

请注意,模型类字段应与Spring Batch Mapper配置中定义的字段相同,即在我们的示例中property name="names" value="id,firstname,lastname,dob"

Spring Batch FieldSetMapper (Spring Batch FieldSetMapper)

A custom FieldSetMapper is needed to convert a Date. If no data type conversion is required, then only BeanWrapperFieldSetMapper should be used to map the values by name automatically.

需要自定义FieldSetMapper来转换日期。 如果不需要数据类型转换,则仅应使用BeanWrapperFieldSetMapper来按名称自动映射值。

The java class which extends FieldSetMapper is ReportFieldSetMapper.

扩展FieldSetMapper的Java类是ReportFieldSetMapper

package com.journaldev.spring;import java.text.ParseException;
import java.text.SimpleDateFormat;import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.validation.BindException;import com.journaldev.spring.model.Report;public class ReportFieldSetMapper implements FieldSetMapper<Report> {private SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");public Report mapFieldSet(FieldSet fieldSet) throws BindException {Report report = new Report();report.setId(fieldSet.readInt(0));report.setFirstName(fieldSet.readString(1));report.setLastName(fieldSet.readString(2));// default format yyyy-MM-dd// fieldSet.readDate(4);String date = fieldSet.readString(3);try {report.setDob(dateFormat.parse(date));} catch (ParseException e) {e.printStackTrace();}return report;}}

Spring批项目处理器 (Spring Batch Item Processor)

Now as defined in the job configuration an itemProcessor will be fired before itemWriter. We have created a CustomItemProcessor.java class for the same.

现在,按照作业配置中的定义,将在itemWriter之前触发itemProcessor。 我们为此创建了一个CustomItemProcessor.java类。

package com.journaldev.spring;import org.springframework.batch.item.ItemProcessor;import com.journaldev.spring.model.Report;public class CustomItemProcessor implements ItemProcessor<Report, Report> {public Report process(Report item) throws Exception {System.out.println("Processing..." + item);String fname = item.getFirstName();String lname = item.getLastName();item.setFirstName(fname.toUpperCase());item.setLastName(lname.toUpperCase());return item;}}

We can manipulate data in ItemProcessor implementation, as you can see that I am converting first name and last name values to upper case.

我们可以在ItemProcessor实现中操纵数据,如您所见,我正在将名字和姓氏值转换为大写。

Spring配置文件 (Spring Configuration Files)

In our spring batch configuration file, we have imported two additional configuration files – context.xml and database.xml.

在我们的Spring批处理配置文件中,我们导入了两个附加配置文件– context.xmldatabase.xml

<beans xmlns="https://www.springframework.org/schema/beans"xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="https://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-4.3.xsd"><!-- stored job-meta in memory --><!--  <bean id="jobRepository"class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"><property name="transactionManager" ref="transactionManager" /></bean>--><!-- stored job-meta in database --><bean id="jobRepository"class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"><property name="dataSource" ref="dataSource" /><property name="transactionManager" ref="transactionManager" /><property name="databaseType" value="mysql" /></bean><bean id="transactionManager"class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" /><bean id="jobLauncher"class="org.springframework.batch.core.launch.support.SimpleJobLauncher"><property name="jobRepository" ref="jobRepository" /></bean></beans>
  • jobRepository – The JobRepository is responsible for storing each Java object into its correct meta-data table for spring batch.jobRepository – JobRepository负责将每个Java对象存储到其正确的元数据表中以进行Spring批处理。
  • transactionManager– this is responsible for committing the transaction once size of commit-interval and the processed data is equal.transactionManager –一旦commit-interval的大小和已处理的数据相等,就负责提交事务。
  • jobLauncher – This is the heart of spring batch. This interface contains the run method which is used to trigger the job.jobLauncher –这是Spring批处理的核心。 该接口包含用于触发作业的运行方法。
<beans xmlns="https://www.springframework.org/schema/beans"xmlns:jdbc="https://www.springframework.org/schema/jdbc" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="https://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-4.3.xsdhttps://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd"><!-- connect to database --><bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource"><property name="driverClassName" value="com.mysql.jdbc.Driver" /><property name="url" value="jdbc:mysql://localhost:3306/Test" /><property name="username" value="test" /><property name="password" value="test123" /></bean><bean id="transactionManager"class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" /><!-- create job-meta tables automatically --><!-- <jdbc:initialize-database data-source="dataSource"> <jdbc:script location="org/springframework/batch/core/schema-drop-mysql.sql" /> <jdbc:script location="org/springframework/batch/core/schema-mysql.sql" /> </jdbc:initialize-database> -->
</beans>

Spring Batch uses some metadata tables to store batch jobs information. We can get them created from spring batch configurations but it’s advisable to do it manually by executing the SQL files, as you can see in commented code above. From security point of view, it’s better to not give DDL execution access to spring batch database user.

Spring Batch使用一些元数据表来存储批处理作业信息。 我们可以从spring批处理配置中创建它们,但是建议您通过执行SQL文件来手动执行,如您在上面的注释代码中所见。 从安全性的角度来看,最好不要向Spring Batch数据库用户授予DDL执行访问权限。

Spring批表 (Spring Batch Tables)

Spring Batch tables very closely match the Domain objects that represent them in Java. For example – JobInstance, JobExecution, JobParameters and StepExecution map to BATCH_JOB_INSTANCE, BATCH_JOB_EXECUTION, BATCH_JOB_EXECUTION_PARAMS and BATCH_STEP_EXECUTION respectively.

Spring Batch表非常匹配Java中表示它们的Domain对象。 例如– JobInstance,JobExecution,JobParameters和StepExecution分别映射到BATCH_JOB_INSTANCE,BATCH_JOB_EXECUTION,BATCH_JOB_EXECUTION_PARAMS和BATCH_STEP_EXECUTION。

ExecutionContext maps to both BATCH_JOB_EXECUTION_CONTEXT and BATCH_STEP_EXECUTION_CONTEXT.

ExecutionContext映射到BATCH_JOB_EXECUTION_CONTEXT和BATCH_STEP_EXECUTION_CONTEXT。

The JobRepository is responsible for saving and storing each java object into its correct table.

Below are the details of each meta-data table.

JobRepository负责将每个Java对象保存并存储到其正确的表中。

以下是每个元数据表的详细信息。

  1. Batch_job_instance: The BATCH_JOB_INSTANCE table holds all information relevant to a JobInstance.Batch_job_instance :BATCH_JOB_INSTANCE表保存与JobInstance相关的所有信息。
  2. Batch_job_execution_params: The BATCH_JOB_EXECUTION_PARAMS table holds all information relevant to the JobParameters object.Batch_job_execution_params :BATCH_JOB_EXECUTION_PARAMS表保存与JobParameters对象有关的所有信息。
  3. Batch_job_execution: The BATCH_JOB_EXECUTION table holds data relevant to the JobExecution object. A new row gets added every time a Job is run.Batch_job_execution :BATCH_JOB_EXECUTION表保存与JobExecution对象有关的数据。 每次运行作业时,都会添加一个新行。
  4. Batch_step_execution: The BATCH_STEP_EXECUTION table holds all information relevant to the StepExecution object.Batch_step_execution :BATCH_STEP_EXECUTION表包含与StepExecution对象有关的所有信息。
  5. Batch_job_execution_context: The BATCH_JOB_EXECUTION_CONTEXT table holds data relevant to an Job’s ExecutionContext. There is exactly one Job ExecutionContext for every JobExecution, and it contains all of the job-level data that is needed for that particular job execution. This data typically represents the state that must be retrieved after a failure so that a JobInstance can restart from where it had failed.Batch_job_execution_context :BATCH_JOB_EXECUTION_CONTEXT表保存与作业的ExecutionContext相关的数据。 每个JobExecution都有一个Job ExecutionContext,它包含该特定作业执行所需的所有作业级数据。 此数据通常表示失败后必须检索的状态,以便JobInstance可以从发生故障的位置重新启动。
  6. Batch_step_execution_context: The BATCH_STEP_EXECUTION_CONTEXT table holds data relevant to an Step’s ExecutionContext. There is exactly one ExecutionContext for every StepExecution, and it contains all of the data that needs to persisted for a particular step execution. This data typically represents the state that must be retrieved after a failure so that a JobInstance can restart from where it failed.Batch_step_execution_context :BATCH_STEP_EXECUTION_CONTEXT表保存与步骤的ExecutionContext相关的数据。 每个StepExecution都只有一个ExecutionContext,并且它包含执行特定步骤所需的所有数据。 此数据通常表示失败后必须检索的状态,以便JobInstance可以从发生故障的地方重新启动。
  7. Batch_job_execution_seq: This table holds the data execution sequence of job.Batch_job_execution_seq :该表保存作业的数据执行顺序。
  8. Batch_step_execution_seq: This table holds the data for sequence for step execution.Batch_step_execution_seq :该表保存用于执行步骤的顺序的数据。
  9. Batch_job_seq: This table holds the data for sequence of job in case we have multiple jobs we will get multiple rows.Batch_job_seq :如果我们有多个作业,我们将获得多行,此表将保存作业序列的数据。

Spring批测试程序 (Spring Batch Test Program)

Our Spring Batch example project is ready, final step is to write a test class to execute it as a java program.

我们的Spring Batch示例项目已经准备就绪,最后一步是编写一个测试类以将其作为Java程序执行。

package com.journaldev.spring;import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class App {public static void main(String[] args) {String[] springConfig = { "spring/batch/jobs/job-batch-demo.xml" };ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(springConfig);JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");Job job = (Job) context.getBean("DemoJobXMLWriter");JobParameters jobParameters = new JobParametersBuilder().addLong("time", System.currentTimeMillis()).toJobParameters();try {JobExecution execution = jobLauncher.run(job, jobParameters);System.out.println("Exit Status : " + execution.getStatus());} catch (Exception e) {e.printStackTrace();}System.out.println("Done");context.close();}
}

Just run above program and you will get output xml like below.

只需在程序上方运行,您将获得如下所示的输出xml。

<?xml version="1.0" encoding="UTF-8"?><report><record id="1001"><dob>2013-07-29T00:00:00+05:30</dob><firstname>TOM</firstname><lastname>MOODY</lastname></record><record id="1002"><dob>2013-07-30T00:00:00+05:30</dob><firstname>JOHN</firstname><lastname>PARKER</lastname></record><record id="1003"><dob>2013-07-31T00:00:00+05:30</dob><firstname>HENRY</firstname><lastname>WILLIAMS</lastname></record></report>

That’s all for Spring Batch example, you can download final project from below link.

这就是Spring Batch示例的全部内容,您可以从下面的链接下载最终项目。

Download Spring Batch Example Project下载Spring Batch示例项目

Reference: Official Guide

参考: 官方指南

翻译自: https://www.journaldev.com/17157/spring-batch-example

spring aop示例

spring aop示例_Spring批处理示例相关推荐

  1. spring aop示例_Spring JpaRepository示例(内存中)

    spring aop示例 这篇文章描述了一个使用内存中HSQL数据库的简单Spring JpaRepository示例. 该代码示例可从GitHub的Spring-JpaRepository目录中获得 ...

  2. spring aop原理_Spring知识点总结!已整理成142页离线文档(源码笔记+思维导图)...

    写在前面 由于Spring家族的东西很多,一次性写完也不太现实.所以这一次先更新Spring[最核心]的知识点:AOP和IOC 无论是入门还是面试,理解AOP和IOC都是非常重要的.在面试的时候,我没 ...

  3. spring mvc示例_Spring MVC示例

    spring mvc示例 Welcome to Spring MVC Example. Sometime back in Spring MVC Tutorial, I explained how to ...

  4. spring aop设计模式_Spring框架中设计模式的运用

    设计模式大家可能随口就能说出总共有23种,但是具体怎么用,或者在常用的组建中有哪些体现,这时候不一定说的上来了.接下来几篇文章,我们一起深入理解.首先我们一起了解下常用的组建中是怎么运用的,比如 JD ...

  5. spring aop不执行_使用Spring AOP重试方法执行

    spring aop不执行 我的一位博客关注者发送了一封电子邮件,要求我显示" Spring AOP的RealWorld用法"示例. 他提到,在大多数示例中,都演示了Spring ...

  6. 使用Spring AOP重试方法执行

    我的一位博客关注者发送了一封电子邮件,要求我显示" Spring AOP的RealWorld用法"示例. 他提到,在大多数示例中,都演示了Spring AOP在日志记录方法进入/退 ...

  7. Spring AOP方法分析

    Spring AOP方法分析 此示例显示如何配置Spring AOP方法概要分析.我们可以在任何服务(或其他)类中使用Spring AOP和任何方法,而无需在任何服务类中编写任何一行分析代码.面向方面 ...

  8. Spring 5 中文解析之核心篇-Spring AOP编程

    技术交流群: 面向切面的编程(AOP)通过提供另一种思考程序结构的方式来补充面向对像的编程(OOP).OOP中模块化的关键单元是类,而在AOP中模块化是切面.切面使关注点(例如事务管理)的模块化可以跨 ...

  9. spring aop示例_Spring查找方法示例

    spring aop示例 当一个bean依赖于另一个bean时,我们使用setter属性或通过构造函数注入bean. getter方法将向我们返回已设置的引用,但是假设您每次调用getter方法时都想 ...

最新文章

  1. WINCE--编译环境一二三(转摘)
  2. JCO_(配置连接池)
  3. “快准顺”而不是“信达雅”
  4. 自动部署 php,Jenkins实现PHP的自动部署
  5. idata界面_iData手持移动终端组合键恢复出厂设置教程
  6. 腾讯 AI“绝悟”升级至王者荣耀电竞职业水平 测试胜率达99.8%
  7. 全年日降雨数据下载与处理教程
  8. oracle宕了,帮忙分析原因:数据库宕了(急)
  9. Java随机产生两位数正整数
  10. 前端学习之路-聚美优品注册页面的实现
  11. VSCode 代码换行快捷键设置为Shift + Enter
  12. Vue 3 组件开发:搭建基于SpreadJS的表格编辑系统(环境搭建)
  13. BigBrother的大数据之旅Day 17 redis(2)
  14. wpp trace在windbg输出的方法
  15. 从面向对象编程转为面向接口编程
  16. Power tool
  17. 固话伴侣-可以电话录音的数码传真机
  18. 阿里云发布ET工业大脑开放平台,全球首个工业智能的孵化基地
  19. CAD调出字体样式编辑框
  20. EFO while scanning triple-quoted string litera; 报错

热门文章

  1. Mininet的内部实现原理简介
  2. fenby C语言 P11
  3. [转]linux命令技巧
  4. [代码]获取源页的控件值
  5. [转载] python float()
  6. python @的作用
  7. P1066 2^k进制数
  8. Ansible(自动化运维工具--playbook)
  9. 设计模式(3)--SimpleFactory( [1] 简单工厂模式)--创建型
  10. C语言 NUL、NULL及eof