import org.springframework.context.annotation.Bean; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
import org.springframework.stereotype.Component; | |
import org.springframework.web.servlet.config.annotation.CorsRegistry; | |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.config.CookieSpecs; | |
import org.apache.http.client.config.RequestConfig; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClients; | |
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import org.springframework.boot.web.client.RestTemplateCustomizer; |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.http.HttpHeaders; | |
import org.springframework.http.HttpRequest; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.client.ClientHttpRequestExecution; | |
import org.springframework.http.client.ClientHttpRequestInterceptor; | |
import org.springframework.http.client.ClientHttpResponse; | |
import org.springframework.util.StreamUtils; |
package demo; | |
import static java.lang.reflect.Modifier.*; | |
import java.util.Arrays; | |
import java.util.Set; | |
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.beans.factory.config.BeanExpressionResolver; |
Tired of spinning up SBT just to wire in some dependencies for a quick REPL session? Me too! The following pair of scripts completely resolves this issue. Well, mostly…
list-jars
is not actually an Ivy2 resolver. What it does is enumerate all possible JARS within ~/.ivy2/cache
(in other words, it excludes locally published artifacts), filters them where relevant for only Scala 2.11 cross-builds, and then orders them (via a very primitive partial ordering) by version, always selecting the latest one. No attempt is made to do any real dependency resolution and JAR hell escaping! So…if something doesn't work, you're on your own.
The fun thing is that you can just launch scala-ivy
and use all your fancy third-party libraries without having to do any classpath setup.
#!/bin/bash | |
# From ScalaCourses.com Introduction to Play Framework with Scala course | |
# https://www.scalacourses.com/student/showLecture/158 | |
set -eo pipefail | |
function help { | |
echo "Download or update Typesafe Activator on Linux and Cygwin" | |
echo "Usage: $(basename $0) [options]" |
package object mail { | |
implicit def stringToSeq(single: String): Seq[String] = Seq(single) | |
implicit def liftToOption[T](t: T): Option[T] = Some(t) | |
sealed abstract class MailType | |
case object Plain extends MailType | |
case object Rich extends MailType | |
case object MultiPart extends MailType |
package coolcode | |
import java.io.File | |
import java.util.Properties | |
import org.scalatra.ScalatraServlet | |
class StaticFileServlet extends ScalatraServlet { | |
get("/*") { | |
val resourcePath = getResourcePath |
package object mail { | |
implicit def stringToSeq(single: String): Seq[String] = Seq(single) | |
implicit def liftToOption[T](t: T): Option[T] = Some(t) | |
sealed abstract class MailType | |
case object Plain extends MailType | |
case object Rich extends MailType | |
case object MultiPart extends MailType |