일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Spring Batch
- reactive
- spring reactive
- reactor
- 공유기 서버
- reactor core
- 웹 커리큘럼
- Spring Framework
- 서버운영
- 웹앱
- ipTIME
- 웹 스터디
- Today
- Total
Hello World
[펌]Spring Cloud AWS with proxy settings 본문
In my previous article, Spring and Amazon Web Services, I provided a brief introduction to Spring Cloud AWS module and what you as a developer can expect from it at this point in time. One thing that is not obvious from the official documentation is how to use this module when your Internet connection is restricted by a proxy server. In this post I will outline how to approach passing of proxy configuration for both Java-based and XML-based configuration. This aspect of configuration will probably be addressed in the future releases however it might help you now in case you work with this module and need your application to work with a company proxy.
Spring Cloud AWS proxy configuration
Java configuration
Let’s start with ever more popular way of configuring Spring applications – Java configuration. Things are relatively simple in this case since you can provide required proxy configuration manually in code yourself. Consider the following configuration class declaring two beans – S3 client and proxy configuration (if these settings are not resolved from property files / properties default no-proxy connection will be used).
S3 client configuration sample from ApplicationConfiguration class
Given the implications of code like this consider marking this class with profile used to run the application on developers machine e.g. .
XML configuration
When it comes to proxy configuration using XML configuration certain degree of Spring configuration knowledge is required. In order to make this simple configuration work, we need to create the instance of
with proxy settings stored in client configuration bean. Following XML file shows the entire configuration so lets break it down into several sections.beans.xml
Given the implications of code like this consider marking these beans with profile used to run the application on developers machine e.g. .
Going beyond S3
The example so far was pretty much restricted to S3. However this configuration can be used whenever applicable due to the way Amazon SDK was designed. Let’s take a look at the example of DynomoDB client. There are several clients for various Amazon AWS services that can make use of the approach discussed above.
DynamoDB client configuration sample from ApplicationConfiguration class
Conclusion
Passing the application configuration to your beans is pretty standard task that should not cause a lot of trouble to an experienced Spring developer. However given the varying level of experience and hurdles of day to day life of a developer this might cause trouble. This is why I would encourage anyone to try these examples on their own, since situation modeled here uses one of the fundamental approaches to Spring configuration design. Keep practicing and keep that corporate proxy at bay. :)
Reference: | Spring Cloud AWS with proxy settings from our JCG partner Jakub Stas at the Jakub Stas blog. |
출처: http://www.javacodegeeks.com/2016/01/spring-cloud-aws-proxy-settings.html
'Spring > Boot(4.x)' 카테고리의 다른 글
Spring-loaded를 IntelliJ 와 Gradle를 사용하여 설정 하기 (0) | 2016.01.10 |
---|---|
[펌]Spring Cloud AWS를 이용한 S3 연동 (0) | 2016.01.10 |
[펌]Getting started with Spring JDBC in a web application (0) | 2016.01.10 |
[펌]How to mock Spring bean (version 2) (0) | 2016.01.10 |
[펌]Spring Data Redis Example (0) | 2016.01.10 |