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
@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 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
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
@RestController | |
public class ApiController { | |
Logger logger = LoggerFactory.getLogger(ApiController.class); | |
@Autowired(required = false) | |
CentralConfig centralConfig; | |
@Autowired(required = false) | |
ContextRefresher contextRefresher; |
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() { |
NewerOlder