I have made a new project and have now this:

*Main.java*

public static void main(String[] args) {
        RegistryBuilder builder = new RegistryBuilder();
        builder.add(AppModule.class);
        
        Registry registry = builder.build();
        registry.performRegistryStartup();
                
                DocumentGenerator gen = new DocumentGenerator();        

        registry.cleanupThread();
        registry.shutdown();
        }

*AppModule.java*

public static void bind(ServiceBinder binder)
    {
        binder.bind(PolicyValueProviderSource.class,
PolicyValueProviderSourceImpl.class);
    }
    
    
    public void
contributePolicyValueProviderSource(MappedConfiguration<String,
PolicyValueProvider> config) {
        config.add("name", new PolicyValueProvider(){
                @Override
                public String getValue(Policy policy) {
                        return policy.getHolder().getName();
                }
        });
        config.add("firstname", new PolicyValueProvider(){
                @Override
                public String getValue(Policy policy) {
                        return policy.getHolder().getFirstName();
                }
        });
    }

*
DocumentGenerator.java*

@Inject
        private static PolicyValueProviderSource policyValueProvider;
        
        public DocumentGenerator() {
                for(String v : policyValueProvider.getConfiguredFields()) {
                        System.out.println(v+" : ");
                }
        }




But now I always get a NullPointerException on *policyValueProvider* in
*DocumentGenerator.*

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Console-app-with-Tapestry-IoC-configuration-tp4822836p4825438.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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

Reply via email to