반응형

스프링 부트 1.5 릴리즈 노트

원문: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-1.5-Release-Notes

스프링 부트 1.4에서 업그레이드된 것

스프링부트 1.4이후 디프리케이트된것들

스프링부트 1.4에서 디프리케이트된 클래스, 메소드 그리고 프로퍼티들이 이번 릴리즈에서 제거되었다. 업그레이드전 디프리케이트된 메소드를 호출하는지 확인하자. 특히 HornetQ와 벨로시티 Velocity서포트가 삭제되었다.


이름이 바뀐 스타터들

스프링부트 1.4에서 이름이 바뀐 다음의 스타터들이 이번에 삭제되었다. 만일 "해결할수 없는 의존성 Unresolved dependency" 에러가 뜬다면 사용중인 스타터 이름이 올바른지 확인해보자:

  • spring-boot-starter-ws → spring-boot-starter-web-services

  • spring-boot-starter-redis → spring-boot-starter-data-redis

@ConfigurationProperties validation

JSR-303 규약 어노테이션을 사용하는 @ConfigurationProperties 클래스를 가지고 있다면 이제 그것들에 추가적으로 @Validated 어노테이션을 해줘야한다. 이미 있는 유효성은 여전히 잘 동작할것이지만 로그에 warning이 뜬것이다. 머지않아 @Validated 이 없는 클래스는 사용할 수 없을 것이다. 

스프링 세션 저장 Spring Session store

이제껏 스프링 세션과 레디스를 특별한 설정없이 사용해왔다면, 레디스는 자동으로 세션을 저장하는데 사용되었다. 이제는 저장 타입을 명시해주어야한다. 레디스와 스프링 세션을 사용하는 사용자들은 다음의 설정을 추가 해주어야한다:

spring.session.store-type=redis

액츄에이터 보안 Actuator security

Actuator "sensitive" endpoints are now secure by default (even if don’t have a dependency on "Spring Security"). If your existing Spring Boot 1.4 application makes use of Spring Security (and doesn’t have any custom security configuration) things should work as before. If your existing Spring Boot 1.4 application has custom security configuration and you wish to have open access to your sensitive endpoints, you will need to explicitly configure that in your security configuration. If you’re upgrading a Spring Boot 1.4 application that doesn’t have dependency on Spring Security and you wish to retain open access to your sensitive endpoints you’ll need to set management.security.enabled to false. See the updated reference documentation for more details.

The default role required to access the endpoints has also changed from ADMIN to ACTUATOR. This is to prevent accidental exposure of endpoints if you happen to use the ADMIN role for other purposes. If you want to restore Spring Boot 1.4 behavior set the management.security.roles property to ADMIN.

인메모리 매트릭스 리파지토리 InMemoryMetricRepository

InMemoryMetricRepository는 더이상 직접적으로 MultiMetricRepository를 구현하지않는다.  정식 InMemoryMetricRepository에 의해 뒷받침되어 MultiMetricRepository 인터페이스를 만족시키는 새로운 InMemoryMultiMetricRepository 빈이 이제 등록되었다. 대부분의 사용자가 MetricRepository 또는 MultiMetricRepository 인터페이스를 사용하고 있으므로 이 변화는 직접 보여지지않는다.  

spring.jpa.database

The spring.jpa.database 는 spring.datasource.url 프로퍼티를 통한 일반적인 데이터 베이스를 자동으로 찾아준다. 만일 spring.jpa.database를 수동으로 정의하며 사용해왔고 일반적인 데이터베이스를 사용하고 있다면 이 프로퍼티들을 다 없애버려도 될것이다.

하나 이상의 Dialect 를 가진 몇몇의 데이터베이스 (이를테면 Microsoft SQL Server 는 3개를 가지고있다) 그리고 당신이 사용중인 데이터베이스의 버젼이 설정한 것과 맞지 않는다면, 이전에 잘 작동한 설정을 가지고 하이버네이트의 Dialect자동 찾기에 맡기기 원한다면 spring.jpa.database=default 로 설정하자. 대안으로  spring.jpa.database-platform 프로퍼티를 사용하여 당신의 dialect를 설정할 수 있다.

@IntegrationComponentScan

스프링 Integration의 @IntegrationComponentScan 어노테이션은 이제 자동 설정된다. 권장되는 프로젝트 구조를 따른다면 당신은 이것을 지워줘야한다.

ApplicationStartedEvent

현재 당신의 코드에서 ApplicationStartedEvent를 위한 리스너 listener가 있다면,  ApplicationStartingEvent를 쓰도록 코드를 리팩토링 해주어야한다. 우리는 이 클래스가 무엇을 하는지 더 정확하게 알수 있게 이름을 바꾸었다.

Spring Integration Starter

spring-boot-starter-integration POM 은 더이상 spring-integration-jmx를 포함되지 않는다. 만일 당신이 Spring Integration JMX support가 필요하다면 spring-integration-jmx 의존성을 스스로 추가해줘어야한다.

