Title: OpenWebBeans FAQ
Notice: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
# OpenWebBeans Configuration
Internal configuration of OpenWebBeans can be done via: src/main/resources/META-INF/openwebbeans/openwebbeans.properties
All those files contain at single property ``configuration.ordinal`` which defines their
'importance'. Any setting from a property file with a higher configuration.ordinal will
overwrite settings from one with a lower configuration.ordinal. The internally used
configuration.ordinal values range from 1 to 100. The default value is 100.
This trick allows us to split OpenWebBeans in different modules which automatically change the container
configuration if you put that jar on the classpath.
For overriding the default configuration with own settings simply put a ``META-INF/openwebbeans/openwebbeans.properties``
file into your projects classpath (e.g. into a jar) and either use a ``configuration.ordinal`` higher than 100 or leave
it empty to get the default value of 100.
If you use OpenWebBeans as part of another project then you can assume that most of the values got tweaked
by the integration regarding to the specific needs.
## Configure SPI implementations
OpenWebBeans provide a set of Service Provider Interfaces and multiple different implementations a user can choose from.
You can choose the implementations you like to use for your situation by configuring them in
``META-INF/openwebbeans/openwebbeans.properties``.
Read more about our SPIs in [OpenWebBeans SPI](openwebbeans-spi.html)
## Other Configurable Values
The following configuration values can get tweaked to get tailor OWB to your specific needs.
Boolean values can either be true
, or TRUE
, or false
, or FALSE
.
org.apache.webbeans.forceNoCheckedExceptions
Lifycycle methods like javax.annotation.PostConstruct
and
javax.annotation.PreDestroy
must not define a checked Exception
regarding to the spec. But this is often unnecessary restrictive so we
allow to disable this check application wide.
Defaults to true
.
org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService
Whether to perform EJB discovery or not.
Defaults to false
. In TomEE this gets automatically enabled.
org.apache.webbeans.application.jsp
If enabled, we automatically try to register the ELResolver in the JSP engine.
Enable this setting if you like to access @Named
CDI beans in JSP Expression Language.
Default is false
org.apache.webbeans.application.supportsConversation
Enable support for the CDI @ConversationScoped
.
Disabled by default in JavaSE, but enabled by default when adding the webbeans-web module (Servlets)
org.apache.webbeans.application.supportsProducerInterception
Define if a CDI interceptor can be used on a producer method or field.
In OpenWebBeans you can use a @StereoType
with an Interceptor to enable
an Interceptor on the instance returned from a Producer Method or Producer Field.
Enabled by default.
org.apache.webbeans.scanExclusionPaths
A list of known JARs/paths which should not be scanned for beans. This is only used by the default ScannerService implementation.
Please refer to the openwebbeans.properties file in ``webbeans-impl.jar``
org.apache.webbeans.scanBeansXmlOnly
Flag which indicates that only jars with an explicit META-INF/beans.xml marker file shall get parsed. This basically switches OWB back to the CDI-1.0 scanning behaviour and might speed up the boot process.
Default is false
org.apache.webbeans.ignoredDecoratorInterfaces
A comma-separated list of fully qualified class names that should be ignored when determining if a decorator matches its delegate.
Default is an empty list
org.apache.webbeans.web.eagerSessionInitialisation
By default we do _not_ force session creation in our WebBeansConfigurationListener. We only create the Session if we really need the SessionContext. E.g. when we create a Contextual Instance in it. Sometimes this creates a problem as the HttpSession can only be created BEFORE anything got written back to the client. With this configuration you can choose between 3 settings
Defaults to false. A session will only get created if a @SessionScoped
bean gets accessed for the first time.
org.apache.webbeans.generator.javaVersion
The Java Version to use for the generated proxy classes.
If auto
then we will pick the version of the current JVM.
Attention: If you like to use Java8 Lambdas in CDI bean method signatures then you need to
switch to either auto
or 1.8
!
The default is set to 1.6
as some tools in jetty/tomcat/etc still
cannot properly handle Java8 (mostly due to older Eclipse JDT versions).
javax.enterprise.inject.allowProxying.classes
Environment property which comma separated list of classes which should NOT fail with an UnproxyableResolutionException. You only have to configure additional classes in your openwebbeans.properties file. All the configured values get added together into a big List.
By default we allow the following classes: java.util.HashMap
and java.util.Calendar
org.apache.webbeans.proxy.mapping.javax.enterprise.context.ApplicationScoped =org.apache.webbeans.intercept.ApplicationScopedBeanInterceptorHandler org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped =org.apache.webbeans.intercept.RequestScopedBeanInterceptorHandler org.apache.webbeans.proxy.mapping.javax.enterprise.context.SessionScoped =org.apache.webbeans.intercept.SessionScopedBeanInterceptorHandlerAs you can see we use a prefix ``org.apache.webbeans.proxy.mapping.`` followed by the fully qualified scope name as key. The value represents the fully qualified name of the handler class. If you have a custom scope which spans a Request or longer then you can simply reuse the ``RequestScopedBeanInterceptorHandler`` as shown in the following example:
org.apache.webbeans.proxy.mapping.org.apache.deltaspike.core.api.scope.ViewAccessScoped =org.apache.webbeans.intercept.RequestScopedBeanInterceptorHandler##Enable FailOver / Session Replication support #### Since OpenWebBeans-1.5.0 OWB-1.5.x and later does *not* need any special module or filter to enable clustering. All that works out of the box as we now directly utilize the Servlet Session. #### OpenWebBeans-1.2.x Add the clustering module to your project: