Spring に RestTemplateという便利なRESTクライアントがあるんですが、呼び出すAPIサーバ毎にプロキシサーバを変えたいと思いまして。 システムプロパティいぢらずに済ませたい。ということでコードは、以下の感じです。 import java.net.InetSocketAddress; import java.net.Proxy; import java.net.Proxy.Type; import org.springframework.context.annotation.Bean; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; : : @Bean public RestT
例によってあまり脈絡がないけれどSpring Bootについて興味があったのでリファレンス・ガイドを参照しています。先頭から読んでいくとらちが明かないので、いきなり第4章「Spring Boot の重要機能」("Part IV. Spring Boot features")から。これも例によって興味のあるところだけの訳出です。 まずはSpringApplicationによるアプリケーションのブート、外部化されたコンフィギュレーションとプロファイルによる設定情報の隔離、そしてロギングまで。原典は"Spring Boot Reference Guide"(1.1.8.RELEASE版。2014/10/28取得)の"Part IV. Spring Boot features"です。 * * * Spring Boot の重要機能 このセクションではSpring Bootの詳細に飛び込んでいきます
In one of my Spring Boot microservices, I want to keep track of a list of servers that can be externally configurable. I can have zero to infinity servers, so I want my application to allow me to easily define this. I also want to be able to check that the configuration is correct, so I don’t accidentally forget to enter a url or a name for my server. In this post, I will show you how you can use
spring-bootはデフォルトではslf4j+logbackでログ出力が行われている。 また、最初からそれなりに適切に設定されているため、運用段階ではそれほど困らないようにはなっている。 ただ、開発中は出てほしいログが足りないため、デフォルトのまま開発すると結構困る。 以下のようなファイルを logback.xmlとしてルートフォルダに保存をする。 <?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <Pattern>%d{yyyy-MMM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{35} - %msg %n</Pattern>
While working on converting a Grails application to a SpringBoot based application, I was trying to understand how the auto configurations and custom configurations work under the hood. Just like CoC of Groovy/Grails, there seems to be a lot of hide-and-seek going on under the Spring boot hood. Admittedly its been a while for me with good ol’ raw Spring, so the many different ways of skinning the
Spring Bootのinit.d向け起動スクリプトは、公式には配布されていないようですね。 ググると色々あります。 http://www.slideshare.net/makingx/spring-boot-java-jsug https://github.com/rburgst/spring-boot-initscript https://blog.ik.am/#/entries/269 mavenを使う方法とか。 http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/ Spring Bootに限らず、汎用としてはこんなのも。 http://stackoverflow.com/a/21283530 どれもしっくり来ない。 なので作りました https://github.com/af-not-found/spri
Spring Bootで(というかSpring Securityのような気もするが) ユーザ認証を実装する方法について。 とりあえずハードコードで、という方法は見つかるのだが DBにユーザ情報を格納し ID以外のユーザ情報にもアクセスできるようにする という場合の方法が見つからず苦労したので記録しておく。 概要 以下の作業が必要。 Spring Securityをdependencyに追加する WebSecurityConfigurerAdapterを継承して設定する UserDetailsServiceを継承して認証ロジックをカスタマイズする Spring Securityをdependencyに追加する build.gradleのdependenciesにspring-boot-starter-securityを追加する。 (バージョンは適切なものを選ぶ) dependencies {
You will build an application that prints out the current time every five seconds by using Spring Framework’s @Scheduled annotation.
Blogg Här finns tekniska artiklar, presentationer och nyheter om arkitektur och systemutveckling. Håll dig uppdaterad, följ oss på Twitter 22 April 2014 // Magnus Larsson In this blog we will show you how to develop non-blocking REST services using Spring MVC. We will also demonstrate the vast difference in scalability that non-blocking services provide compared to traditional blocking services. W
I'm pleased to announce that Spring Boot v1.3.0.M1 is available now from the Spring milestone repository. This release builds on Spring Framework 4.2.0.RC1 and provides a number of improvements and new features over Spring Boot 1.2. Highlights include: A new spring-boot-devtools module with support for automatic restart, LiveReload and remote update. Extensive caching support for EhCache, Hazelcas
はじめに SpringBoot 1.3.5で書き直しました。 SpringFrameworkはグローバルで利用され、枯れたフレームワークなので品質的にも安心感がありますし、SpringとSpringのサブプロジェクトの機能は非常に多岐に渡ります。 SpringBootは私のようにSpringに詳しくなくても簡単にWebアプリケーションを作ることができます。 SpringFrameworkの情報はWeb上に沢山存在しますが、Spring初心者にはどれがどのバージョンで利用できることなのかがわかりにくく戸惑うことが多いのです。そこで、今回勉強したことを検索しやすいように1ページにまとめてみました。 できるだけ公式サイトへの参照を貼ってあります。また、探す糸口がわかると良いと思ったので探し方もできるだけ記載しておきました。 自分のメモ的な感じで記載しているので記載が荒いところはご容赦ください。間
2014/04/30 (水) 19:00 - 21:00 JJUG&JGGUG 共催ナイトセミナ 「4.30 2時間で分かる!次世代ビルドツールの本命Gradleの全貌」 「発展編」 会社で使うGradle
Recently James Ward wrote a great blog post, “Java Doesn’t Suck – You’re Just Using it Wrong”, which highlighted numerous challenges that enterprise Java developers face in their daily routines building Java applications. The good news is that breaking out of the development rut is much easier than you may think. Over the last few years, Spring has redefined how modern Java applications are built
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く