Fix broken merge

This commit is contained in:
coach88 2015-07-31 13:15:52 +03:00
parent 7ad6ba42a4
commit a292a07cfc
132 changed files with 5257 additions and 5326 deletions

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-rest</artifactId> <artifactId>spring-rest</artifactId>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>core-java</artifactId> <artifactId>core-java</artifactId>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,44 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
>
<http use-expressions="true"> <http use-expressions="true">
<intercept-url pattern="/login*" access="permitAll" /> <intercept-url pattern="/login*" access="permitAll"/>
<intercept-url pattern="/logout*" access="permitAll" /> <intercept-url pattern="/logout*" access="permitAll"/>
<intercept-url pattern="/home*" access="permitAll" /> <intercept-url pattern="/home*" access="permitAll"/>
<intercept-url pattern="/files/**" access="permitAll" /> <intercept-url pattern="/files/**" access="permitAll"/>
<intercept-url pattern="/resources/**" access="permitAll" /> <intercept-url pattern="/resources/**" access="permitAll"/>
<intercept-url pattern="/js/**" access="permitAll" /> <intercept-url pattern="/js/**" access="permitAll"/>
<intercept-url pattern="/other-files/**" access="permitAll" /> <intercept-url pattern="/other-files/**" access="permitAll"/>
<intercept-url pattern="/invalidSession*" access="isAnonymous()" /> <intercept-url pattern="/invalidSession*" access="isAnonymous()"/>
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="isAuthenticated()"/>
<form-login login-page='/login.html' <form-login login-page='/login.html' authentication-failure-url="/login.html?error=true" authentication-success-handler-ref="myAuthenticationSuccessHandler"
authentication-failure-url="/login.html?error=true" default-target-url="home.html"/>
authentication-success-handler-ref="myAuthenticationSuccessHandler" <session-management invalid-session-url="/invalidSession.html" session-fixation-protection="none"/>
default-target-url="home.html" /> <logout invalidate-session="false" logout-success-url="/logout.html?logSucc=true" logout-url="/j_spring_security_logout" delete-cookies="JSESSIONID"/>
<session-management invalid-session-url="/invalidSession.html"
session-fixation-protection="none" />
<logout invalidate-session="false" logout-success-url="/logout.html?logSucc=true"
logout-url="/j_spring_security_logout" delete-cookies="JSESSIONID" />
</http> </http>
<!-- for XML static resource confguration- comment out for java based config --> <!-- for XML static resource confguration- comment out for java based config -->
<!-- -<mvc:resources mapping="/resources/**" location="/resources/" /> --> <!-- -<mvc:resources mapping="/resources/**" location="/resources/" /> -->
<beans:bean id="myAuthenticationSuccessHandler" <beans:bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler"/>
class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler" />
<authentication-manager> <authentication-manager>
<authentication-provider> <authentication-provider>
<user-service> <user-service>
<user name="user1" password="user1Pass" authorities="ROLE_USER" /> <user name="user1" password="user1Pass" authorities="ROLE_USER"/>
<user name="admin1" password="admin1Pass" authorities="ROLE_ADMIN" /> <user name="admin1" password="admin1Pass" authorities="ROLE_ADMIN"/>
</user-service> </user-service>
</authentication-provider> </authentication-provider>
</authentication-manager> </authentication-manager>

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >
version="2.5">
<context-param> <context-param>
<param-name>contextClass</param-name> <param-name>contextClass</param-name>

View File

@ -35,11 +35,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- <dependency> -->
<!-- <groupId>org.apache.httpcomponents</groupId> -->
<!-- <artifactId>httpcore</artifactId> -->
<!-- <version>${httpcore.version}</version> -->
<!-- </dependency> -->
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>jackson</artifactId> <artifactId>jackson</artifactId>

View File

