Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some deprecated at 2.6.x #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/main/scala/com/actimust/play/spring/SpringBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@ import java.lang.annotation.Annotation
import javax.inject.Provider

import org.springframework.beans.TypeConverter
import org.springframework.beans.factory.FactoryBean
import org.springframework.beans.factory.NoSuchBeanDefinitionException
import org.springframework.beans.factory.NoUniqueBeanDefinitionException
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
import org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver
import org.springframework.beans.factory.annotation.{AutowiredAnnotationBeanPostProcessor, QualifierAnnotationAutowireCandidateResolver}
import org.springframework.beans.factory.config.AutowireCapableBeanFactory
import org.springframework.beans.factory.config.BeanDefinition
import org.springframework.beans.factory.config.BeanDefinitionHolder
import org.springframework.beans.factory.config.{AutowireCapableBeanFactory, BeanDefinition, BeanDefinitionHolder}
import org.springframework.beans.factory.support._
import org.springframework.beans.factory.{FactoryBean, NoSuchBeanDefinitionException, NoUniqueBeanDefinitionException}
import org.springframework.context.annotation.AnnotationConfigApplicationContext
import play.api._
import play.api.inject._
import play.api._

import scala.collection.JavaConverters._
import scala.reflect.ClassTag
Expand Down Expand Up @@ -53,7 +44,7 @@ abstract class SpringBuilder[Self] protected (
/**
* Set the environment mode.
*/
final def in(mode: Mode.Mode): Self =
final def in(mode: Mode): Self =
copyBuilder(environment = environment.copy(mode = mode))

/**
Expand Down Expand Up @@ -157,7 +148,7 @@ abstract class SpringBuilder[Self] protected (
//build modules
val modulesToRegister = applicationModule()

val disabledBindings = configuration.getStringSeq("play.bindings.disabled").getOrElse(Seq.empty)
val disabledBindings = configuration.getOptional[Seq[String]]("play.bindings.disabled").getOrElse(Seq.empty)
val disabledBindingClasses: Seq[Class[_]] = disabledBindings.map(className => loadClass(className))

//register modules
Expand All @@ -172,7 +163,7 @@ abstract class SpringBuilder[Self] protected (
)
}

val springConfig = configuration.getStringSeq("play.spring.configs").getOrElse(Seq.empty)
val springConfig = configuration.getOptional[Seq[String]]("play.spring.configs").getOrElse(Seq.empty)
val confClasses: Seq[Class[_]] = springConfig.map(className => loadClass(className))
if(confClasses.nonEmpty) {
ctx.register(confClasses:_*)
Expand Down Expand Up @@ -288,8 +279,7 @@ class BindingKeyFactoryBean[T](key: BindingKey[T], objectType: Class[_], factory

private def getNameFromMatches(candidates: Seq[String]): Option[String] = {
candidates match {
case Nil => throw new NoSuchBeanDefinitionException(key.clazz, "Binding alias for type " + objectType + " to " + key,
"No bean found for binding alias")
case Nil => throw new NoSuchBeanDefinitionException(key.clazz, "No bean found for binding alias for type " + objectType + " to " + key)
case single :: Nil => Some(single)
case multiple => throw new NoUniqueBeanDefinitionException(key.clazz, multiple.asJava)
}
Expand Down