Spring Actuatorで登録されてるBeanをみようと思って、pom.xmlにSpring Actuatorを追加しました。(以下参照)
Versionはご自由にどうぞ!
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> <version>1.5.1.RELEASE</version> </dependency>
そして「http://localhost:8080/beans」にアクセース!
「401:Unauthorized」が返ってきました。あれ?と思いログ見ると次の出力が!
「Full authentication is required to access actuator endpoints. Consider adding Spring Security or set 'management.security.enabled' to false.」
仕様変わったのか!(前記事で見たような)と思いログの出力のとおりに。
まず、pom.xmlにこれを追加。
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
次に、application.propertiesにこれを追加。
management.security.enabled=false
再度、「http://localhost:8080/beans」にアクセース!よし見れた!
もしくは、ユーザにACTUATORを権限をつけるとみれます。
ちなみに、Spring Securityを使うとデフォルトでベーシック認証が有効になっているので無効にする場合は、application.propertiesに以下を追加してください。
security.basic.enabled=false
詳細はここに書いてあります。
48. Monitoring and management over HTTP