Devtools excluded by default

메이븐과 그레들 플러그인 둘다 이제 기본적으로 "fat" jars에 spring-boot-devtools jar를 패키징 하지않는다. 당신이 devtools 원격 서포트를 사용중이라면, 이제 당신의 build.gradle 또는 pom.xml 파일에 excludeDevtools 프로퍼티를 명시적으로 설정해주어야한다.

Gradle 1.x

스프링 부트 그래들 플러그인은 이제 더이상 그래들 1.x와 그래들 2.x 초기버전과 호환되지 않는다. 그래들 2.9 이상 버전인지 확인하자.

Remote CRaSH shell

불행히도 remote SSH support을 제공하고저 스프링부트에서 사용하는 CRaSH project 는 더이상 유지가 되지않고 있으므로 우리는 remote actuator SSH support을 디프리케이트 하기로 결정하였고 스프링 부트 2.0에서 완전히 제거될 예정이다.

OAuth 2 Resource Filter

OAuth2 리소스 필터의 기본 순서가 3에서 SecurityProperties.ACCESS_OVERRIDE_ORDER - 1 로 변경되었다. 이 지점은 the actuator endpoints 바로 뒤이고 basic authentication filter chain 전이다. 이 기본값은 security.oauth2.resource.filter-order = 3 으로 설정하면 예전값으로 되돌릴 수 있다.

JSP servlet

JSP 서블릿응ㄴ 이제 더이상 기본값으로 개발모드가 아니다. 개발 모드는 DevTools을 쓸때 자동적으로 활성화 된다.  server.jsp-servlet.init-parameters.development=true.설정을 통해 명시적으로 활성화 할 수도 있다. 

Ignored paths and @EnableWebSecurity

스프링 부트 1.4 또는 이전 버전에서 Actuator는 항상 어떤 Ignored paths를 설정하여 @EnableWebSecurity의 사용을 무시해왔다. 이것은 1.5에서 바로 잡았으며  @EnableWebSecurity 를 사용하면 당신에게 완전한 제어가 가능했던 웹 보안의 자동 설정이 꺼질 것이다.

새로운 사항 및 주목할만한 점

Tip
Check the configuration changelog for a complete overview of the changes in configuration.

Third-party library upgrades

서드파티 라이브러리의 버전이 최신 버젼으로 업그레이드 되었다. 이 업데이트는 pring Data Ingalls, Jetty 9.4, JooQ 3.9, AssertJ 2.6.0, Hikari 2.5 그리고 Neo4J 2.1 이며 몇몇 메이븐 플러그인도 업그레이드 되었다.

Loggers endpoint

새로운 액츄에이터 loggers endpoint는 동작중인 어플리케이션의 로깅 레벨을 바꿀수 있게 해준다. 이는 JMX와 MVC endpoint에도 사용할수있다. 예를 들면 MVC endpoint의 로깅레벨을 바꾸려면 다음의 JSON를 /loggers/com.yourcorp.application에  post로 이슈해주면 된다:

{
  "configuredLevel": "DEBUG"
}

JMX endpoint를 사용하는 로거를 업데이트하려면  setLogLevel 를 사용하면 되는데 자세한 사항은 the updated documentation에서 확인하자.

Apache Kafka support

