Merge pull request #7970 from den314/master

BAEL-3155 splitting up spring-all module
This commit is contained in:
Josh Cummings 2019-10-09 10:14:17 -06:00 committed by GitHub
commit 804384fe3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
314 changed files with 1305 additions and 1036 deletions

1
.gitignore vendored
View File

@ -84,3 +84,4 @@ software-security/sql-injection-samples/derby.log
spring-soap/src/main/java/com/baeldung/springsoap/gen/
/report-*.json
transaction.log
*-shell.log

View File

@ -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)

View File

@ -112,6 +112,32 @@
<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>
@ -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>

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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>

View File

@ -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>

View File

@ -1,5 +1,9 @@
<?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>
@ -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>

View File

@ -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>

View File

@ -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)
- [Whats New in Spring 4.3?](https://www.baeldung.com/whats-new-in-spring-4-3)

View File

@ -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>

View File

@ -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() {

View File

@ -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

View File

@ -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)
- [Whats 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)

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -1,7 +0,0 @@
<html>
<head></head>
<body>
<h1>This is the body of the sample view</h1>
</body>
</html>

View File

@ -1,10 +0,0 @@
<html>
<head></head>
<body>
<h1>Bean Scopes Examples</h1>
<br> Previous Message: ${previousMessage }
<br> Current Message: ${currentMessage }
<br>
</body>
</html>

View File

@ -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>

View File

@ -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()));
}
}

View File

@ -1,4 +1,4 @@
package org.baeldung.model;
package org.baeldung.caching.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;

View File

@ -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;

View File

@ -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;

4
spring-caching/README.md Normal file
View File

@ -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)

43
spring-caching/pom.xml Normal file
View File

@ -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>

View File

@ -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;

View File

@ -1,4 +1,4 @@
package org.baeldung.model;
package org.baeldung.caching.model;
public class Book {

View File

@ -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()));
}
}

View File

@ -34,24 +34,24 @@ public class CacheManagerEvictIntegrationTest {
}
@Bean
public CacheManager cacheManager(){
public CacheManager cacheManager() {
SimpleCacheManager cacheManager = new SimpleCacheManager();
List<Cache> caches = new ArrayList<>();
caches.add(cacheBeanFirst().getObject());
caches.add(cacheBeanSecond().getObject());
cacheManager.setCaches(caches );
cacheManager.setCaches(caches);
return cacheManager;
}
@Bean
public ConcurrentMapCacheFactoryBean cacheBeanFirst(){
public ConcurrentMapCacheFactoryBean cacheBeanFirst() {
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
cacheFactoryBean.setName("first");
return cacheFactoryBean;
}
@Bean
public ConcurrentMapCacheFactoryBean cacheBeanSecond(){
public ConcurrentMapCacheFactoryBean cacheBeanSecond() {
ConcurrentMapCacheFactoryBean cacheFactoryBean = new ConcurrentMapCacheFactoryBean();
cacheFactoryBean.setName("second");
return cacheFactoryBean;

View File

@ -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)
- [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)

View File

@ -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-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>
<!-- 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>
<!-- 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>${spring.version}</version>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
<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>

Some files were not shown because too many files have changed in this diff Show More