@ -3,7 +3,6 @@ package org.baeldung.jackson.annotation;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class BeanWithCreator { public class BeanWithCreator {
public int id; public int id;
public String name; public String name;

View File

@ -16,12 +16,8 @@ public class Zoo {
this.animal = animal; this.animal = animal;
} }
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "type") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "type")
@JsonSubTypes({ @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "dog"), @JsonSubTypes.Type(value = Cat.class, name = "cat") })
@JsonSubTypes.Type(value = Dog.class, name = "dog"),
@JsonSubTypes.Type(value = Cat.class, name = "cat")
})
public static class Animal { public static class Animal {
public String name; public String name;

View File

@ -49,7 +49,6 @@ import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
public class JacksonAnnotationTest { public class JacksonAnnotationTest {
@Test @Test

View File

@ -66,7 +66,7 @@ public class JacksonDeserializationUnitTest {
@Test @Test
public final void givenJsonHasUnknownValuesButJacksonIsIgnoringUnknownFields_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException { public final void givenJsonHasUnknownValuesButJacksonIsIgnoringUnknownFields_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException {
final String jsonAsString =// @formatter:off final String jsonAsString = // @formatter:off
"{\"stringValue\":\"a\"," + "{\"stringValue\":\"a\"," +
"\"intValue\":1," + "\"intValue\":1," +
"\"booleanValue\":true," + "\"booleanValue\":true," +
@ -84,7 +84,7 @@ public class JacksonDeserializationUnitTest {
@Test @Test
public final void givenJsonHasUnknownValuesButUnknownFieldsAreIgnoredOnClass_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException { public final void givenJsonHasUnknownValuesButUnknownFieldsAreIgnoredOnClass_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException {
final String jsonAsString =// @formatter:off final String jsonAsString = // @formatter:off
"{\"stringValue\":\"a\"," + "{\"stringValue\":\"a\"," +
"\"intValue\":1," + "\"intValue\":1," +
"\"booleanValue\":true," + "\"booleanValue\":true," +

View File

@ -6,7 +6,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({// @formatter:off @Suite.SuiteClasses({ // @formatter:off
JacksonCollectionDeserializationUnitTest.class JacksonCollectionDeserializationUnitTest.class
,JacksonSerializationEnumsUnitTest.class ,JacksonSerializationEnumsUnitTest.class
,JacksonDeserializationUnitTest.class ,JacksonDeserializationUnitTest.class

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>mockito</artifactId> <artifactId>mockito</artifactId>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>
@ -36,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -30,7 +30,7 @@
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>

View File

@ -69,6 +69,7 @@
<artifactId>hsqldb</artifactId> <artifactId>hsqldb</artifactId>
<version>2.3.2</version> <version>2.3.2</version>
</dependency> </dependency>
<!-- validation --> <!-- validation -->
<dependency> <dependency>

View File

@ -1,21 +1,20 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
"> "
>
<cache:annotation-driven /> <cache:annotation-driven/>
<context:annotation-config /> <context:annotation-config/>
<bean class="org.baeldung.caching.config.MyAppConfig" /> <bean class="org.baeldung.caching.config.MyAppConfig"/>
<!-- the service that you wish to make cacheable. --> <!-- the service that you wish to make cacheable. -->
<bean id="customerDataService" class="org.baeldung.caching.example.CustomerDataService" /> <bean id="customerDataService" class="org.baeldung.caching.example.CustomerDataService"/>
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager"> <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches"> <property name="caches">
@ -30,16 +29,14 @@
<!-- define caching behavior --> <!-- define caching behavior -->
<cache:advice id="cachingBehavior" cache-manager="cacheManager"> <cache:advice id="cachingBehavior" cache-manager="cacheManager">
<cache:caching cache="addresses"> <cache:caching cache="addresses">
<cache:cacheable method="getAddress" key="#customer.name" /> <cache:cacheable method="getAddress" key="#customer.name"/>
</cache:caching> </cache:caching>
</cache:advice> </cache:advice>
<!-- apply the behavior to all the implementations of CustomerDataService <!-- apply the behavior to all the implementations of CustomerDataService interface -->
interface -->
<aop:config> <aop:config>
<aop:advisor advice-ref="cachingBehavior" <aop:advisor advice-ref="cachingBehavior" pointcut="execution(* org.baeldung.caching.example.CustomerDataService.*(..))"/>
pointcut="execution(* org.baeldung.caching.example.CustomerDataService.*(..))" />
</aop:config> </aop:config>
</beans> </beans>

View File

@ -4,12 +4,13 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:foo.properties" /> <context:property-placeholder location="classpath:foo.properties"/>
<bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties"> <bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties">
<constructor-arg value="${key.something}" /> <constructor-arg value="${key.something}"/>
</bean> </bean>
</beans> </beans>

View File

@ -4,12 +4,13 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:foo.properties" ignore-unresolvable="true" order="1" /> <context:property-placeholder location="classpath:foo.properties" ignore-unresolvable="true" order="1"/>
<bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties"> <bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties">
<constructor-arg value="${key.something2}" /> <constructor-arg value="${key.something2}"/>
</bean> </bean>
</beans> </beans>

View File

@ -4,7 +4,8 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:bar.properties" order="2"/> <context:property-placeholder location="classpath:bar.properties" order="2"/>

View File

@ -1,20 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns: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-4.1.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<bean id="employeeDao" class="org.baeldung.jdbc.EmployeeDAO"> <bean id="employeeDao" class="org.baeldung.jdbc.EmployeeDAO">
<property name="dataSource" ref="dataSource" /> <property name="dataSource" ref="dataSource"/>
</bean> </bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}"/>
<property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}"/>
<property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}"/>
<property name="password" value="${jdbc.password}" />
</bean> </bean>
<context:property-placeholder location="jdbc.properties" /> <context:property-placeholder location="jdbc.properties"/>
</beans> </beans>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<task:annotation-driven executor="myExecutor" /> <task:annotation-driven executor="myExecutor"/>
<task:executor id="myExecutor" pool-size="5" /> <task:executor id="myExecutor" pool-size="5"/>
<bean id="asyncAnnotationExample" class="org.baeldung.async.AsyncAnnotationExample" /> <bean id="asyncAnnotationExample" class="org.baeldung.async.AsyncAnnotationExample"/>
</beans> </beans>

View File

@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns: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-4.1.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<beans profile="dev"> <beans profile="dev">
<bean id="devDatasourceConfig" class="org.baeldung.profiles.DevDatasourceConfig" /> <bean id="devDatasourceConfig" class="org.baeldung.profiles.DevDatasourceConfig"/>
</beans> </beans>
<beans profile="production"> <beans profile="production">
<bean id="productionDatasourceConfig" class="org.baeldung.profiles.ProductionDatasourceConfig" /> <bean id="productionDatasourceConfig" class="org.baeldung.profiles.ProductionDatasourceConfig"/>
</beans> </beans>
</beans> </beans>

View File

@ -1,26 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:springScheduled.properties" /> <context:property-placeholder location="classpath:springScheduled.properties"/>
<!-- Configure the scheduler --> <!-- Configure the scheduler -->
<task:scheduler id="myScheduler" pool-size="10" /> <task:scheduler id="myScheduler" pool-size="10"/>
<bean id="myscheduler" <bean id="myscheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"/>
class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler" />
<!-- Configure the fixedDealy, fixedRate or cron based schduled tasks --> <!-- Configure the fixedDealy, fixedRate or cron based schduled tasks -->
<bean id="schedulingWithXmlConfig" class="org.baeldung.scheduling.SchedulingWithXmlConfig" /> <bean id="schedulingWithXmlConfig" class="org.baeldung.scheduling.SchedulingWithXmlConfig"/>
<task:scheduled-tasks scheduler="myScheduler"> <task:scheduled-tasks scheduler="myScheduler">
<task:scheduled ref="schedulingWithXmlConfig" method="scheduleFixedDelayTask" fixed-delay="${fixedDelay.in.milliseconds}" initial-delay="1000" /> <task:scheduled ref="schedulingWithXmlConfig" method="scheduleFixedDelayTask" fixed-delay="${fixedDelay.in.milliseconds}" initial-delay="1000"/>
<task:scheduled ref="schedulingWithXmlConfig" method="scheduleFixedRateTask" fixed-rate="${fixedRate.in.milliseconds}" /> <task:scheduled ref="schedulingWithXmlConfig" method="scheduleFixedRateTask" fixed-rate="${fixedRate.in.milliseconds}"/>
<task:scheduled ref="schedulingWithXmlConfig" method="scheduleTaskUsingCronExpression" cron="${cron.expression}" /> <task:scheduled ref="schedulingWithXmlConfig" method="scheduleTaskUsingCronExpression" cron="${cron.expression}"/>
</task:scheduled-tasks> </task:scheduled-tasks>
</beans> </beans>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>

View File

@ -11,7 +11,6 @@ public class ChildValueHolder {
@Value("${child.name:-}") @Value("${child.name:-}")
private String childName; private String childName;
public String getParentName() { public String getParentName() {
return parentName; return parentName;
} }

View File

@ -11,7 +11,6 @@ public class ParentValueHolder {
@Value("${child.name:-}") @Value("${child.name:-}")
private String childName; private String childName;
public String getParentName() { public String getParentName() {
return parentName; return parentName;
} }

View File

@ -11,7 +11,7 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses; import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class) @RunWith(Suite.class)
@SuiteClasses({//@formatter:off @SuiteClasses({ //@formatter:off
PropertiesWithXmlIntegrationTest.class, PropertiesWithXmlIntegrationTest.class,
ExternalPropertiesWithJavaIntegrationTest.class, ExternalPropertiesWithJavaIntegrationTest.class,
ExternalPropertiesWithMultipleXmlsIntegrationTest.class, ExternalPropertiesWithMultipleXmlsIntegrationTest.class,

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-boot</artifactId> <artifactId>spring-boot</artifactId>
@ -19,24 +18,8 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<!-- <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions> -->
</dependency> </dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency> -->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency> -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>

View File

@ -11,7 +11,7 @@ public class MyCustomErrorController implements ErrorController {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
@RequestMapping(value=PATH) @RequestMapping(value = PATH)
public String error() { public String error() {
return "Error heaven"; return "Error heaven";
} }

View File

@ -20,8 +20,7 @@ public class ExecutorServiceExitCodeGenerator implements ExitCodeGenerator {
executorService.shutdownNow(); executorService.shutdownNow();
returnCode = 1; returnCode = 1;
} }
} } catch (SecurityException ex) {
catch (SecurityException ex) {
returnCode = 0; returnCode = 0;
} }
return returnCode; return returnCode;

View File

@ -22,8 +22,7 @@ public class HelloWorldServlet extends HttpServlet {
out = response.getWriter(); out = response.getWriter();
out.println("HelloWorldServlet: GET METHOD"); out.println("HelloWorldServlet: GET METHOD");
out.flush(); out.flush();
} } finally {
finally {
if (!Objects.isNull(out)) if (!Objects.isNull(out))
out.close(); out.close();
} }
@ -35,8 +34,7 @@ public class HelloWorldServlet extends HttpServlet {
out = response.getWriter(); out = response.getWriter();
out.println("HelloWorldServlet: POST METHOD"); out.println("HelloWorldServlet: POST METHOD");
out.flush(); out.flush();
} } finally {
finally {
if (!Objects.isNull(out)) if (!Objects.isNull(out))
out.close(); out.close();
} }

View File

@ -22,8 +22,7 @@ public class SpringHelloWorldServlet extends HttpServlet {
out = response.getWriter(); out = response.getWriter();
out.println("SpringHelloWorldServlet: GET METHOD"); out.println("SpringHelloWorldServlet: GET METHOD");
out.flush(); out.flush();
} } finally {
finally {
if (!Objects.isNull(out)) if (!Objects.isNull(out))
out.close(); out.close();
} }
@ -35,8 +34,7 @@ public class SpringHelloWorldServlet extends HttpServlet {
out = response.getWriter(); out = response.getWriter();
out.println("SpringHelloWorldServlet: POST METHOD"); out.println("SpringHelloWorldServlet: POST METHOD");
out.flush(); out.flush();
} } finally {
finally {
if (!Objects.isNull(out)) if (!Objects.isNull(out))
out.close(); out.close();
} }

View File

@ -19,9 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@EnableAutoConfiguration @EnableAutoConfiguration
@ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller", @ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller", "org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints", "org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.service" })
"org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints",
"org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.service"})
public class SpringBootApplication { public class SpringBootApplication {
private static ApplicationContext applicationContext; private static ApplicationContext applicationContext;
@ -57,7 +55,7 @@ public class SpringBootApplication {
return bean; return bean;
} }
/* @Bean /* @Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() { public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
JettyEmbeddedServletContainerFactory jettyContainer = new JettyEmbeddedServletContainerFactory(); JettyEmbeddedServletContainerFactory jettyContainer = new JettyEmbeddedServletContainerFactory();
jettyContainer.setPort(9000); jettyContainer.setPort(9000);

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-exceptions</artifactId> <artifactId>spring-exceptions</artifactId>

View File

@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class ChildDao extends AbstractHibernateDao<Child> implements IChildDao { public class ChildDao extends AbstractHibernateDao<Child>implements IChildDao {
@Autowired @Autowired
private SessionFactory sessionFactory; private SessionFactory sessionFactory;

View File

@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class FooDao extends AbstractHibernateDao<Foo> implements IFooDao { public class FooDao extends AbstractHibernateDao<Foo>implements IFooDao {
@Autowired @Autowired
private SessionFactory sessionFactory; private SessionFactory sessionFactory;

View File

@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class ParentDao extends AbstractHibernateDao<Parent> implements IParentDao { public class ParentDao extends AbstractHibernateDao<Parent>implements IParentDao {
@Autowired @Autowired
private SessionFactory sessionFactory; private SessionFactory sessionFactory;

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ChildService extends AbstractService<Child> implements IChildService { public class ChildService extends AbstractService<Child>implements IChildService {
@Autowired @Autowired
private IChildDao dao; private IChildDao dao;

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class FooService extends AbstractService<Foo> implements IFooService { public class FooService extends AbstractService<Foo>implements IFooService {
@Autowired @Autowired
private IFooDao dao; private IFooDao dao;

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ParentService extends AbstractService<Parent> implements IParentService { public class ParentService extends AbstractService<Parent>implements IParentService {
@Autowired @Autowired
private IParentDao dao; private IParentDao dao;

View File

@ -4,12 +4,13 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:foo.properties" /> <context:property-placeholder location="classpath:foo.properties"/>
<bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties"> <bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties">
<constructor-arg value="${key.something}" /> <constructor-arg value="${key.something}"/>
</bean> </bean>
</beans> </beans>

View File

@ -4,12 +4,13 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:foo.properties" ignore-unresolvable="true" order="1" /> <context:property-placeholder location="classpath:foo.properties" ignore-unresolvable="true" order="1"/>
<bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties"> <bean id="componentInXmlUsingProperties" class="org.baeldung.properties.core.ComponentInXmlUsingProperties">
<constructor-arg value="${key.something2}" /> <constructor-arg value="${key.something2}"/>
</bean> </bean>
</beans> </beans>

View File

@ -4,7 +4,8 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:bar.properties" order="2"/> <context:property-placeholder location="classpath:bar.properties" order="2"/>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>

View File

@ -4,7 +4,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({// @formatter:off @Suite.SuiteClasses({ // @formatter:off
Cause1BeanCreationExceptionIntegrationTest.class Cause1BeanCreationExceptionIntegrationTest.class
,Cause2BeanCreationExceptionIntegrationTest.class ,Cause2BeanCreationExceptionIntegrationTest.class
,Cause3BeanCreationExceptionIntegrationTest.class ,Cause3BeanCreationExceptionIntegrationTest.class

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-hibernate3</artifactId> <artifactId>spring-hibernate3</artifactId>

View File

@ -4,7 +4,7 @@ import org.baeldung.persistence.model.Foo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class FooDao extends AbstractHibernateDao<Foo> implements IFooDao { public class FooDao extends AbstractHibernateDao<Foo>implements IFooDao {
public FooDao() { public FooDao() {
super(); super();

View File

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:persistence-mysql.properties" /> <context:property-placeholder location="classpath:persistence-mysql.properties"/>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" /> <property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="org.baeldung.persistence.model" /> <property name="packagesToScan" value="org.baeldung.persistence.model"/>
<property name="hibernateProperties"> <property name="hibernateProperties">
<props> <props>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
@ -20,16 +19,16 @@
</bean> </bean>
<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource"> <bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}" /> <property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.user}" /> <property name="username" value="${jdbc.user}"/>
<property name="password" value="${jdbc.pass}" /> <property name="password" value="${jdbc.pass}"/>
</bean> </bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" /> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
<bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> <bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
</beans> </beans>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
>
<display-name>Spring Hibernate 3 Application</display-name> <display-name>Spring Hibernate 3 Application</display-name>
<context-param> <context-param>
<param-name>contextClass</param-name> <param-name>contextClass</param-name>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-hibernate4</artifactId> <artifactId>spring-hibernate4</artifactId>

View File

@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
@Scope(BeanDefinition.SCOPE_PROTOTYPE) @Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class GenericHibernateDao<T extends Serializable> extends AbstractHibernateDao<T> implements IGenericDao<T> { public class GenericHibernateDao<T extends Serializable> extends AbstractHibernateDao<T>implements IGenericDao<T> {
// //
} }

View File

@ -6,7 +6,7 @@ import org.baeldung.persistence.model.Child;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class ChildDao extends AbstractHibernateDao<Child> implements IChildDao { public class ChildDao extends AbstractHibernateDao<Child>implements IChildDao {
public ChildDao() { public ChildDao() {
super(); super();

View File

@ -6,7 +6,7 @@ import org.baeldung.persistence.model.Foo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class FooDao extends AbstractHibernateDao<Foo> implements IFooDao { public class FooDao extends AbstractHibernateDao<Foo>implements IFooDao {
public FooDao() { public FooDao() {
super(); super();

View File

@ -6,7 +6,7 @@ import org.baeldung.persistence.model.Parent;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class ParentDao extends AbstractHibernateDao<Parent> implements IParentDao { public class ParentDao extends AbstractHibernateDao<Parent>implements IParentDao {
public ParentDao() { public ParentDao() {
super(); super();

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ChildService extends AbstractService<Child> implements IChildService { public class ChildService extends AbstractService<Child>implements IChildService {
@Autowired @Autowired
private IChildDao dao; private IChildDao dao;

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class FooService extends AbstractService<Foo> implements IFooService { public class FooService extends AbstractService<Foo>implements IFooService {
@Autowired @Autowired
private IFooDao dao; private IFooDao dao;

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ParentService extends AbstractService<Parent> implements IParentService { public class ParentService extends AbstractService<Parent>implements IParentService {
@Autowired @Autowired
private IParentDao dao; private IParentDao dao;

View File

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:persistence-mysql.properties" /> <context:property-placeholder location="classpath:persistence-mysql.properties"/>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" /> <property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="org.baeldung.persistence.model" /> <property name="packagesToScan" value="org.baeldung.persistence.model"/>
<property name="hibernateProperties"> <property name="hibernateProperties">
<props> <props>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
@ -20,16 +19,16 @@
</bean> </bean>
<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource"> <bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}" /> <property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.user}" /> <property name="username" value="${jdbc.user}"/>
<property name="password" value="${jdbc.pass}" /> <property name="password" value="${jdbc.pass}"/>
</bean> </bean>
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" /> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
<bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> <bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
</beans> </beans>

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"
>
<http access-denied-page="/access-denied.html" use-expressions="true"> <http access-denied-page="/access-denied.html" use-expressions="true">
<intercept-url pattern="/access-denied*" access="hasAnyRole('ROLE_LOCATION_WRITE','ROLE_POLYGON_WRITE')" /> <intercept-url pattern="/access-denied*" access="hasAnyRole('ROLE_LOCATION_WRITE','ROLE_POLYGON_WRITE')"/>
<intercept-url pattern="/admin/**" access="hasAnyRole('ROLE_ADMIN')" /> <intercept-url pattern="/admin/**" access="hasAnyRole('ROLE_ADMIN')"/>
<intercept-url pattern="/organization/**" access="hasAnyRole('ROLE_ORGANIZATION')" /> <intercept-url pattern="/organization/**" access="hasAnyRole('ROLE_ORGANIZATION')"/>
<intercept-url pattern="/location/edit*" access="hasAnyRole('ROLE_LOCATION_WRITE')" /> <intercept-url pattern="/location/edit*" access="hasAnyRole('ROLE_LOCATION_WRITE')"/>
<intercept-url pattern="/location/view*" access="permitAll" /> <intercept-url pattern="/location/view*" access="permitAll"/>
<intercept-url pattern="/login*" access="isAnonymous()" /> <intercept-url pattern="/login*" access="isAnonymous()"/>
<intercept-url pattern="/register*" access="isAnonymous()" /> <intercept-url pattern="/register*" access="isAnonymous()"/>
<intercept-url pattern="/login-denied/**" access="isAnonymous()" /> <intercept-url pattern="/login-denied/**" access="isAnonymous()"/>
<intercept-url pattern="/**" access="permitAll" /> <intercept-url pattern="/**" access="permitAll"/>
<form-login login-page='/login.html' default-target-url="/" always-use-default-target="false" authentication-failure-url="/login.html?error=true" /> <form-login login-page='/login.html' default-target-url="/" always-use-default-target="false" authentication-failure-url="/login.html?error=true"/>
<logout /> <logout/>
<anonymous /> <anonymous/>
<session-management invalid-session-url="/"> <session-management invalid-session-url="/">
<concurrency-control max-sessions="1" /> <concurrency-control max-sessions="1"/>
</session-management> </session-management>
</http> </http>
<authentication-manager alias="authenticationManager" erase-credentials="false"> <authentication-manager alias="authenticationManager" erase-credentials="false">
<authentication-provider ref="restAuthenticationProvider" /> <authentication-provider ref="restAuthenticationProvider"/>
</authentication-manager> </authentication-manager>
</beans:beans> </beans:beans>

View File

@ -9,7 +9,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({// @formatter:off @Suite.SuiteClasses({ // @formatter:off
FooServiceBasicPersistenceIntegrationTest.class FooServiceBasicPersistenceIntegrationTest.class
,FooPaginationPersistenceIntegrationTest.class ,FooPaginationPersistenceIntegrationTest.class
,FooServicePersistenceIntegrationTest.class ,FooServicePersistenceIntegrationTest.class

View File

@ -29,7 +29,7 @@
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>

View File

@ -4,7 +4,7 @@ import org.baeldung.persistence.model.Foo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class FooDao extends AbstractJpaDAO<Foo> implements IFooDao { public class FooDao extends AbstractJpaDAO<Foo>implements IFooDao {
public FooDao() { public FooDao() {
super(); super();

View File

@ -4,19 +4,18 @@
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>
<context:property-placeholder location="classpath:persistence-mysql.properties" /> <context:property-placeholder location="classpath:persistence-mysql.properties"/>
<bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" /> <property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="org.baeldung.persistence.model" /> <property name="packagesToScan" value="org.baeldung.persistence.model"/>
<property name="jpaVendorAdapter"> <property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
<!-- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> <!-- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> <property name="generateDdl" value="${jpa.generateDdl}" /> <property name="databasePlatform"
<property name="generateDdl" value="${jpa.generateDdl}" /> value="${persistence.dialect}" /> </bean> -->
<property name="databasePlatform" value="${persistence.dialect}" />
</bean> -->
</property> </property>
<property name="jpaProperties"> <property name="jpaProperties">
<props> <props>
@ -27,17 +26,17 @@
</bean> </bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}" /> <property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.user}" /> <property name="username" value="${jdbc.user}"/>
<property name="password" value="${jdbc.pass}" /> <property name="password" value="${jdbc.pass}"/>
</bean> </bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEmf" /> <property name="entityManagerFactory" ref="myEmf"/>
</bean> </bean>
<tx:annotation-driven /> <tx:annotation-driven/>
<bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> <bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
</beans> </beans>

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"
>
<http access-denied-page="/access-denied.html" use-expressions="true"> <http access-denied-page="/access-denied.html" use-expressions="true">
<intercept-url pattern="/access-denied*" access="hasAnyRole('ROLE_LOCATION_WRITE','ROLE_POLYGON_WRITE')" /> <intercept-url pattern="/access-denied*" access="hasAnyRole('ROLE_LOCATION_WRITE','ROLE_POLYGON_WRITE')"/>
<intercept-url pattern="/admin/**" access="hasAnyRole('ROLE_ADMIN')" /> <intercept-url pattern="/admin/**" access="hasAnyRole('ROLE_ADMIN')"/>
<intercept-url pattern="/organization/**" access="hasAnyRole('ROLE_ORGANIZATION')" /> <intercept-url pattern="/organization/**" access="hasAnyRole('ROLE_ORGANIZATION')"/>
<intercept-url pattern="/location/edit*" access="hasAnyRole('ROLE_LOCATION_WRITE')" /> <intercept-url pattern="/location/edit*" access="hasAnyRole('ROLE_LOCATION_WRITE')"/>
<intercept-url pattern="/location/view*" access="permitAll" /> <intercept-url pattern="/location/view*" access="permitAll"/>
<intercept-url pattern="/login*" access="isAnonymous()" /> <intercept-url pattern="/login*" access="isAnonymous()"/>
<intercept-url pattern="/register*" access="isAnonymous()" /> <intercept-url pattern="/register*" access="isAnonymous()"/>
<intercept-url pattern="/login-denied/**" access="isAnonymous()" /> <intercept-url pattern="/login-denied/**" access="isAnonymous()"/>
<intercept-url pattern="/**" access="permitAll" /> <intercept-url pattern="/**" access="permitAll"/>
<form-login login-page='/login.html' default-target-url="/" always-use-default-target="false" authentication-failure-url="/login.html?error=true" /> <form-login login-page='/login.html' default-target-url="/" always-use-default-target="false" authentication-failure-url="/login.html?error=true"/>
<logout /> <logout/>
<anonymous /> <anonymous/>
<session-management invalid-session-url="/"> <session-management invalid-session-url="/">
<concurrency-control max-sessions="1" /> <concurrency-control max-sessions="1"/>
</session-management> </session-management>
</http> </http>
<authentication-manager alias="authenticationManager" erase-credentials="false"> <authentication-manager alias="authenticationManager" erase-credentials="false">
<authentication-provider ref="restAuthenticationProvider" /> <authentication-provider ref="restAuthenticationProvider"/>
</authentication-manager> </authentication-manager>
</beans:beans> </beans:beans>

View File

@ -4,7 +4,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({// @formatter:off @Suite.SuiteClasses({ // @formatter:off
FooPaginationPersistenceIntegrationTest.class FooPaginationPersistenceIntegrationTest.class
,FooServicePersistenceIntegrationTest.class ,FooServicePersistenceIntegrationTest.class
,FooServiceSortingTests.class ,FooServiceSortingTests.class

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-mvc-java</artifactId> <artifactId>spring-mvc-java</artifactId>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC Application</display-name> <display-name>Spring MVC Application</display-name>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<version>0.1-SNAPSHOT</version> <version>0.1-SNAPSHOT</version>

View File

@ -1,6 +1,6 @@
package org.baeldung.servlet; package org.baeldung.servlet;
//public class WebApp implements WebApplicationInitializer { // public class WebApp implements WebApplicationInitializer {
// //
// public WebApp() { // public WebApp() {
// super(); // super();

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"
>
<http access-denied-page="/access-denied.html" use-expressions="true"> <http access-denied-page="/access-denied.html" use-expressions="true">
<intercept-url pattern="/access-denied*" access="hasAnyRole('ROLE_LOCATION_WRITE','ROLE_POLYGON_WRITE')" /> <intercept-url pattern="/access-denied*" access="hasAnyRole('ROLE_LOCATION_WRITE','ROLE_POLYGON_WRITE')"/>
<intercept-url pattern="/admin/**" access="hasAnyRole('ROLE_ADMIN')" /> <intercept-url pattern="/admin/**" access="hasAnyRole('ROLE_ADMIN')"/>
<intercept-url pattern="/organization/**" access="hasAnyRole('ROLE_ORGANIZATION')" /> <intercept-url pattern="/organization/**" access="hasAnyRole('ROLE_ORGANIZATION')"/>
<intercept-url pattern="/location/edit*" access="hasAnyRole('ROLE_LOCATION_WRITE')" /> <intercept-url pattern="/location/edit*" access="hasAnyRole('ROLE_LOCATION_WRITE')"/>
<intercept-url pattern="/location/view*" access="permitAll" /> <intercept-url pattern="/location/view*" access="permitAll"/>
<intercept-url pattern="/login*" access="isAnonymous()" /> <intercept-url pattern="/login*" access="isAnonymous()"/>
<intercept-url pattern="/register*" access="isAnonymous()" /> <intercept-url pattern="/register*" access="isAnonymous()"/>
<intercept-url pattern="/login-denied/**" access="isAnonymous()" /> <intercept-url pattern="/login-denied/**" access="isAnonymous()"/>
<intercept-url pattern="/**" access="permitAll" /> <intercept-url pattern="/**" access="permitAll"/>
<form-login login-page='/login.html' default-target-url="/" always-use-default-target="false" authentication-failure-url="/login.html?error=true" /> <form-login login-page='/login.html' default-target-url="/" always-use-default-target="false" authentication-failure-url="/login.html?error=true"/>
<logout /> <logout/>
<anonymous /> <anonymous/>
<session-management invalid-session-url="/"> <session-management invalid-session-url="/">
<concurrency-control max-sessions="1" /> <concurrency-control max-sessions="1"/>
</session-management> </session-management>
</http> </http>
<authentication-manager alias="authenticationManager" erase-credentials="false"> <authentication-manager alias="authenticationManager" erase-credentials="false">
<authentication-provider ref="restAuthenticationProvider" /> <authentication-provider ref="restAuthenticationProvider"/>
</authentication-manager> </authentication-manager>
</beans:beans> </beans:beans>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring MVC No XML Application</display-name> <display-name>Spring MVC No XML Application</display-name>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<version>0.1-SNAPSHOT</version> <version>0.1-SNAPSHOT</version>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans
@ -8,16 +7,16 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"> http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"
>
<mvc:annotation-driven /> <mvc:annotation-driven/>
<context:component-scan base-package="org.baeldung.spring.controller" /> <context:component-scan base-package="org.baeldung.spring.controller"/>
<bean id="viewResolver" <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/view/"/>
<property name="prefix" value="/WEB-INF/view/" /> <property name="suffix" value=".jsp"/>
<property name="suffix" value=".jsp" />
</bean> </bean>
<mvc:view-controller path="/sample.html" view-name="sample" /> <mvc:view-controller path="/sample.html" view-name="sample"/>
</beans> </beans>

View File

@ -2,7 +2,8 @@
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
>
<display-name>Spring MVC XML Application</display-name> <display-name>Spring MVC XML Application</display-name>

View File

@ -159,7 +159,6 @@
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -35,7 +35,7 @@
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file /> <welcome-file/>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-security-mvc-basic-auth</artifactId> <artifactId>spring-security-mvc-basic-auth</artifactId>

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
>
<http pattern="/securityNone" security="none" /> <http pattern="/securityNone" security="none"/>
<http use-expressions="true"> <http use-expressions="true">
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="isAuthenticated()"/>
<http-basic entry-point-ref="myBasicAuthenticationEntryPoint" /> <http-basic entry-point-ref="myBasicAuthenticationEntryPoint"/>
</http> </http>
<authentication-manager> <authentication-manager>
<authentication-provider> <authentication-provider>
<user-service> <user-service>
<user name="user1" password="user1Pass" authorities="ROLE_USER" /> <user name="user1" password="user1Pass" authorities="ROLE_USER"/>
</user-service> </user-service>
</authentication-provider> </authentication-provider>
</authentication-manager> </authentication-manager>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
>
<display-name>Spring Security Basic Auth Application</display-name> <display-name>Spring Security Basic Auth Application</display-name>
<context-param> <context-param>

View File

@ -21,7 +21,7 @@ public class Role {
private Collection<User> users; private Collection<User> users;
@ManyToMany @ManyToMany
@JoinTable(name = "roles_privileges", joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "privilege_id", referencedColumnName = "id")) @JoinTable(name = "roles_privileges", joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id") , inverseJoinColumns = @JoinColumn(name = "privilege_id", referencedColumnName = "id") )
private Collection<Privilege> privileges; private Collection<Privilege> privileges;
private String name; private String name;

View File

@ -32,7 +32,7 @@ public class User {
private boolean tokenExpired; private boolean tokenExpired;
@ManyToMany @ManyToMany
@JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id")) @JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id") , inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id") )
private Collection<Role> roles; private Collection<Role> roles;
public User() { public User() {

View File

@ -18,7 +18,7 @@ public @interface PasswordMatches {
String message() default "Passwords don't match"; String message() default "Passwords don't match";
Class<?>[] groups() default {}; Class<?>[]groups() default {};
Class<? extends Payload>[] payload() default {}; Class<? extends Payload>[]payload() default {};
} }

View File

@ -18,7 +18,7 @@ public @interface ValidEmail {
String message() default "Invalid Email"; String message() default "Invalid Email";
Class<?>[] groups() default {}; Class<?>[]groups() default {};
Class<? extends Payload>[] payload() default {}; Class<? extends Payload>[]payload() default {};
} }

View File

@ -20,8 +20,8 @@ public @interface ValidPassword {
String message() default "Invalid Password"; String message() default "Invalid Password";
Class<?>[] groups() default {}; Class<?>[]groups() default {};
Class<? extends Payload>[] payload() default {}; Class<? extends Payload>[]payload() default {};
} }

View File

@ -3,37 +3,38 @@
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"
>
<http use-expressions="true"> <http use-expressions="true">
<intercept-url pattern="/login*" access="permitAll" /> <intercept-url pattern="/login*" access="permitAll"/>
<intercept-url pattern="/logout*" access="permitAll" /> <intercept-url pattern="/logout*" access="permitAll"/>
<intercept-url pattern="/signin/**" access="permitAll" /> <intercept-url pattern="/signin/**" access="permitAll"/>
<intercept-url pattern="/signup/**" access="permitAll" /> <intercept-url pattern="/signup/**" access="permitAll"/>
<intercept-url pattern="/user/registration*" access="permitAll" /> <intercept-url pattern="/user/registration*" access="permitAll"/>
<intercept-url pattern="/regitrationConfirm*" access="permitAll" /> <intercept-url pattern="/regitrationConfirm*" access="permitAll"/>
<intercept-url pattern="/expiredAccount*" access="permitAll" /> <intercept-url pattern="/expiredAccount*" access="permitAll"/>
<intercept-url pattern="/registration*" access="permitAll" /> <intercept-url pattern="/registration*" access="permitAll"/>
<intercept-url pattern="/badUser*" access="permitAll" /> <intercept-url pattern="/badUser*" access="permitAll"/>
<intercept-url pattern="/user/resendRegistrationToken*" access="permitAll" /> <intercept-url pattern="/user/resendRegistrationToken*" access="permitAll"/>
<intercept-url pattern="/forgetPassword*" access="permitAll" /> <intercept-url pattern="/forgetPassword*" access="permitAll"/>
<intercept-url pattern="/user/resetPassword*" access="permitAll" /> <intercept-url pattern="/user/resetPassword*" access="permitAll"/>
<intercept-url pattern="/user/changePassword*" access="permitAll" /> <intercept-url pattern="/user/changePassword*" access="permitAll"/>
<intercept-url pattern="/updatePassword*" access="isAuthenticated()" /> <intercept-url pattern="/updatePassword*" access="isAuthenticated()"/>
<intercept-url pattern="/user/savePassword*" access="isAuthenticated()" /> <intercept-url pattern="/user/savePassword*" access="isAuthenticated()"/>
<intercept-url pattern="/emailError*" access="permitAll" /> <intercept-url pattern="/emailError*" access="permitAll"/>
<intercept-url pattern="/resources/**" access="permitAll" /> <intercept-url pattern="/resources/**" access="permitAll"/>
<intercept-url pattern="/invalidSession*" access="isAnonymous()" /> <intercept-url pattern="/invalidSession*" access="isAnonymous()"/>
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="isAuthenticated()"/>
<form-login login-page='/login.html' authentication-failure-url="/login.html?error=true" authentication-success-handler-ref="myAuthenticationSuccessHandler" <form-login login-page='/login.html' authentication-failure-url="/login.html?error=true" authentication-success-handler-ref="myAuthenticationSuccessHandler"
default-target-url="/homepage.html" /> default-target-url="/homepage.html"/>
<session-management invalid-session-url="/invalidSession.html" session-fixation-protection="none" /> <session-management invalid-session-url="/invalidSession.html" session-fixation-protection="none"/>
<logout invalidate-session="false" logout-success-url="/logout.html?logSucc=true" logout-url="/j_spring_security_logout" delete-cookies="JSESSIONID" /> <logout invalidate-session="false" logout-success-url="/logout.html?logSucc=true" logout-url="/j_spring_security_logout" delete-cookies="JSESSIONID"/>
</http> </http>
<authentication-manager> <authentication-manager>
<authentication-provider ref="authProvider" /> <authentication-provider ref="authProvider"/>
</authentication-manager> </authentication-manager>
</beans:beans> </beans:beans>

View File

@ -2,7 +2,8 @@
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
>
<context-param> <context-param>
<param-name>contextClass</param-name> <param-name>contextClass</param-name>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-security-mvc-custom</artifactId> <artifactId>spring-security-mvc-custom</artifactId>

View File

@ -4,28 +4,29 @@
http://www.springframework.org/schema/security http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"
>
<http use-expressions="true"> <http use-expressions="true">
<intercept-url pattern="/anonymous*" access="isAnonymous()" /> <intercept-url pattern="/anonymous*" access="isAnonymous()"/>
<intercept-url pattern="/login*" access="permitAll" /> <intercept-url pattern="/login*" access="permitAll"/>
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="isAuthenticated()"/>
<form-login login-page='/login.html' authentication-success-handler-ref="myAuthenticationSuccessHandler" authentication-failure-url="/login.html?error=true" /> <form-login login-page='/login.html' authentication-success-handler-ref="myAuthenticationSuccessHandler" authentication-failure-url="/login.html?error=true"/>
<logout delete-cookies="JSESSIONID" /> <logout delete-cookies="JSESSIONID"/>
<remember-me key="uniqueAndSecret" token-validity-seconds="86400" /> <remember-me key="uniqueAndSecret" token-validity-seconds="86400"/>
</http> </http>
<beans:bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler" /> <beans:bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler"/>
<authentication-manager> <authentication-manager>
<authentication-provider> <authentication-provider>
<user-service> <user-service>
<user name="user1" password="user1Pass" authorities="ROLE_USER" /> <user name="user1" password="user1Pass" authorities="ROLE_USER"/>
<user name="admin1" password="admin1Pass" authorities="ROLE_ADMIN" /> <user name="admin1" password="admin1Pass" authorities="ROLE_ADMIN"/>
</user-service> </user-service>
</authentication-provider> </authentication-provider>
</authentication-manager> </authentication-manager>

View File

@ -2,7 +2,8 @@
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
>
<display-name>Spring MVC Custom Application</display-name> <display-name>Spring MVC Custom Application</display-name>

View File

@ -1,5 +1,4 @@
<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">
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> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-security-mvc-digest-auth</artifactId> <artifactId>spring-security-mvc-digest-auth</artifactId>

View File

@ -2,28 +2,29 @@
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"
>
<beans:bean id="digestFilter" class="org.springframework.security.web.authentication.www.DigestAuthenticationFilter"> <beans:bean id="digestFilter" class="org.springframework.security.web.authentication.www.DigestAuthenticationFilter">
<beans:property name="userDetailsService" ref="userService" /> <beans:property name="userDetailsService" ref="userService"/>
<beans:property name="authenticationEntryPoint" ref="digestEntryPoint" /> <beans:property name="authenticationEntryPoint" ref="digestEntryPoint"/>
</beans:bean> </beans:bean>
<beans:bean id="digestEntryPoint" class="org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint"> <beans:bean id="digestEntryPoint" class="org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint">
<beans:property name="realmName" value="Contacts Realm via Digest Authentication" /> <beans:property name="realmName" value="Contacts Realm via Digest Authentication"/>
<beans:property name="key" value="acegi" /> <beans:property name="key" value="acegi"/>
</beans:bean> </beans:bean>
<!-- the security namespace configuration --> <!-- the security namespace configuration -->
<http use-expressions="true" entry-point-ref="digestEntryPoint"> <http use-expressions="true" entry-point-ref="digestEntryPoint">
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="isAuthenticated()"/>
<custom-filter ref="digestFilter" position="BASIC_AUTH_FILTER" /> <custom-filter ref="digestFilter" position="BASIC_AUTH_FILTER"/>
</http> </http>
<authentication-manager> <authentication-manager>
<authentication-provider> <authentication-provider>
<user-service id="userService"> <user-service id="userService">
<user name="user1" password="user1Pass" authorities="ROLE_USER" /> <user name="user1" password="user1Pass" authorities="ROLE_USER"/>
</user-service> </user-service>
</authentication-provider> </authentication-provider>
</authentication-manager> </authentication-manager>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation=" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
id="WebApp_ID" version="3.0"> >
<display-name>Spring Security Basic Auth Application</display-name> <display-name>Spring Security Basic Auth Application</display-name>

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