javabeans

Having spring bean properties refreshed automatically from properties file

眉间皱痕 提交于 2019-12-18 12:40:57
问题 I'm using Spring 2.5.6. I have a bean whose properties are being assign from a property file via a PropertyPlaceholderConfigurer. I'm wondering whether its possible to have the property of the bean updated when the property file is modified. There would be for example some periodic process which checks the last modified date of the property file, and if it has changed, reload the bean. I'm wondering if there is already something that satisfies my requirements. If not, what would be the best

Convert xml to java bean

家住魔仙堡 提交于 2019-12-18 12:32:11
问题 How can I covert a an xml file to a simple java bean? Its a simple xml file without any xsd, which was generated from a java bean, which I don't have access to. I tried using xmlbeans to first generate the xmd from xml and then to generate classes from the xsd. I got a bunch of classes. I am looking for a single java bean class. 回答1: JAXB JAXB (JSR-222) provides an easy way to convert objects to XML. There are many open source implementations of this standard including: Metro JAXB (the

How does Spring bean Handle concurrency

霸气de小男生 提交于 2019-12-18 10:43:06
问题 My web application uses Spring IOC. So all my spring beans will be singletons by default. In case if two requests try to access two different methods of a single class (for example MySpringBean is a class which has two methods searchRecord and insertRecord ) at the same time, both the methods will access the same spring bean concurrently. How does the same spring bean be available to both the clients at the same time or is it going to be concurrency problem when both the requests will try to

How does Spring bean Handle concurrency

﹥>﹥吖頭↗ 提交于 2019-12-18 10:42:25
问题 My web application uses Spring IOC. So all my spring beans will be singletons by default. In case if two requests try to access two different methods of a single class (for example MySpringBean is a class which has two methods searchRecord and insertRecord ) at the same time, both the methods will access the same spring bean concurrently. How does the same spring bean be available to both the clients at the same time or is it going to be concurrency problem when both the requests will try to

@ManagedProperty(value = “#{param.id}”) in a non-request Scope Bean

被刻印的时光 ゝ 提交于 2019-12-18 10:14:23
问题 I need to pass a parameter (POST) to a @managedBean, I used managed properties like this: @ManagedProperty(value = "#{param.id}") private int id; And the scope of the Bean is ViewScope I end up with this error: Unable to create managed bean receipt. The following problems were found: - The scope of the object referenced by expression #{param.id}, request, is shorter than the referring managed beans scope of view What can I do? arjan take a look: My page: Facelet Title <form method="post"

JSF - Problem with @ViewScope

久未见 提交于 2019-12-18 09:37:34
问题 I have a page that load (in a panelGroup) two different page, due to the login status (logged, not logged). This is the main switch : template.xhtml P.S. selector.page is "homepage" as default <h:panelGroup layout="block" styleClass="contenitore"> <h:panelGroup layout="block"> <h:panelGroup layout="block" styleClass="menu_table" id="login"> <ui:insert name="login_homepage" /> </h:panelGroup> <h:panelGroup layout="block" id="content"> <c:catch> <ui:include src="/#{selector.page}/#{selector

h:selectOneMenu generic converter for all entities without calling DB again and again

我是研究僧i 提交于 2019-12-18 08:55:37
问题 I want to get selected object from <h:selectOneMenu> , but the problem is I couldn't find any generic converter for all type of entities. My first question is, is there a generic converter for all type of entities? I don't want to write another converter again for each other entity. My second question is, is there a way to get selected object without any converter? I don't want to call the DB again and again. I have a Car entity with id and name properties. 回答1: My first question is, is there

Confused about naming of JavaBean properties, with respect to getters and setters

隐身守侯 提交于 2019-12-18 06:14:20
问题 I am making an application that uses Drools planner. The @ValueRangeFromSolutionProperty is supposed to refer to a property from another class ( NQueens in this case). From the JavaDocs for @ValueRangeFromSolutionProperty: propertyName The property name of which exists a getter on the Solution that returns a Collection. But I noticed an inconsistency : the annotator uses the property rowList from NQueens . But rowList (as opposed to RowList ) is a private variable (see snippets below). If it

Confused about naming of JavaBean properties, with respect to getters and setters

假如想象 提交于 2019-12-18 06:14:12
问题 I am making an application that uses Drools planner. The @ValueRangeFromSolutionProperty is supposed to refer to a property from another class ( NQueens in this case). From the JavaDocs for @ValueRangeFromSolutionProperty: propertyName The property name of which exists a getter on the Solution that returns a Collection. But I noticed an inconsistency : the annotator uses the property rowList from NQueens . But rowList (as opposed to RowList ) is a private variable (see snippets below). If it

Dynamic java bean from xsd

核能气质少年 提交于 2019-12-18 05:07:11
问题 I have two applications, one acting as client and the other as server. In server application I generate ObjectFactory and classes using xjc from Eclipse. As a result, one of this classes is called widgetEvenCall. From the xsd: ... <xs:element name="widgetEventCall"> <xs:complexType> <xs:sequence> <xs:element minOccurs="1" maxOccurs="1" ref="tns:widgetEventDescriptor" /> <xs:element minOccurs="0" maxOccurs="unbounded" ref="tns:widgetParameter" /> </xs:sequence> </xs:complexType> </xs:element>