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
import java.time.LocalDate; | |
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.util.List; | |
import java.util.Properties; | |
import javax.annotation.PostConstruct; | |
import org.apache.ibatis.cache.CacheKey; | |
import org.apache.ibatis.executor.Executor; |
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 Object resolveAutowiringValue(Object autowiringValue, Class<?> requiredType) { | |
if (autowiringValue instanceof ObjectFactory && !requiredType.isInstance(autowiringValue)) { | |
ObjectFactory<?> factory = (ObjectFactory<?>) autowiringValue; | |
if (autowiringValue instanceof Serializable && requiredType.isInterface()) { | |
autowiringValue = Proxy.newProxyInstance(requiredType.getClassLoader(), | |
new Class<?>[] {requiredType}, new ObjectFactoryDelegatingInvocationHandler(factory)); | |
} | |
else { | |
return factory.getObject(); | |
} |
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
protected Map<String, Object> findAutowireCandidates( | |
@Nullable String beanName, Class<?> requiredType, DependencyDescriptor descriptor) { | |
String[] candidateNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors( | |
this, requiredType, true, descriptor.isEager()); | |
Map<String, Object> result = new LinkedHashMap<>(candidateNames.length); | |
for (Class<?> autowiringType : this.resolvableDependencies.keySet()) { | |
if (autowiringType.isAssignableFrom(requiredType)) { | |
Object autowiringValue = this.resolvableDependencies.get(autowiringType); | |
autowiringValue = AutowireUtils.resolveAutowiringValue(autowiringValue, requiredType); |
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
/** | |
* Factory that exposes the current request object on demand. | |
*/ | |
@SuppressWarnings("serial") | |
private static class RequestObjectFactory implements ObjectFactory<ServletRequest>, Serializable { | |
@Override | |
public ServletRequest getObject() { | |
return currentRequestAttributes().getRequest(); | |
} |
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 void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory, | |
@Nullable ServletContext sc) { | |
... | |
beanFactory.registerResolvableDependency(ServletRequest.class, new RequestObjectFactory()); | |
beanFactory.registerResolvableDependency(ServletResponse.class, new ResponseObjectFactory()); | |
beanFactory.registerResolvableDependency(HttpSession.class, new SessionObjectFactory()); | |
beanFactory.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory()); | |
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 FooController { | |
@Autowired | |
private HttpServletRequest request; | |
... | |
} |
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 class MfaCredentailProvider implements AWSCredentialsProvider { | |
private DefaultAWSCredentialsProviderChain defaultChain = DefaultAWSCredentialsProviderChain.getInstance(); | |
private final String region; | |
private AWSCredentials token; | |
public MfaCredentailProvider(String region) { | |
if(region == null) { |
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
@Target({ElementType.FIELD, ElementType.TYPE}) | |
@Retention(RetentionPolicy.RUNTIME) | |
public @interface IgnoreXssEscape { | |
} |
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
/** | |
* Initializes or doubles table size. If null, allocates in | |
* accord with initial capacity target held in field threshold. | |
* Otherwise, because we are using power-of-two expansion, the | |
* elements from each bin must either stay at same index, or move | |
* with a power of two offset in the new table. | |
* | |
* @return the table | |
*/ | |
final Node<K,V>[] resize() { |
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
putVal(int XORHash, K key, V value, boolean onlyIfAbsent, boolean evict) { | |
1. Node<K,V> 테이블이 없다면 초기화 | |
2. 테이블의 [ 테이블 길이 -1 & XORHash ] 인덱스 Value가 null 이라면 | |
- 테이블의 [ 테이블 길이 -1 & XORHash ] 인덱스에 newNode(새로운 노드 생성) 넣음 | |
3. 2번이 아니라면 | |
테이블의 [ 테이블 길이 -1 & XORHash ] 인덱스의 Node 값 참조 | |
3-1. (Node의 hash 가 파라미터 XORHash 같고 Node의 key 가 파라미터 키와 같음) or (노드의 key 가 파라미터 key 와 equals true) |
NewerOlder