3434import org .springframework .util .StringUtils ;
3535import org .springframework .util .xml .DomUtils ;
3636
37+ import static org .springframework .util .StringUtils .hasLength ;
38+
3739/**
3840 * BeanDefinitionParser implementation for the '{@code <lang:groovy/>}',
3941 * '{@code <lang:std/>}' and '{@code <lang:bsh/>}' tags.
@@ -125,7 +127,7 @@ public ScriptBeanDefinitionParser(String scriptFactoryClassName) {
125127
126128 // Determine bean scope.
127129 String scope = element .getAttribute (SCOPE_ATTRIBUTE );
128- if (StringUtils . hasLength (scope )) {
130+ if (hasLength (scope )) {
129131 bd .setScope (scope );
130132 }
131133
@@ -143,7 +145,7 @@ else if (autowireMode == AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR) {
143145
144146 // Parse depends-on list of bean names.
145147 String dependsOn = element .getAttribute (DEPENDS_ON_ATTRIBUTE );
146- if (StringUtils . hasLength (dependsOn )) {
148+ if (hasLength (dependsOn )) {
147149 bd .setDependsOn (StringUtils .tokenizeToStringArray (
148150 dependsOn , BeanDefinitionParserDelegate .MULTI_VALUE_ATTRIBUTE_DELIMITERS ));
149151 }
@@ -153,7 +155,7 @@ else if (autowireMode == AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR) {
153155
154156 // Determine init method and destroy method.
155157 String initMethod = element .getAttribute (INIT_METHOD_ATTRIBUTE );
156- if (StringUtils . hasLength (initMethod )) {
158+ if (hasLength (initMethod )) {
157159 bd .setInitMethodName (initMethod );
158160 }
159161 else if (beanDefinitionDefaults .getInitMethodName () != null ) {
@@ -183,7 +185,7 @@ else if (beanDefinitionDefaults.getDestroyMethodName() != null) {
183185 // Add constructor arguments.
184186 ConstructorArgumentValues cav = bd .getConstructorArgumentValues ();
185187 int constructorArgNum = 0 ;
186- if (StringUtils . hasLength (engine )) {
188+ if (hasLength (engine )) {
187189 cav .addIndexedArgumentValue (constructorArgNum ++, engine );
188190 }
189191 cav .addIndexedArgumentValue (constructorArgNum ++, value );
@@ -194,12 +196,11 @@ else if (beanDefinitionDefaults.getDestroyMethodName() != null) {
194196
195197 // This is used for Groovy. It's a bean reference to a customizer bean.
196198 if (element .hasAttribute (CUSTOMIZER_REF_ATTRIBUTE )) {
197- String customizerBeanName = element .getAttribute (CUSTOMIZER_REF_ATTRIBUTE );
198- if (!StringUtils .hasText (customizerBeanName )) {
199+ if (!StringUtils .hasText (element .getAttribute (CUSTOMIZER_REF_ATTRIBUTE ))) {
199200 parserContext .getReaderContext ().error ("Attribute 'customizer-ref' has empty value" , element );
200201 }
201202 else {
202- cav .addIndexedArgumentValue (constructorArgNum ++ , new RuntimeBeanReference (customizerBeanName ));
203+ cav .addIndexedArgumentValue (constructorArgNum , new RuntimeBeanReference (element . getAttribute ( CUSTOMIZER_REF_ATTRIBUTE ) ));
203204 }
204205 }
205206
0 commit comments