What are good middle tier service app containers for scala?

I am starting to learn scala and am trying to create some simple applications to test the language better on disk.

I am looking for a non-intrusive framework / container for middle tier applications (not a web framework). I was originally going to start with spring as I am very familiar with it. However, given that scala provides a completely different way to do things than java. I wonder if spring is the best scala framework that can get the most out of scala. I would like to know if there are new and better ways to do things in the scala community.

My expectation for a framework / container will respond to the following items: configuration, modulation, monitoring (like JMX), dependent injection. other things like JPA, JMS, pooling would be a plus.

I've heard of Lift, but it seems to be more of a web framework.

thank

+2


source to share


2 answers


I was in a similar position for you, and I saved with Spring: it worked out just fine. The only annoyance is that my IDE (IntelliJ IDEA) has built-in Spring support and marks my Spring config files as filled with errors when they are fine.

I found that one thing I can do, instead of injecting multiple service implementations through Spring, is to use a composition of functions using Scala trait

s. For example, instead of using:

public SomeBusinessClass {
    private PersistenceService dao;
    private ValidationService validator;
    //setters, business logic etc
}

      



I could use:

public class SomeBusinessClass extends Persistence with Validation {
    @BeanProperty
    var dataSource: DataSource = _
}

      

While this is not as flexible as the Java version, for most applications the flexibility to switch between service implementations is not really needed. However, it still preserves the fact that persistent code doesn't fit in with the rest of the business logic.

+1


source


Have you looked into OSGi? Which I have seen in Scala wrappers ( ScalaModules ) as it is pretty impressive .



Remember, however, that Scala can perform type-safe dependency injection at compile time. I am not trying to get you into this by simply pointing out what you don’t have with Java.

+2


source







All Articles