Browse files

@Dependent with scala and CDI, still no problem

  • Loading branch information...
1 parent 99f7381 commit eae25966fb28d51f86f844648658db16cb0618f5 @ceefour committed Jan 22, 2012
View
14 .project
@@ -6,32 +6,32 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <name>org.scala-ide.sdt.core.scalabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.cdi.core.cdibuilder</name>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.scala-ide.sdt.core.scalabuilder</name>
+ <name>org.jboss.tools.ws.jaxrs.metamodelBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.jboss.tools.ws.jaxrs.metamodelBuilder</name>
+ <name>org.jboss.tools.cdi.core.cdibuilder</name>
<arguments>
</arguments>
</buildCommand>
@@ -54,9 +54,9 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
- <nature>org.jboss.tools.cdi.core.cdinature</nature>
<nature>org.jboss.tools.jsf.jsfnature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.jboss.tools.ws.jaxrs.nature</nature>
+ <nature>org.jboss.tools.cdi.core.cdinature</nature>
</natures>
</projectDescription>
View
4 .settings/org.eclipse.mylyn.tasks.ui.prefs
@@ -0,0 +1,4 @@
+#Sun Jan 22 03:38:38 WIT 2012
+eclipse.preferences.version=1
+project.repository.kind=local
+project.repository.url=local
View
39 .settings/org.scala-ide.sdt.core.prefs
@@ -0,0 +1,39 @@
+#Sun Jan 22 03:38:40 WIT 2012
+P=
+Xcheck-null=false
+Xcheckinit=false
+Xdisable-assertions=false
+Xelide-below=-2147483648
+Xexperimental=false
+Xfatal-warnings=false
+Xfuture=false
+Xlog-implicits=false
+Xmigration=false
+Xno-uescape=false
+Xpluginsdir=misc/scala-devel/plugins
+Ybuild-manager-debug=false
+Yno-generic-signatures=false
+Yno-imports=false
+Ypresentation-debug=false
+Ypresentation-delay=0
+Ypresentation-verbose=false
+Yrecursion=0
+Yself-in-annots=false
+Ystruct-dispatch=poly-cache
+Ywarn-dead-code=false
+buildmanager=sbt
+compileorder=Mixed
+deprecation=false
+eclipse.preferences.version=1
+explaintypes=false
+g=vars
+no-specialization=false
+nowarn=false
+optimise=false
+organizeimports.expandcollapse=expand
+organizeimports.groups=java$scala$org$com
+organizeimports.wildcards=scalaz$scalaz.Scalaz
+scala.compiler.useProjectSettings=false
+target=jvm-1.5
+unchecked=false
+verbose=false
View
3 src/main/scala/com/soluvas/scalacdi/IndexBean.scala
@@ -4,6 +4,7 @@ import javax.inject.Named
import org.slf4j.LoggerFactory
import javax.annotation.PostConstruct
import scala.reflect.BeanProperty
+import javax.cache.annotation.CacheResult
/**
* Testing @RequestScoped bean.
@@ -17,5 +18,7 @@ class IndexBean {
@PostConstruct def init(): Unit = {
log.info("IndexBean started at {}", getClass())
}
+
+ @CacheResult def getAddress() = "5015 Elm Street"
}
View
24 src/main/scala/com/soluvas/scalacdi/NormalBean.scala
@@ -0,0 +1,24 @@
+package com.soluvas.scalacdi
+import javax.enterprise.context.RequestScoped
+import javax.inject.Named
+import org.slf4j.LoggerFactory
+import javax.annotation.PostConstruct
+import scala.reflect.BeanProperty
+import javax.cache.annotation.CacheResult
+
+/**
+ * Testing @Dependent bean.
+ */
+@Named
+class NormalBean {
+
+ private val log = LoggerFactory.getLogger(classOf[NormalBean])
+ @BeanProperty var plant = "Fungi"
+
+ @PostConstruct def init(): Unit = {
+ log.info("NormalBean started {}", getClass())
+ }
+
+ @CacheResult def getLeaf() = "Greenlight"
+
+}
View
3 src/main/webapp/index.xhtml
@@ -8,7 +8,10 @@
<title>Scala-CDI Index</title>
</h:head>
<h:body>
+ <p>@Dependent Plant: #{normalBean.plant}</p>
+ <p>@Dependent @CacheResult Address: #{normalBean.leaf}</p>
<p>@RequestScoped City: #{indexBean.city}</p>
+ <p>@RequestScoped @CacheResult Address: #{indexBean.address}</p>
<p>@SessionScoped Name: #{userBean.name}</p>
<p>@ApplicationScoped Name: #{appBean.car}</p>
<ol>

0 comments on commit eae2596

Please sign in to comment.