This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | |
<property name="location"> | |
<list> | |
<value>classpath:foo.properties</value> | |
</list> | |
</property> | |
<property name="ignoreUnresolvablePlaceholders" value="true"/> | |
</bean> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public static PropertyPlaceholderConfigurer properties(){ | |
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); | |
Resource[] resources = new ClassPathResource[ ] | |
{ new ClassPathResource( "foo.properties" ) }; | |
ppc.setLocations( resources ); | |
ppc.setIgnoreUnresolvablePlaceholders( true ); | |
return ppc; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PropertySource("classpath:/com/foo/foo.properties") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<context:property-placeholder location="com/foo/foo.properties"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository | |
public class FooDAO extends AbstractJPADAO< Foo > implements IFooDAO{ | |
public FooDAO(){ | |
setClazz(Foo.class ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" xmlns:beans="http://www.springframework.org/schema/beans" | |
xmlns:sec="http://www.springframework.org/schema/security" | |
xsi:schemaLocation=" | |
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd | |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> | |
<http create-session="stateless" entry-point-ref="digestEntryPoint"> | |
<intercept-url pattern="/api/admin/**" access="ROLE_ADMIN" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
public class FooController{ | |
@Autowired | |
IFooService service; | |
// API | |
@RequestMapping( value = "admin/foo",params = { "page", "size" },method = GET ) | |
@ResponseBody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" | |
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>rest</display-name> | |
<!-- Spring security --> | |
<listener> | |
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org</groupId> | |
<artifactId>rest</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>war</packaging> | |
<dependencies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void whenResourcesAreRetrievedPaged_then200IsReceived(){ | |
Response response = givenAuth().get( paths.getFooURL() + "?page=1&size=10" ); | |
assertThat( response.getStatusCode(), is( 200 ) ); | |
} | |
@Test | |
public void | |
whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived(){ | |
Response response = givenAuth().get( |