Merge pull request #7970 from den314/master
BAEL-3155 splitting up spring-all module
This commit is contained in:
commit
804384fe3c
|
@ -83,4 +83,5 @@ jta/transaction-logs/
|
|||
software-security/sql-injection-samples/derby.log
|
||||
spring-soap/src/main/java/com/baeldung/springsoap/gen/
|
||||
/report-*.json
|
||||
transaction.log
|
||||
transaction.log
|
||||
*-shell.log
|
|
@ -18,4 +18,6 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m
|
|||
- [Key Value Store with Chronicle Map](https://www.baeldung.com/java-chronicle-map)
|
||||
- [Guide to MapDB](https://www.baeldung.com/mapdb)
|
||||
- [A Guide to Apache Mesos](https://www.baeldung.com/apache-mesos)
|
||||
- [JasperReports with Spring](https://www.baeldung.com/spring-jasper)
|
||||
- More articles [[<-- prev]](/libraries)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>libraries-2</artifactId>
|
||||
<name>libraries-2</name>
|
||||
|
@ -112,10 +112,36 @@
|
|||
<artifactId>mesos</artifactId>
|
||||
<version>${mesos.library.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports</artifactId>
|
||||
<version>${jasperreports.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>${hsqldb.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<mapdb.version>3.0.7</mapdb.version>
|
||||
<mapdb.version>3.0.7</mapdb.version>
|
||||
<assertj.version>3.6.2</assertj.version>
|
||||
<classgraph.version>4.8.28</classgraph.version>
|
||||
<jbpm.version>6.0.0.Final</jbpm.version>
|
||||
|
@ -129,5 +155,8 @@
|
|||
<gson.version>2.8.5</gson.version>
|
||||
<mockwebserver.version>3.14.2</mockwebserver.version>
|
||||
<handlebars.version>4.1.2</handlebars.version>
|
||||
<jasperreports.version>6.6.0</jasperreports.version>
|
||||
<spring.version>5.1.9.RELEASE</spring.version>
|
||||
<hsqldb.version>2.5.0</hsqldb.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package org.baeldung.jasperreports;
|
||||
package com.baeldung.jasperreports;
|
||||
|
||||
import com.baeldung.jasperreports.config.JasperRerportsSimpleConfig;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.baeldung.jasperreports.config.JasperRerportsSimpleConfig;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
|
@ -1,22 +1,17 @@
|
|||
package org.baeldung.jasperreports;
|
||||
package com.baeldung.jasperreports;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
import net.sf.jasperreports.engine.JasperPrint;
|
||||
import net.sf.jasperreports.engine.export.HtmlExporter;
|
||||
import net.sf.jasperreports.engine.export.JRCsvExporter;
|
||||
import net.sf.jasperreports.engine.export.JRPdfExporter;
|
||||
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
|
||||
import net.sf.jasperreports.export.SimpleExporterInput;
|
||||
import net.sf.jasperreports.export.SimpleHtmlExporterOutput;
|
||||
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
|
||||
import net.sf.jasperreports.export.SimplePdfExporterConfiguration;
|
||||
import net.sf.jasperreports.export.SimplePdfReportConfiguration;
|
||||
import net.sf.jasperreports.export.SimpleWriterExporterOutput;
|
||||
import net.sf.jasperreports.export.SimpleXlsxReportConfiguration;
|
||||
import net.sf.jasperreports.export.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Component
|
||||
public class SimpleReportExporter {
|
||||
|
|
@ -1,20 +1,17 @@
|
|||
package org.baeldung.jasperreports;
|
||||
package com.baeldung.jasperreports;
|
||||
|
||||
import net.sf.jasperreports.engine.*;
|
||||
import net.sf.jasperreports.engine.util.JRSaver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.sql.DataSource;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
import net.sf.jasperreports.engine.JasperCompileManager;
|
||||
import net.sf.jasperreports.engine.JasperFillManager;
|
||||
import net.sf.jasperreports.engine.JasperPrint;
|
||||
import net.sf.jasperreports.engine.JasperReport;
|
||||
import net.sf.jasperreports.engine.util.JRSaver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SimpleReportFiller {
|
|
@ -1,13 +1,14 @@
|
|||
package org.baeldung.jasperreports.config;
|
||||
package com.baeldung.jasperreports.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.baeldung.jasperreports.SimpleReportExporter;
|
||||
import org.baeldung.jasperreports.SimpleReportFiller;
|
||||
import com.baeldung.jasperreports.SimpleReportExporter;
|
||||
import com.baeldung.jasperreports.SimpleReportFiller;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class JasperRerportsSimpleConfig {
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
|
||||
<kbase name="kbase" packages="com.baeldung.process" />
|
||||
<kbase name="kbase" packages="com.baeldung.process"/>
|
||||
</kmodule>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
|
||||
name="employeeReport" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20"
|
||||
topMargin="20" bottomMargin="20">
|
||||
<parameter name="idEmployee" class="java.lang.Integer" isForPrompting="false"/>
|
||||
<queryString>
|
||||
<![CDATA[SELECT * FROM EMAIL WHERE ID_EMPLOYEE = $P{idEmployee}]]>
|
||||
</queryString>
|
||||
<field name="ADDRESS" class="java.lang.String"/>
|
||||
<detail>
|
||||
<band height="20" splitType="Stretch">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="156" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{ADDRESS}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
</jasperReport>
|
|
@ -1,12 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="employeeReport" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
|
||||
name="employeeReport" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20"
|
||||
topMargin="20" bottomMargin="20">
|
||||
<parameter name="title" class="java.lang.String" isForPrompting="false"/>
|
||||
<parameter name="condition" class="java.lang.String" isForPrompting="false">
|
||||
<defaultValueExpression><![CDATA[" 1 = 1"]]></defaultValueExpression>
|
||||
</parameter>
|
||||
<parameter name="minSalary" class="java.lang.Double" isForPrompting="false"/>
|
||||
<queryString>
|
||||
<![CDATA[SELECT * FROM EMPLOYEE WHERE SALARY >= $P{minSalary} AND $P!{condition}]]>
|
||||
<![CDATA[SELECT * FROM EMPLOYEE WHERE SALARY >= $P{minSalary} AND $P!{condition}]]>
|
||||
</queryString>
|
||||
<field name="FIRST_NAME" class="java.lang.String"/>
|
||||
<field name="LAST_NAME" class="java.lang.String"/>
|
||||
|
@ -44,7 +48,8 @@
|
|||
<subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>
|
||||
</subreportParameter>
|
||||
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
|
||||
<subreportExpression class="java.lang.String"><![CDATA["employeeEmailReport.jasper"]]></subreportExpression>
|
||||
<subreportExpression class="java.lang.String">
|
||||
<![CDATA["employeeEmailReport.jasper"]]></subreportExpression>
|
||||
</subreport>
|
||||
</band>
|
||||
</detail>
|
9
pom.xml
9
pom.xml
|
@ -599,6 +599,7 @@
|
|||
<module>spring-boot-performance</module>
|
||||
<module>spring-boot-properties</module>
|
||||
<!-- <module>spring-mvc-basics</module> --> <!-- Compilation failure -->
|
||||
|
||||
<module>spring-security-kerberos</module>
|
||||
<module>oauth2-framework-impl</module>
|
||||
|
||||
|
@ -667,7 +668,6 @@
|
|||
|
||||
<module>spring-activiti</module>
|
||||
<module>spring-akka</module>
|
||||
<module>spring-all</module>
|
||||
<module>spring-amqp</module>
|
||||
<module>spring-aop</module>
|
||||
<module>spring-apache-camel</module>
|
||||
|
@ -714,6 +714,7 @@
|
|||
|
||||
<module>spring-core</module>
|
||||
<module>spring-core-2</module>
|
||||
<module>spring-core-3</module>
|
||||
<module>spring-cucumber</module>
|
||||
|
||||
<module>spring-data-rest</module>
|
||||
|
@ -1390,7 +1391,6 @@
|
|||
<module>spring-5-security-cognito</module>
|
||||
<module>spring-activiti</module>
|
||||
<module>spring-akka</module>
|
||||
<module>spring-all</module>
|
||||
<module>spring-amqp</module>
|
||||
<module>spring-aop</module>
|
||||
<module>spring-apache-camel</module>
|
||||
|
@ -1424,7 +1424,7 @@
|
|||
<module>spring-boot-property-exp</module>
|
||||
<module>spring-boot-security</module>
|
||||
<module>spring-boot-vue</module>
|
||||
|
||||
<module>spring-caching</module>
|
||||
<module>spring-cloud</module>
|
||||
<module>spring-cloud-bus</module>
|
||||
<!-- <module>spring-cloud-cli</module> --> <!-- Not a maven project -->
|
||||
|
@ -1463,6 +1463,7 @@
|
|||
|
||||
<module>spring-mobile</module>
|
||||
<module>spring-mockito</module>
|
||||
<module>spring-mvc-basics-2</module>
|
||||
<module>spring-mvc-forms-jsp</module>
|
||||
<module>spring-mvc-forms-thymeleaf</module>
|
||||
<module>spring-mvc-java</module>
|
||||
|
@ -1492,6 +1493,7 @@
|
|||
<module>spring-resttemplate</module>
|
||||
<module>spring-roo</module>
|
||||
|
||||
<module>spring-scheduling</module>
|
||||
<module>spring-security-acl</module>
|
||||
<module>spring-security-angular/server</module>
|
||||
<module>spring-security-cache-control</module>
|
||||
|
@ -1514,6 +1516,7 @@
|
|||
<module>spring-security-thymeleaf</module>
|
||||
<module>spring-security-x509</module>
|
||||
<module>spring-session</module>
|
||||
<module>spring-shell</module>
|
||||
<module>spring-sleuth</module>
|
||||
<module>spring-soap</module>
|
||||
<module>spring-social-login</module>
|
||||
|
|
|
@ -6,3 +6,4 @@ This module contains articles about Spring 4
|
|||
- [A Guide to Flips for Spring](https://www.baeldung.com/flips-spring)
|
||||
- [Configuring a Hikari Connection Pool with Spring Boot](https://www.baeldung.com/spring-boot-hikari)
|
||||
- [Spring JSON-P with Jackson](https://www.baeldung.com/spring-jackson-jsonp)
|
||||
- [What’s New in Spring 4.3?](https://www.baeldung.com/whats-new-in-spring-4-3)
|
||||
|
|
|
@ -67,6 +67,27 @@
|
|||
<artifactId>tomcat-embed-jasper</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>${easymock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
<version>${hsqldb.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -88,6 +109,8 @@
|
|||
<properties>
|
||||
<start-class>com.baeldung.flips.ApplicationConfig</start-class>
|
||||
<flips-web.version>1.0.1</flips-web.version>
|
||||
<easymock.version>3.6</easymock.version>
|
||||
<hsqldb.version>2.4.0</hsqldb.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -6,13 +6,13 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableWebMvc
|
||||
public class AttributeAnnotationConfiguration implements WebMvcConfigurer {
|
||||
public class AttributeAnnotationConfiguration extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Bean
|
||||
public ViewResolver viewResolver() {
|
|
@ -14,7 +14,7 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
import static org.easymock.EasyMock.*;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
|
@ -1,33 +0,0 @@
|
|||
## Spring General Example Project
|
||||
|
||||
This project is used to replicate Spring Exceptions only.
|
||||
|
||||
### The Course
|
||||
|
||||
The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||
|
||||
### Relevant articles:
|
||||
|
||||
- [Guide to Spring @Autowired](https://www.baeldung.com/spring-autowire)
|
||||
- [Spring Profiles](https://www.baeldung.com/spring-profiles)
|
||||
- [A Spring Custom Annotation for a Better DAO](https://www.baeldung.com/spring-annotation-bean-pre-processor)
|
||||
- [What’s New in Spring 4.3?](https://www.baeldung.com/whats-new-in-spring-4-3)
|
||||
- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring)
|
||||
- [Quick Guide to Spring Controllers](https://www.baeldung.com/spring-controllers)
|
||||
- [Quick Guide to Spring Bean Scopes](https://www.baeldung.com/spring-bean-scopes)
|
||||
- [Introduction To Ehcache](https://www.baeldung.com/ehcache)
|
||||
- [A Guide to the Spring Task Scheduler](https://www.baeldung.com/spring-task-scheduler)
|
||||
- [Guide to Spring Retry](https://www.baeldung.com/spring-retry)
|
||||
- [Custom Scope in Spring](https://www.baeldung.com/spring-custom-scope)
|
||||
- [A CLI with Spring Shell](https://www.baeldung.com/spring-shell-cli)
|
||||
- [JasperReports with Spring](https://www.baeldung.com/spring-jasper)
|
||||
- [Model, ModelMap, and ModelView in Spring MVC](https://www.baeldung.com/spring-mvc-model-model-map-model-view)
|
||||
- [A Guide To Caching in Spring](https://www.baeldung.com/spring-cache-tutorial)
|
||||
- [How To Do @Async in Spring](https://www.baeldung.com/spring-async)
|
||||
- [@Order in Spring](https://www.baeldung.com/spring-order)
|
||||
- [Spring Web Contexts](https://www.baeldung.com/spring-web-contexts)
|
||||
- [Spring Cache – Creating a Custom KeyGenerator](https://www.baeldung.com/spring-cache-custom-keygenerator)
|
||||
- [Spring @Primary Annotation](https://www.baeldung.com/spring-primary)
|
||||
- [Spring Events](https://www.baeldung.com/spring-events)
|
||||
- [Spring Null-Safety Annotations](https://www.baeldung.com/spring-null-safety-annotations)
|
||||
- [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class)
|
|
@ -1,254 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-all</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<name>spring-all</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.shell</groupId>
|
||||
<artifactId>spring-shell</artifactId>
|
||||
<version>${org.springframework.shell.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>${annotation-api.version}</version>
|
||||
</dependency>
|
||||
<!-- aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
</dependency>
|
||||
<!-- persistence -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>${javassist.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
</dependency>
|
||||
<!-- validation -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<!-- web -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- util -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports</artifactId>
|
||||
<version>${jasperreports.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- test scoped -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>${easymock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ShedLock -->
|
||||
<dependency>
|
||||
<groupId>net.javacrumbs.shedlock</groupId>
|
||||
<artifactId>shedlock-spring</artifactId>
|
||||
<version>${shedlock.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.javacrumbs.shedlock</groupId>
|
||||
<artifactId>shedlock-provider-jdbc-template</artifactId>
|
||||
<version>${shedlock.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>spring-all</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spring.profiles.active>dev</spring.profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<spring.profiles.active>prod</spring.profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<properties>
|
||||
<start-class>org.baeldung.sample.App</start-class>
|
||||
<!-- Spring -->
|
||||
<org.springframework.version>5.0.6.RELEASE</org.springframework.version>
|
||||
<org.springframework.shell.version>1.2.0.RELEASE</org.springframework.shell.version>
|
||||
<annotation-api.version>1.3.2</annotation-api.version>
|
||||
<!-- persistence -->
|
||||
<hibernate.version>5.2.5.Final</hibernate.version>
|
||||
|
||||
<!-- util -->
|
||||
<guava.version>25.1-jre</guava.version>
|
||||
<ehcache.version>3.5.2</ehcache.version>
|
||||
<easymock.version>3.6</easymock.version>
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
<jasperreports.version>6.6.0</jasperreports.version>
|
||||
<shedlock.version>2.1.0</shedlock.version>
|
||||
<javassist.version>3.22.0-GA</javassist.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="ship" class="org.baeldung.bean.injection.Ship">
|
||||
<constructor-arg>
|
||||
<ref bean="helm" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="helm" class="org.baeldung.bean.injection.Helm" />
|
||||
|
||||
</beans>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="ship" class="org.baeldung.bean.injection.Ship">
|
||||
<property name="helm">
|
||||
<ref bean="helm" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="helm" class="org.baeldung.bean.injection.Helm" />
|
||||
</beans>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="employeeReport" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
|
||||
<parameter name="idEmployee" class="java.lang.Integer" isForPrompting="false"/>
|
||||
<queryString>
|
||||
<![CDATA[SELECT * FROM EMAIL WHERE ID_EMPLOYEE = $P{idEmployee}]]>
|
||||
</queryString>
|
||||
<field name="ADDRESS" class="java.lang.String"/>
|
||||
<detail>
|
||||
<band height="20" splitType="Stretch">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="156" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression class="java.lang.String"><![CDATA[$F{ADDRESS}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
</jasperReport>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version = "1.0" encoding = "UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
|
||||
<bean id="greeting" class="com.baeldung.contexts.Greeting">
|
||||
<property name="message" value="Hello World !!" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -1,16 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:component-scan base-package="com.baeldung.contexts.normal" />
|
||||
|
||||
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
|
||||
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
|
||||
<property name="prefix" value="/WEB-INF/view/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version = "1.0" encoding = "UTF-8"?>
|
||||
|
||||
<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"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<context:component-scan base-package="com.baeldung.contexts.services" />
|
||||
|
||||
<import resource="greeting.xml" />
|
||||
</beans>
|
|
@ -1,16 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:component-scan base-package="com.baeldung.contexts.secure" />
|
||||
|
||||
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
|
||||
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
|
||||
<property name="prefix" value="/WEB-INF/secure/view/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -1,7 +0,0 @@
|
|||
<html>
|
||||
<head></head>
|
||||
|
||||
<body>
|
||||
<h1>This is the body of the sample view</h1>
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||
<html>
|
||||
<head></head>
|
||||
|
||||
<body>
|
||||
<h1>Bean Scopes Examples</h1>
|
||||
<br> Previous Message: ${previousMessage }
|
||||
<br> Current Message: ${currentMessage }
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Spring Web Contexts</title>
|
||||
</head>
|
||||
<body>
|
||||
<br>
|
||||
<div style="padding: 10px; border-radius: 10px; font-size: 30px; text-align: center;">
|
||||
Normal Web Application : ${message}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,79 +0,0 @@
|
|||
package org.baeldung.caching.test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.baeldung.caching.eviction.service.CachingService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean;
|
||||
import org.springframework.cache.support.SimpleCacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class CacheEvictAnnotationIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
static class ContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public CachingService cachingService() {
|
||||
return new CachingService();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager(){
|
||||
SimpleCacheManager cacheManager = new SimpleCacheManager();
|
||||
List<Cache> caches = new ArrayList<>();
|
||||
caches.add(cacheBean().getObject());
|
||||
cacheManager.setCaches(caches );
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheFactoryBean cacheBean(){
|
||||
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
|
||||
cacheFactoryBean.setName("first");
|
||||
return cacheFactoryBean;
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
CachingService cachingService;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
cachingService.putToCache("first", "key1", "Baeldung");
|
||||
cachingService.putToCache("first", "key2", "Article");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenSingleCacheValueEvictRequested_thenEmptyCacheValue() {
|
||||
cachingService.evictSingleCacheValue("key1");
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
assertThat(key1, is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenAllCacheValueEvictRequested_thenEmptyCache() {
|
||||
cachingService.evictAllCacheValues();
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
String key2 = cachingService.getFromCache("first", "key2");
|
||||
assertThat(key1, is(nullValue()));
|
||||
assertThat(key2, is(nullValue()));
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.model;
|
||||
package org.baeldung.caching.model;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.baeldung.repository;
|
||||
|
||||
import org.baeldung.model.User;
|
||||
import org.baeldung.caching.model.User;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.baeldung.repository;
|
||||
|
||||
import org.baeldung.boot.config.H2JpaConfig;
|
||||
import org.baeldung.model.User;
|
||||
import org.baeldung.caching.model.User;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
### Relevant articles:
|
||||
- [Introduction To Ehcache](http://www.baeldung.com/ehcache)
|
||||
- [A Guide To Caching in Spring](http://www.baeldung.com/spring-cache-tutorial)
|
||||
- [Spring Cache – Creating a Custom KeyGenerator](http://www.baeldung.com/spring-cache-custom-keygenerator)
|
|
@ -0,0 +1,43 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-caching</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<name>spring-caching</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<ehcache.version>3.5.2</ehcache.version>
|
||||
</properties>
|
||||
</project>
|
|
@ -1,18 +1,18 @@
|
|||
package org.baeldung.caching.eviction.controllers;
|
||||
|
||||
import org.baeldung.caching.eviction.service.CachingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class CachingController {
|
||||
|
||||
@Autowired
|
||||
CachingService cachingService;
|
||||
|
||||
@GetMapping("clearAllCaches")
|
||||
public void clearAllCaches() {
|
||||
cachingService.evictAllCaches();
|
||||
}
|
||||
}
|
||||
package org.baeldung.caching.eviction.controllers;
|
||||
|
||||
import org.baeldung.caching.eviction.service.CachingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class CachingController {
|
||||
|
||||
@Autowired
|
||||
CachingService cachingService;
|
||||
|
||||
@GetMapping("clearAllCaches")
|
||||
public void clearAllCaches() {
|
||||
cachingService.evictAllCaches();
|
||||
}
|
||||
}
|
|
@ -1,53 +1,53 @@
|
|||
package org.baeldung.caching.eviction.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CachingService {
|
||||
|
||||
@Autowired
|
||||
CacheManager cacheManager;
|
||||
|
||||
public void putToCache(String cacheName, String key, String value) {
|
||||
cacheManager.getCache(cacheName).put(key, value);
|
||||
}
|
||||
|
||||
public String getFromCache(String cacheName, String key) {
|
||||
String value = null;
|
||||
if (cacheManager.getCache(cacheName).get(key) != null) {
|
||||
value = cacheManager.getCache(cacheName).get(key).get().toString();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@CacheEvict(value = "first", key = "#cacheKey")
|
||||
public void evictSingleCacheValue(String cacheKey) {
|
||||
}
|
||||
|
||||
@CacheEvict(value = "first", allEntries = true)
|
||||
public void evictAllCacheValues() {
|
||||
}
|
||||
|
||||
public void evictSingleCacheValue(String cacheName, String cacheKey) {
|
||||
cacheManager.getCache(cacheName).evict(cacheKey);
|
||||
}
|
||||
|
||||
public void evictAllCacheValues(String cacheName) {
|
||||
cacheManager.getCache(cacheName).clear();
|
||||
}
|
||||
|
||||
public void evictAllCaches() {
|
||||
cacheManager.getCacheNames()
|
||||
.parallelStream()
|
||||
.forEach(cacheName -> cacheManager.getCache(cacheName).clear());
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 6000)
|
||||
public void evictAllcachesAtIntervals() {
|
||||
evictAllCaches();
|
||||
}
|
||||
}
|
||||
package org.baeldung.caching.eviction.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CachingService {
|
||||
|
||||
@Autowired
|
||||
CacheManager cacheManager;
|
||||
|
||||
public void putToCache(String cacheName, String key, String value) {
|
||||
cacheManager.getCache(cacheName).put(key, value);
|
||||
}
|
||||
|
||||
public String getFromCache(String cacheName, String key) {
|
||||
String value = null;
|
||||
if (cacheManager.getCache(cacheName).get(key) != null) {
|
||||
value = cacheManager.getCache(cacheName).get(key).get().toString();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@CacheEvict(value = "first", key = "#cacheKey")
|
||||
public void evictSingleCacheValue(String cacheKey) {
|
||||
}
|
||||
|
||||
@CacheEvict(value = "first", allEntries = true)
|
||||
public void evictAllCacheValues() {
|
||||
}
|
||||
|
||||
public void evictSingleCacheValue(String cacheName, String cacheKey) {
|
||||
cacheManager.getCache(cacheName).evict(cacheKey);
|
||||
}
|
||||
|
||||
public void evictAllCacheValues(String cacheName) {
|
||||
cacheManager.getCache(cacheName).clear();
|
||||
}
|
||||
|
||||
public void evictAllCaches() {
|
||||
cacheManager.getCacheNames()
|
||||
.parallelStream()
|
||||
.forEach(cacheName -> cacheManager.getCache(cacheName).clear());
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 6000)
|
||||
public void evictAllcachesAtIntervals() {
|
||||
evictAllCaches();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package org.baeldung.caching.example;
|
||||
|
||||
import org.baeldung.model.Book;
|
||||
import org.baeldung.caching.model.Book;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.model;
|
||||
package org.baeldung.caching.model;
|
||||
|
||||
public class Book {
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package org.baeldung.caching.test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.baeldung.caching.eviction.service.CachingService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean;
|
||||
import org.springframework.cache.support.SimpleCacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class CacheEvictAnnotationIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
static class ContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public CachingService cachingService() {
|
||||
return new CachingService();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager() {
|
||||
SimpleCacheManager cacheManager = new SimpleCacheManager();
|
||||
List<Cache> caches = new ArrayList<>();
|
||||
caches.add(cacheBean().getObject());
|
||||
cacheManager.setCaches(caches);
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheFactoryBean cacheBean() {
|
||||
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
|
||||
cacheFactoryBean.setName("first");
|
||||
return cacheFactoryBean;
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
CachingService cachingService;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
cachingService.putToCache("first", "key1", "Baeldung");
|
||||
cachingService.putToCache("first", "key2", "Article");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenSingleCacheValueEvictRequested_thenEmptyCacheValue() {
|
||||
cachingService.evictSingleCacheValue("key1");
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
assertThat(key1, is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenAllCacheValueEvictRequested_thenEmptyCache() {
|
||||
cachingService.evictAllCacheValues();
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
String key2 = cachingService.getFromCache("first", "key2");
|
||||
assertThat(key1, is(nullValue()));
|
||||
assertThat(key2, is(nullValue()));
|
||||
}
|
||||
}
|
|
@ -1,96 +1,96 @@
|
|||
package org.baeldung.caching.test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.baeldung.caching.eviction.service.CachingService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean;
|
||||
import org.springframework.cache.support.SimpleCacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class CacheManagerEvictIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
static class ContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public CachingService cachingService() {
|
||||
return new CachingService();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager(){
|
||||
SimpleCacheManager cacheManager = new SimpleCacheManager();
|
||||
List<Cache> caches = new ArrayList<>();
|
||||
caches.add(cacheBeanFirst().getObject());
|
||||
caches.add(cacheBeanSecond().getObject());
|
||||
cacheManager.setCaches(caches );
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheFactoryBean cacheBeanFirst(){
|
||||
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
|
||||
cacheFactoryBean.setName("first");
|
||||
return cacheFactoryBean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheFactoryBean cacheBeanSecond(){
|
||||
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
|
||||
cacheFactoryBean.setName("second");
|
||||
return cacheFactoryBean;
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
CachingService cachingService;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
cachingService.putToCache("first", "key1", "Baeldung");
|
||||
cachingService.putToCache("first", "key2", "Article");
|
||||
cachingService.putToCache("second", "key", "Article");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenSingleCacheValueEvictRequested_thenEmptyCacheValue() {
|
||||
cachingService.evictSingleCacheValue("first", "key1");
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
assertThat(key1, is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenAllCacheValueEvictRequested_thenEmptyCache() {
|
||||
cachingService.evictAllCacheValues("first");
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
String key2 = cachingService.getFromCache("first", "key2");
|
||||
assertThat(key1, is(nullValue()));
|
||||
assertThat(key2, is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAllCaches_whenAllCacheEvictRequested_thenEmptyAllCaches() {
|
||||
cachingService.evictAllCaches();
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
assertThat(key1, is(nullValue()));
|
||||
|
||||
String key = cachingService.getFromCache("second", "key");
|
||||
assertThat(key, is(nullValue()));
|
||||
}
|
||||
}
|
||||
package org.baeldung.caching.test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.baeldung.caching.eviction.service.CachingService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean;
|
||||
import org.springframework.cache.support.SimpleCacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
public class CacheManagerEvictIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
static class ContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public CachingService cachingService() {
|
||||
return new CachingService();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager() {
|
||||
SimpleCacheManager cacheManager = new SimpleCacheManager();
|
||||
List<Cache> caches = new ArrayList<>();
|
||||
caches.add(cacheBeanFirst().getObject());
|
||||
caches.add(cacheBeanSecond().getObject());
|
||||
cacheManager.setCaches(caches);
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheFactoryBean cacheBeanFirst() {
|
||||
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
|
||||
cacheFactoryBean.setName("first");
|
||||
return cacheFactoryBean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheFactoryBean cacheBeanSecond() {
|
||||
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
|
||||
cacheFactoryBean.setName("second");
|
||||
return cacheFactoryBean;
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
CachingService cachingService;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
cachingService.putToCache("first", "key1", "Baeldung");
|
||||
cachingService.putToCache("first", "key2", "Article");
|
||||
cachingService.putToCache("second", "key", "Article");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenSingleCacheValueEvictRequested_thenEmptyCacheValue() {
|
||||
cachingService.evictSingleCacheValue("first", "key1");
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
assertThat(key1, is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstCache_whenAllCacheValueEvictRequested_thenEmptyCache() {
|
||||
cachingService.evictAllCacheValues("first");
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
String key2 = cachingService.getFromCache("first", "key2");
|
||||
assertThat(key1, is(nullValue()));
|
||||
assertThat(key2, is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAllCaches_whenAllCacheEvictRequested_thenEmptyAllCaches() {
|
||||
cachingService.evictAllCaches();
|
||||
String key1 = cachingService.getFromCache("first", "key1");
|
||||
assertThat(key1, is(nullValue()));
|
||||
|
||||
String key = cachingService.getFromCache("second", "key");
|
||||
assertThat(key, is(nullValue()));
|
||||
}
|
||||
}
|
|
@ -1,40 +1,40 @@
|
|||
package org.baeldung.ehcache;
|
||||
|
||||
import org.baeldung.ehcache.calculator.SquaredCalculator;
|
||||
import org.baeldung.ehcache.config.CacheHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SquareCalculatorUnitTest {
|
||||
private SquaredCalculator squaredCalculator = new SquaredCalculator();
|
||||
private CacheHelper cacheHelper = new CacheHelper();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
squaredCalculator.setCache(cacheHelper);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCalculatingSquareValueOnce_thenCacheDontHaveValues() {
|
||||
for (int i = 10; i < 15; i++) {
|
||||
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||
System.out.println("Square value of " + i + " is: " + squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCalculatingSquareValueAgain_thenCacheHasAllValues() {
|
||||
for (int i = 10; i < 15; i++) {
|
||||
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||
System.out.println("Square value of " + i + " is: " + squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||
}
|
||||
|
||||
for (int i = 10; i < 15; i++) {
|
||||
assertTrue(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||
System.out.println("Square value of " + i + " is: " + squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
package org.baeldung.ehcache;
|
||||
|
||||
import org.baeldung.ehcache.calculator.SquaredCalculator;
|
||||
import org.baeldung.ehcache.config.CacheHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SquareCalculatorUnitTest {
|
||||
private SquaredCalculator squaredCalculator = new SquaredCalculator();
|
||||
private CacheHelper cacheHelper = new CacheHelper();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
squaredCalculator.setCache(cacheHelper);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCalculatingSquareValueOnce_thenCacheDontHaveValues() {
|
||||
for (int i = 10; i < 15; i++) {
|
||||
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||
System.out.println("Square value of " + i + " is: " + squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCalculatingSquareValueAgain_thenCacheHasAllValues() {
|
||||
for (int i = 10; i < 15; i++) {
|
||||
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||
System.out.println("Square value of " + i + " is: " + squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||
}
|
||||
|
||||
for (int i = 10; i < 15; i++) {
|
||||
assertTrue(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||
System.out.println("Square value of " + i + " is: " + squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,8 +4,15 @@ This module contains articles about core Spring functionality
|
|||
|
||||
## Relevant Articles:
|
||||
|
||||
- [Understanding getBean() in Spring](https://www.baeldung.com/spring-getbean)
|
||||
- [Exploring the Spring BeanFactory API](https://www.baeldung.com/spring-beanfactory)
|
||||
- [How to use the Spring FactoryBean?](https://www.baeldung.com/spring-factorybean)
|
||||
- [Spring – Injecting Collections](https://www.baeldung.com/spring-injecting-collections)
|
||||
- More articles: [[<-- prev]](/spring-core)
|
||||
- [Guide to Spring @Autowired](http://www.baeldung.com/spring-autowire)
|
||||
- [Spring Profiles](http://www.baeldung.com/spring-profiles)
|
||||
- [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor)
|
||||
- [Running Setup Data on Startup in Spring](http://www.baeldung.com/running-setup-logic-on-startup-in-spring)
|
||||
- [Quick Guide to Spring Bean Scopes](http://www.baeldung.com/spring-bean-scopes)
|
||||
- [Custom Scope in Spring](http://www.baeldung.com/spring-custom-scope)
|
||||
- [@Order in Spring](http://www.baeldung.com/spring-order)
|
||||
- [Spring @Primary Annotation](http://www.baeldung.com/spring-primary)
|
||||
- [Spring Events](https://www.baeldung.com/spring-events)
|
||||
- [Spring Null-Safety Annotations](https://www.baeldung.com/spring-null-safety-annotations)
|
||||
- [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class)
|
||||
- More articles: [[<-- prev]](/spring-core)
|
|
@ -1,65 +1,217 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-core-2</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<name>spring-core-2</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-spring-5</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-spring-5</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<artifactId>spring-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-jupiter.version}</version>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>${annotation-api.version}</version>
|
||||
</dependency>
|
||||
<!-- aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
</dependency>
|
||||
<!-- persistence -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>${javassist.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
</dependency>
|
||||
<!-- validation -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
<!-- web -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- util -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<!-- test scoped -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit-jupiter.version}</version>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- ShedLock -->
|
||||
<dependency>
|
||||
<groupId>net.javacrumbs.shedlock</groupId>
|
||||
<artifactId>shedlock-spring</artifactId>
|
||||
<version>${shedlock.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.javacrumbs.shedlock</groupId>
|
||||
<artifactId>shedlock-provider-jdbc-template</artifactId>
|
||||
<version>${shedlock.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>spring-all</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.version}</version>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spring.profiles.active>dev</spring.profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<spring.profiles.active>prod</spring.profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<properties>
|
||||
<maven.surefire.version>2.22.1</maven.surefire.version>
|
||||
<start-class>org.baeldung.sample.App</start-class>
|
||||
<!-- Spring -->
|
||||
<org.springframework.version>5.0.6.RELEASE</org.springframework.version>
|
||||
<annotation-api.version>1.3.2</annotation-api.version>
|
||||
<!-- persistence -->
|
||||
<hibernate.version>5.2.5.Final</hibernate.version>
|
||||
|
||||
<!-- util -->
|
||||
<guava.version>25.1-jre</guava.version>
|
||||
<easymock.version>3.6</easymock.version>
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
<shedlock.version>2.1.0</shedlock.version>
|
||||
<javassist.version>3.22.0-GA</javassist.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue