Marks a class as a business object. An interface will be generated for this class, which it needs to implement. Each of the methods tagged with @spring.interface-method will be placed in the interface.
Parameter | Type | Applicability | Description | Mandatory |
id | text | ID for the bean. This should be unique within the spring configuration. | true | |
singleton | boolean | If "true", one shared instance of this bean will be returned with every call to getBean(). If "false" each call results in a new instance. | true | |
lazy-init | boolean | If "true", Spring will instantiate this bean when it's needed, rather than at bean factory startup. | true |
Defines transactional control.
Parameter | Type | Applicability | Description | Mandatory |
transaction-type | text | The TransactionDefinition for this method-pattern. Uses Spring types REQUIRED, REQUIRES_NEW, NEVER, NOT_SUPPORTED, MANDATORY and SUPPORTS. REQUIRED = Support a current transaction, create a new one if none exists. REQUIRES_NEW = Create a new transaction, suspend the current transaction if one exists. NEVER = Execute non-transactionally, throw an exception if a transaction exists. NOT_SUPPORTED = Execute non-transactionally, suspend the current transaction if one exists. MANDATORY = Support a current transaction, throw an exception if none exists. SUPPORTS = Support a current transaction, execute non-transactionally if none exists. Default : REQUIRED | false | |
rollback alse | text | Comma seperated list (-/+)Exception Class i.e. +java.lang.NullPointerException,-java.sql.SQLException This will cause the transaction to commit even if a NullPointerException is thrown, however if a SQLException is thrown the transaction will rollback. | ||
method-pattern | text | A pattern match string of methodNames to apply this transaction definition to. i.e. find* | true | |
read-only | bool | Flags this method-pattern as read only. |
The following XDoclet markup
/** * @spring.transaction * transaction-type="SUPPORTS" * method-pattern="find*" * read-only="true" * */
will place the following XML in the spring-transaction.xml file
<prop key="find*">PROPAGATION_SUPPORTS,readOnly</prop>
The following XDoclet markup
/** * @spring.transaction * transaction-type="REQUIRED" * method-pattern="update*" * rollback="-java.lang.Throwable" * */
will place the following XML in the spring-transaction.xml file
<prop key="update*">PROPAGATION_REQUIRED,-java.lang.Throwable</prop>
Marks a method as an interface method on the business object.
The following XDoclet markup
public class MyBizClass implements MyBizClassInterface { ... /** * @spring.interface-method * */ public void myInterfaceMethod( Object o1, Object o2 ) throws Exception { ... } ... }
will place the following in the generated MyBizClassInterface.java
public interface MyBizClassInterface { ... public void myInterfaceMethod( Object o1, Object o2 ) throws Exception; ... }
Defines transactional control.
Parameter | Type | Applicability | Description | Mandatory |
transaction-type | text | The TransactionDefinition for this method. Uses Spring types REQUIRED, REQUIRES_NEW, NEVER, NOT_SUPPORTED, MANDATORY and SUPPORTS. REQUIRED = Support a current transaction, create a new one if none exists. REQUIRES_NEW = Create a new transaction, suspend the current transaction if one exists. NEVER = Execute non-transactionally, throw an exception if a transaction exists. NOT_SUPPORTED = Execute non-transactionally, suspend the current transaction if one exists. MANDATORY = Support a current transaction, throw an exception if none exists. SUPPORTS = Support a current transaction, execute non-transactionally if none exists. Default : REQUIRED | false | |
rollback alse | text | Comma seperated list (-/+)Exception Class i.e. +java.lang.NullPointerException,-java.sql.SQLException This will cause the transaction to commit even if a NullPointerException is thrown, however if a SQLException is thrown the transaction will rollback. | ||
read-only | bool | Flags this method-pattern as read only. |
The following XDoclet markup
/** * @spring.interface-method * * @spring.transaction * transaction-type="REQUIRED" * rollback="-java.lang.RuntimeException,-org.myorg.SomeException" * */ public void myTransactionalMethod( ... ) { ... }
will place the following XML in the spring-transaction.xml file
<prop key="myTransactionalMethod">PROPAGATION_REQUIRED,-java.lang.RuntimeException,-org.myorg.SomeException</prop>