Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8045445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:32:59+00:00 2026-06-05T05:32:59+00:00

I want to call a method after creating the bean using spring, for example

  • 0

I want to call a method after creating the bean using spring, for example I create Factory and schema but I want to call the same method of Factory before creating a schema bean

 <!-- schemaFactory-->
    <bean id="schemaFact" class="javax.xml.validation.SchemaFactory"
        factory-method="newInstance">
        <constructor-arg value="http://www.w3.org/2001/XMLSchema" />
    </bean>

<!-- schema -->
    <bean id="schema" class="javax.xml.validation.Schema"
        factory-bean="schemaFact" factory-method="newSchema">
        <constructor-arg value="3DSecure.xsd" />
    </bean>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:33:00+00:00Added an answer on June 5, 2026 at 5:33 am

    If you are using Spring 3.0/3.1 you can take advantage of Java configuration:

    @Configuration
    class Config {
    
        @Bean
        public SchemaFactory schemaFact() throws SAXNotSupportedException, SAXNotRecognizedException {
            final SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
            schemaFactory.setFeature("apache.org/xml/features/validation/schema-full-checking", false);
            return schemaFactory;
        }
    
    
        @Bean
        public Schema schema() throws SAXException {
            return schemaFact().newSchema(new File("3DSecure.xsd"));
        }
    }
    

    But which method on SchemaFactory do you want to call? Seems like all of them are either getters or setters, so you can use normal XML injection… Alternatively create your own FactoryBean:

    class SchemaFactoryFactoryBean implements FactoryBean<SchemaFactory> {
    
        @Override
        public SchemaFactory getObject() throws Exception
        {
            final SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
            schemaFactory.setFeature("apache.org/xml/features/validation/schema-full-checking", false);
            return schemaFactory;
        }
    
        @Override
        public Class<?> getObjectType()
        {
            return SchemaFactory.class;
        }
    
        @Override
        public boolean isSingleton()
        {
            return true;
        }
    }
    

    And use it like this (no factory-method needed):

    <bean id="schemaFact" class="SchemaFactoryFactoryBean"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one method on JSF Managed Bean, i want after user call method,
I want to call an action method (DownloadPictures) after i redirect to a different
I want to call the getData method after waiting 2 seconds each time this
I want to call the method after particular time only one time therefore i
in a method, i want to call a method after n seconds: self.toolBarState =
I want to call a bean after a date is selected in a p:calendar
I have a requirement: I want to call method every day at any particular
I want to call a method which returns a value every few seconds. I
I want to call this method: - (void)getUserFriendTargetDialogRequest { currentAPICall = kAPIFriendsForTargetDialogRequests; [self apiGraphFriends];
I want to call a method, pass it the length and have it generate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.