스프링 부트 1.5는 spring-kafka프로젝트를 통해 아파치 Kafka 자동설정을 지원한다. 손쉽게 Kafka를 사용하려면  spring-kafka 의존성과 `spring.kafka.* 어플리케이션 프로퍼티를 적절하게 설정해주면 된다.

Kafka로 부터 메세지를 받으려면 어노테이션 메소드를 쓰는게 제일 간단하다: 

@Component
public class MyBean {

    @KafkaListener(topics = "someTopic")
    public void processMessage(String content) {
        // ...
    }

}

Cloud Foundry actuator extensions

Spring Boot’s actuator module now includes additional support that is activated when you deploy to a compatible Cloud Foundry instance. The /cloudfoundryapplication path provides an alternative secured route to all NamedMvcEndpoint beans.

Cloud Foundry management UIs can make use of the endpoint to display additional actuator information. For example, Pivotal Cloud Foundry shows health information next to the application status:

apps manager

You can read more about the Cloud Foundry endpoint in the reference documentation and for and example of the kinds of things it can be used for you can read this blog post about PCF 1.9.

LDAP support

스프링 부트는 이제 어떤 표준 규약을 따르는 LDAP 서버를 자동설정해준다. 뿐만 아니라 Unbounded를 사용하여 내장 인메모리 LDAP 서버를 지원한다.

자세한 사항은 the documentation를 확인하자.

AuditEvents Endpoint Support

A new AuditEventsJmxEndpoint bean now allows you to query previously recorded AuditEvents over JMX. The MBean exposes AuditEventRepository find methods via getDataoperations. Audits are automatically recoded for authentication and authorization event and you can record your own events using the AuditEventRepository. That information is also exposed by a new /auditevents MVC endpoint.

Transaction manager properties

이제  spring.transaction.* 프로퍼티를 사용하여 PlatformTransactionManager를 자동설정해주는 다양한 aspects를 설정하는것이 가능해졌다. 현재는 "default-timeout" 과  rollback-on-commit-failure 프로퍼티가 지원된다.

JmxEndpoint interface

새로운 JmxEndpoint 인터페이스가 소개되어 당신이 액츄에이터 actuator endpoint를 JMX를 통해서만 노출되도록 개발할 수 있다. 이 인터페이스는 이미 MVC only endpoint를 제공해주는  MvcEndpoint 인터페이스와 매우 유사하다.

Vendor specific flyway migrations

You can now define flyway migration that are specific to a database vendor. To use vendor specific migrations, set the flyway.locations property as follows:

flyway.locations=db/migration/{vendor}

See this how-to for more details.

Deprecation level

It is now possible to define a deprecation level for a property in the metadata. The level can either be warning (default) or error.

Here is an example of manual metadata for a property that got moved in Spring Boot 2:

{
  "name": "server.context-parameters",
  "type": "java.util.Map<java.lang.String,java.lang.String>",
  "description": "ServletContext parameters.",
  "deprecation": {
    "level": "error",
    "replacement": "server.servlet.context-parameters"
  }
}

So far, when a deprecated property is not bound anymore, we remove the metadata altogether. This new feature allows to flag a property (server.context-parameters here) as an error. Newer versions of your favorite IDE should use that to offer assistance.

테스팅 업데이트 Testing updates

이제 @Test…​a로 시작하는 어노테이션에 의해 임포트import되던 자동설정을 제외할 수 있게 되었다. 모든 현존하는  @Test…​어노테이션들은 이제 excludeAutoConfiguration 속성값을 가지게 되었다. 또 다른 방법으로 당신의 테스트코드에 직접적으로  @ImportAutoConfiguration(exclude=…​)를 추가해줘도 된다.

스프링 부트 1.5에서 새로운 @JdbcTest 어노테이션이 소개되어 직접 JDBC과 상호연동되는 테스트를 할 수 있다.

Custom fat jar layouts

스프링 부트 메이븐과 그래들 플러그인은 이제 far jar 레이아웃을 커스터마이즈할 수 있게 지원한다. 이 기능은 스프링부트의 영역 밖에서 개발된  다음과 같은 실험적인 레이아웃을 가능하게 해준다. 더 자세한 업데이트된 문서를 참고하자

JmsTemplate customizations

이제  spring.jms.template.* 네임스페이스의 추가된 키값을 사용하여 자동설정된  JmsTemplate을 커스터마이즈 할수 있게 되었다.

Miscellaneous

  • Mockito 2.x 은 이제  @MockBean 으로 사용할 수 있다.(Mockito 1.9 와 호환가능함)

  • 내장 런쳐 스크린트는 이제 a force-stop을 지원한다. 

  • 카산드라를 위한 새로운 health check가 추가되었다.

  • 카산드라 사용자 정의 타입들이 이제 해결되었다. (스프링 데이터의 SimpleUserTypeResolver를 통해)

  • The skip 프로퍼티는 이제  스프링 부트 메이븐 플러그인  run 에서, 'stop' 그리고 'repackage` goals 에서 사용할 수 있다.

  • 복수개의 main m메소드 클래스가 있다면, 메이븐과 그래들 플러그인은 이제 자동적으로  @SpringBootApplication 어노테이션이 있는것을 실행할 것이다.

Deprecations in Spring Boot 1.5

  • TomcatEmbeddedServletContainerFactory.setTldSkip has been deprecated in favor of setTldSkipPatterns

  • ApplicationStartedEvent has been replaced by ApplicationStartingEvent

  • Several constants in LoggingApplicationListener have been replaced by versions in LogFile

  • Caching with Guava has been deprecated since Guava support will be dropped in Spring Framework 5. Upgrade to Caffeine

  • CRaSH support has been deprecated since it’s no longer actively maintained

  • Several protected methods in EndpointMBeanExporter have been deprecated following the introduction of JmxEndpoint

  • SearchStrategy.PARENTS has been replaced with SearchStrategy.ANCESTORS.

  • Apache DBCP support has been deprecated in favor of DBCP 2

  • The server.undertow.buffers-per-region property has been deprecated because it is not used (see UNDERTOW-587)

  • @AutoConfigureTestDatabase has been moved from org.springframework.boot.test.autoconfigure.orm.jpa to org.springframework.boot.test.autoconfigure.jdbc

프로퍼티 이름변경 Property Renames

  • server.max-http-post-size 프로퍼티는 특정기술 형태값으로 바뀌었다. (예를 들면, server.tomcat.max-http-post-size)

  • spring.data.neo4j.session.scope 프로퍼티는 제거되었다.


반응형

+ Recent posts