You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Juan E. Maya" <ma...@gmail.com> on 2009/10/28 01:06:43 UTC

Re: Injecting Tapestry services into Spring beans

Hi Hennig, did u manage to resolve this problem?

i am having the same issue. I just can't inject  any tapestry beans
inside Spring. I using tapestry 5.1.0.5 and spring 2.6. Without
compatible mode but the services just don't get injected :(

On Fri, Jul 10, 2009 at 3:00 PM, Henning Petersen
<he...@daenen4.de> wrote:
> Hi everybody,
>
> I'm trying to inject two services from Tapestry-Spring-Security into a
> Spring bean, using Tapestry 5.1.0.5 and Spring 2.5.6-SEC01.
>
> The way I think this should work is this:
>
> public class PasswordChangeServiceImpl implements PasswordChangeService {
>
>        @Inject
>        private SaltSourceService saltSource;
>        @Inject
>        private PasswordEncoder passwordEncoder;
>
>        ...
>
>        private String createPasswordHash(String plainTextPass) {
>                UserDetails userDetails = ...
>                Object salt = this.saltSource.getSalt(userDetails);
>                return this.passwordEncoder.encodePassword(plainTextPass,
> salt);
>        }
>
> }
>
> and
>
> <bean id="passwordChangeService" class="PasswordChangeServiceImpl">
>        ...(other dependencies)...
> </bean>
>
> I inject the service instance into my page using the @Inject annotation:
>
> public class UserProfile {
>        @Inject private PasswordChangeService passwordChangeService;
>        ...
> }
>
> The service is properly configured as far as the dependencies handled by
> Spring are concerned, but the two services that I'd like to be injected from
> Tapestry's IoC newer make it into the instance, and I get a
> NullPointerException when they are accessed.
>
> Both SaltSourceService and PasswordEncoder are defined and visible on the
> service status page, and they work like a charm when injected into
> components directly. I'm not using 5.0 compatibility mode.
>
> Does anyone have an idea what I am missing?
>
> Thanks
> Henning
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Injecting Tapestry services into Spring beans

Posted by "Juan E. Maya" <ma...@gmail.com>.
Ok, i found the problem. To inject the service u have to use:

@Inject @Autowired
private Service MyService;

As always the problem was between the screen and chair :)

On Wed, Oct 28, 2009 at 1:06 AM, Juan E. Maya <ma...@gmail.com> wrote:
> Hi Hennig, did u manage to resolve this problem?
>
> i am having the same issue. I just can't inject  any tapestry beans
> inside Spring. I using tapestry 5.1.0.5 and spring 2.6. Without
> compatible mode but the services just don't get injected :(
>
> On Fri, Jul 10, 2009 at 3:00 PM, Henning Petersen
> <he...@daenen4.de> wrote:
>> Hi everybody,
>>
>> I'm trying to inject two services from Tapestry-Spring-Security into a
>> Spring bean, using Tapestry 5.1.0.5 and Spring 2.5.6-SEC01.
>>
>> The way I think this should work is this:
>>
>> public class PasswordChangeServiceImpl implements PasswordChangeService {
>>
>>        @Inject
>>        private SaltSourceService saltSource;
>>        @Inject
>>        private PasswordEncoder passwordEncoder;
>>
>>        ...
>>
>>        private String createPasswordHash(String plainTextPass) {
>>                UserDetails userDetails = ...
>>                Object salt = this.saltSource.getSalt(userDetails);
>>                return this.passwordEncoder.encodePassword(plainTextPass,
>> salt);
>>        }
>>
>> }
>>
>> and
>>
>> <bean id="passwordChangeService" class="PasswordChangeServiceImpl">
>>        ...(other dependencies)...
>> </bean>
>>
>> I inject the service instance into my page using the @Inject annotation:
>>
>> public class UserProfile {
>>        @Inject private PasswordChangeService passwordChangeService;
>>        ...
>> }
>>
>> The service is properly configured as far as the dependencies handled by
>> Spring are concerned, but the two services that I'd like to be injected from
>> Tapestry's IoC newer make it into the instance, and I get a
>> NullPointerException when they are accessed.
>>
>> Both SaltSourceService and PasswordEncoder are defined and visible on the
>> service status page, and they work like a charm when injected into
>> components directly. I'm not using 5.0 compatibility mode.
>>
>> Does anyone have an idea what I am missing?
>>
>> Thanks
>> Henning
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org