beans

java/spring printing out bean property values

Hey, does anybody have a simple way of printing out bean property values ? Without complicated instrospection constructs via getting propertyDescriptors etc. I'm talking about testing and checking that all properties have correct values, during development. ...

Importing Spring beans from other Maven modules inside a WAR?

I have a new web app that is packaged as a WAR as part of a multi-module Maven project. The applicationContext.xml for this WAR references beans that are imported from the "service" module, which in turn imports beans from the "dao" module. The import statement in applicationContext.xml looks like this: <import resource="classpath*:se...

How to define private getter method in Groovy Bean?

I used following code. class Bike{ def manufacturer; private getManufacturer(){ manufacturer } } But I was able invoke getter method from another class. ...

Managedbean could not be created Error While passing parameters on URL

Hi I'm trying to pass parameters on URL but I get Managed bean "Cant instantiate class:" error. Code is Here: create url: <h:outputLink id="link" value="#{facesContext.externalContext.requestContextPath}/Public/Home/altKanallar.jsf?id=#{item.id}&name=#{item.name}"> <h:outputText value="#{item.name}" /> </h:outputLink> ...

spring mvc dao and service bean mapping

I am new to Spring and hibernate. I am trying to learn the best practices and design methodoligies in j2ee apps. I have a managed to create a basic spring mvc web app. now lookin for that - how should i map my service beans to dao beans or should just use dao beans only. - Is there any need to make DAO classes singleton - If i use s...

Spring framework question

Spring is well used these days. Are there any deficiencies of spring. Can it handle very heavy load? ...

Spring bean fields injection

Using Spring IoC allows to set bean properties exposed via setters: public class Bean { private String value; public void setValue(String value) { this.value = value; } } And the bean definition is: <bean class="Bean"> <property name="value" value="Hello!"> </bean> Is there any existing plugins/classes for S...

Mockito mocks with Spring: "Argument passed to verify() is not a mock!"

Hello, I used the code from this blog to inject Mockito mocks in my unit tests. However, before the mock is autowired it gets wrapped by Spring in a JDK proxy. This causes any verify(autowiredMock) to throw "Argument passed to verify() is not a mock!". The exception is thrown when Mockito is checking that the argument passed to verify(....

Error in jsp when i use bean , can any one help?

I want to use bean in my jsp page but run time occure and i can't resolve. Error: An error occurred at line: 28 in the jsp file: /WEB-INF/AdminPages/AddUser.jsp listOfGroupNo cannot be resolved 25: %> 26: <%! void addGroup(int no) { 27: 28: listOfGroupNo.getGroupList().add(no); 29: } 30: 31: %> is that error means the obj...

Get access to all spring beans of a given type

Hi, I have a Spring application (Spring Batch not web application). In a test class, I want to grab access to all of my beans of a given type. I understand that in Spring you should generally use IOC and let the container inject your beans. However in this case, I want to loop through a variable number of beans that extend a given cla...

Groovy: Setting property values easily

I have a map with name/value pairs: def myMap = [ "username" : "myname", "age" : 30, "zipcode" : 10010 ] I have a class called User defined: class User { def username; def age; def zipcode; } I would like to invoke the appropriate setters on the bean. Is there a nice groovy way of doing this? Note, I might have extra...

Why is a dynamic created JSF EL value expression not resolved?

Hi, I got a simple setup (and a big issue): a JSP page with en empty panel grid item container and a binding to a bean. <h:panelGrid binding="#{ bean.container }" id="container" /> When the getter of the bean will be called, the container is filled with a random number of columns with a command link inside. So far so good. The contai...

What does my Servlet have that my JSP is missing?

I am currently working my way through a Sam's Teach Yourself JSP. In one chapter, we wrote a crude shopping cart application which used Servlets for various functions. Come Chapter 14, we replace most of those servlets with JSP using beans. For some reason that is eluding me, my JSP isn't working. Here is the functional servlet: ...

Java method naming conventions

I have a boolean field called showLabels in a Bean class, and I want to provide getter and setter methods for it. The setter will be setShowLabels, but should the getter be isShowingLabels, isShowLabels (that's really weird sounding), or setShowLabels? ...

Anonymous Spring bean

How is an anonymous Spring bean useful? ...

useBean setProperty not behaving as advertised

I'm trying to use "auto wiring" between request attributes and a bean with <jsp:useBean id="cib" class="(fqn).CarInfoWebBean" scope="request"> <jsp:setProperty name="cib" property="*" /></jsp:useBean> but the setter of the (only) property doesn't get called. The bean property is of type long, and the property name and attribu...

How to prevent groovy from creating lowercase (meta) property names?

Hi folks, I've a problem. I want to have nice dynamic groovy classes to represent an ugly XML structure (unfortunately JAXB, XmlBeans etc. is not possible). For this goal I need case-sensitive properties to map the element values from XML to my classes. But Groovy generates automatically lowercase property names due to the JavaBeans sp...

When method marked with @PostConstruct called?

At which phase of the JSF request processing lifecycle, the backing bean method marked with @PostConstruct called? ...