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
public static String extractURIByRel(final String linkHeader, final String rel) { | |
if (linkHeader == null) { | |
return null; | |
} | |
String uriWithSpecifiedRel = null; | |
final String[] links = linkHeader.split(", "); | |
String linkRelation = null; | |
for (final String link : links) { | |
final int positionOfSeparator = link.indexOf(';'); |
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 xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xsi:schemaLocation=" | |
http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
http://www.springframework.org/schema/context | |
http://www.springframework.org/schema/context/spring-context-3.1.xsd"> | |
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
package com.macys.rest.common; | |
import java.util.HashSet; | |
import java.util.Set; | |
/** | |
* - link: http://thenoisychannel.com/2011/08/08/retiring-a-great-interview-problem/ <br> | |
* Given an input string and a dictionary of words, segment the input string into a space-separated sequence of dictionary words if possible. | |
* For example, if the input string is "applepie" and dictionary contains a | |
* standard set of English words, then we would return the string "apple pie" as output. |
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
<dependency> | |
<groupId>commons-codec</groupId> | |
<artifactId>commons-codec</artifactId> | |
<version>1.6</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.httpcomponents</groupId> | |
<artifactId>httpcore</artifactId> | |
<version>4.1.4</version> |
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
@Component | |
public class RestTemplateFactory implements | |
FactoryBean< RestTemplate >, InitializingBean{ | |
private RestTemplate restTemplate; | |
public RestTemplate getObject(){ | |
return restTemplate; | |
} | |
public Class< RestTemplate > getObjectType(){ | |
return RestTemplate.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
@Autowired | |
private Environment env; | |
... | |
dataSource.setUrl(env.getProperty("jdbc.url")); |
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 id="dataSource"> | |
<property name="url" value="${jdbc.url}" /> | |
</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
@Value( "${jdbc.url}" ) | |
private String jdbcUrl; |
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.context.support.PropertySourcesPlaceholderConfigurer"> | |
<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 PropertySourcesPlaceholderConfigurer properties(){ | |
PropertySourcesPlaceholderConfigurer pspc = | |
new PropertySourcesPlaceholderConfigurer(); | |
Resource[] resources = new ClassPathResource[ ] | |
{ new ClassPathResource( "foo.properties" ) }; | |
pspc.setLocations( resources ); | |
pspc.setIgnoreUnresolvablePlaceholders( true ); | |
return pspc; | |
} |
NewerOlder