jboss-weld

CDI beans inside .jar are not found by the container (Unsatisfied dependencies)

最后都变了- 提交于 2020-12-05 05:01:06
问题 I have created a Java project to serve as a lib to other projects, reducing code duplication between projects. This lib project is exported to jar to be included in Web projects (WAR, not EAR). In Web projects (where these classes are being removed) everything worked as usual while all classes were kept on them ─ the injection of simple and complex objects (those with Producers and settings) was working normally. After removing these classes of the Web projects and add the jar with these same

CDI/Weld unable to do constructor injection of RESTEasy resource

江枫思渺然 提交于 2020-02-21 14:06:04
问题 I'm trying to combine RESTEasy with Weld on AppEngine but having troubles to do constructor injection. I've added the RESTEasy CdiInjectorFactory context param and the Weld servlet listener. My RESTEasy application class looks like: public class MyApplication extends Application { @Override public Set<Class<?>> getClasses() { HashSet<Class<?>> classes = new HashSet<Class<?>>(); classes.add(CustomerResource.class); return classes; } } and the CustomerResource: @Path("/rest/app/customers")

CDI Ambiguous dependencies

扶醉桌前 提交于 2020-01-12 13:52:33
问题 I have a @SessionScoped @Named bean with a @Producer method for a user object: @Named @SessionScoped public class UserBean implements Serializable { //... @Named @Produces @LoggedIn @SessionScoped public MyUser getCurrentUser() {return user;} } This works fine in my setup (JBoss-7.1.1-Final) and it's no problem to access the user fields from JSF pages with #{currentUser.name} . The qualifier is org.jboss.seam.security.annotations.LoggedIn . Now I want to @Inject this user in a field in

JBoss Weld + java.lang.OutOfMemoryError: PermGen space

亡梦爱人 提交于 2020-01-12 13:46:28
问题 I've just switched to Weld to make use of CDI JSF 2 Beans + conversation scope. Here's my maven dependency : <dependency> <groupId>org.jboss.weld.servlet</groupId> <artifactId>weld-servlet</artifactId> <version>1.0.1-Final</version> <type>jar</type> <scope>compile</scope> </dependency> Here's the entry in my web.xml : <listener> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class> </listener> One thing i noticed immediately is i just need to reload my tomcat 7 for like

JBoss Weld + java.lang.OutOfMemoryError: PermGen space

雨燕双飞 提交于 2020-01-12 13:44:05
问题 I've just switched to Weld to make use of CDI JSF 2 Beans + conversation scope. Here's my maven dependency : <dependency> <groupId>org.jboss.weld.servlet</groupId> <artifactId>weld-servlet</artifactId> <version>1.0.1-Final</version> <type>jar</type> <scope>compile</scope> </dependency> Here's the entry in my web.xml : <listener> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class> </listener> One thing i noticed immediately is i just need to reload my tomcat 7 for like

JEE6 REST Service @AroundInvoke Interceptor is injecting a null HttpServletRequest object

折月煮酒 提交于 2020-01-12 07:54:05
问题 I have an @AroundInvoke REST Web Service interceptor that I would like to use for logging common data such as the class and method, the remote IP address and the response time. Getting the class and method name is simple using the InvocationContext, and the remote IP is available via the HttpServletRequest, as long as the Rest Service being intercepted includes a @Context HttpServletRequest in its parameter list. However some REST methods do not have a HttpServletRequest in their parameters,

Get the real object from CDI Proxy

六眼飞鱼酱① 提交于 2020-01-05 03:31:11
问题 I looked for a clean CDI solution and not a WELD dependent one but so far nothing... I need to test if every element of a list of objects that I get with @Inject @Any MyInterface beans is a proxy, and when true I need to get the real object to do introspection and get all the properties of the object. My WELD implementation: MyInterface interf = obj; if (isProxy(interf )) { interf = (Config) ((TargetInstanceProxy)interf ).getTargetInstance(); } where isProxy is so defined (CDI solution?):

How do I combine @Asynchronous and Weld/CDI Events and @Observes(during=TransactionPhase.AFTER_COMPLETION) in Glassfish 3.1

谁说胖子不能爱 提交于 2020-01-03 11:30:08
问题 First of all let me state, that the following code example worked just fine in GF 3.0.1. The troubles started when we switched to GF 3.1. I'm using a method @Asynchronous public void executeFlowStep( @Observes(during=TransactionPhase.AFTER_COMPLETION) ExecuteFlowStepEvent executeFlowStepEvent) { Since the switch, whenever this should receive an ExecuteFlowStepEvent I get the following error message: WELD-000401 Failure while notifying an observer of event [package].ExecuteFlowStepEvent No

Inject a Entity into a ViewScoped Bean

只愿长相守 提交于 2020-01-03 02:28:33
问题 I am new to CDI and want to use this for a JSF2 application. The class MyUser is a simple @Entity -Bean and a object is created in a @PostConstruct method in bean: @Stateful @Named @javax.faces.bean.SessionScoped public class UserBean implements Serializable { @Named private MyUser user; //setter and getter //@PostConstruct } Accessing the user in a JSF pages works like a charm: #{user.lastName} . But now I want to access this object from other beans, e.g. in this @ViewScopedBean : @Named

JSF2 managed bean annotation + scope + injection confusion

南楼画角 提交于 2020-01-01 05:37:08
问题 I would like to achieve this idealism : To have only 1 implementation for the JSF Bean container, like to use only Spring or Weld but not both. Currently i am using Spring for my backend, so i prefer Spring. To have only 1 annotation, to choose between @ManagedBean, @Named, @Model To be able to use all supported scopes, like @RequestScoped, @SessionScoped, @ViewScoped, @FlashScoped, maybe also @ConversationScoped The JSF Beans could be injected with spring-managed-services (The backend