Spring Tutorial 16 - Writing a BeanFactoryPostProcessor

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 79

  • @luciano5463
    @luciano5463 2 года назад

    One can throw all the books away and follow only your classes awesome teacher !!!!

  • @parth191079
    @parth191079 10 лет назад +52

    You are awesome, man! You might not know that how much you have helped people like me who does not have time to read bulky books to learn new technologies. Your videos are very neat and super easy to understand. You rock...!
    What's coming next?

  • @ymgindia
    @ymgindia 10 лет назад +2

    Thanks Koushik, I find it very easy to understand.

  • @mrmogly1
    @mrmogly1 9 лет назад +2

    Very good tutorial and it is simplified way to understand Spring.

    • @jaroslavbeno
      @jaroslavbeno 9 лет назад

      +Bharath Kumar Lokaraj it is easy

  • @ushaprajapati9217
    @ushaprajapati9217 11 лет назад

    Thank you for your videos koushks, really its help me a lot to get to know spring framework....once again Thanks koushks.

  • @MrErickongo
    @MrErickongo 10 лет назад +1

    really love your videos, thanks man !

  • @puneethshivalingaiah
    @puneethshivalingaiah 9 лет назад

    Koushik Kothagal Thanks for your videos. You made it simple and clear:)

  • @tipu7777
    @tipu7777 12 лет назад

    Its a great video Koushik , thanks for the good work, God bless you!

  • @pspraveen1
    @pspraveen1 12 лет назад

    Excellent Stuff.... very clear mind ....Really appreciate the efforts

  • @sonnix31
    @sonnix31 10 лет назад

    I'll not stop thanking you! so Thank You Sir.

  • @LeBadman
    @LeBadman 9 лет назад +10

    For those of you who are getting the FormatException error "Cannot convert String to int"
    -> Make sure you used curly braces {} and not brackets (), as you can see at 9:17.
    For those of you who are getting the error: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: ... Failed to convert property value of type [java.lang.String] to required type [int] for property 'x'; nested exception is java.lang.NumberFormatException: For input string: "0;"
    -> Make sure you don't have semicolons ; for the values in your properties file.

    • @nenadnikolic3367
      @nenadnikolic3367 9 лет назад

      +LeBadman Thanks a lot man

    • @LeBadman
      @LeBadman 9 лет назад

      Nenad Nikolic You're welcome.

    • @HarshPatel-jo2xn
      @HarshPatel-jo2xn 6 лет назад

      instead try using PropertySourcesPlaceholderConfigurer

    • @priyamalik9505
      @priyamalik9505 6 лет назад

      I am still getting NumberFormatException.
      Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'x'; nested exception is java.lang.NumberFormatException: For input string: "${pointZero.pointX}"

    • @RamneekSingal40
      @RamneekSingal40 6 лет назад

      @@priyamalik9505 Please check the className definded in bean-

  • @azzammahmoud2052
    @azzammahmoud2052 Месяц назад +1

    Is there a github repo where we can find the code?

  • @BikasKatwalK
    @BikasKatwalK 9 лет назад +4

    Java Brains Hello Kaushik - I have one query on this, lets say I have 2 properties file and I want to take the values from either property file based on some session value. how do I do that?
    Here I have a multi language system, so based on the value of language session i want to get the text from corresponding properties file.

  • @KentOJohnson
    @KentOJohnson 11 лет назад +1

    Thank you for your videos koushks! It would be nice to have an updated version for the new Spring 3 framework.

  • @vyshnavramesh9305
    @vyshnavramesh9305 7 лет назад +4

    I miss my non-spring java soo much after going thru all these spring config...

  • @EmirPuska
    @EmirPuska 12 лет назад

    Man, you are great !!

  • @manishsen195
    @manishsen195 7 лет назад +1

    If you are getting TypeMismatchException try any of the 3 given solutions below :
    1) Do not put properties values in Inverted comma ("")
    2) Do not give semi colon at the end
    3) Correct bean name is "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" .

  • @gerardoei1102
    @gerardoei1102 10 лет назад +9

    As of version 3.1 I think you should use org.springframework.context.support.PropertySourcesPlaceholderConfigurer

    • @ankur7437
      @ankur7437 9 лет назад

      +Gerard Oei Thanks,it worked out for me.Was facing a issue due to this and not able to resolve

    • @Deedee-girl
      @Deedee-girl 8 лет назад

      Thanks for the suggestion. It resolved the issue for the "Cannot convert from String to int".

    • @a_rob
      @a_rob 4 года назад

      Saved me from lot of toil googling! Thank you!

  • @TheGuroguro12
    @TheGuroguro12 7 лет назад

    Thank you very much

  • @mateuszalmannai5865
    @mateuszalmannai5865 12 лет назад

    Good stuff!

  • @Faraz70
    @Faraz70 11 лет назад +1

    Great vidoes...can you recommend any good books for spring/hibernate? thanks

  • @tipu7777
    @tipu7777 12 лет назад

    sorry about the last post, i had a silly mistake - its fixed now .. used ";" at the ned of value in properties file

  • @jeremynagel
    @jeremynagel 9 лет назад +2

    Your tutorial explains the mechanics well but I don't get one thing: What is the point of a PostProcessor? I don't understand why it is important to know this. Can you give a practical example of how this is used?

    • @jonh8800
      @jonh8800 9 лет назад

      You may need implement some logic, after the String container initializing a bean for example. :)

    • @Oblivion4eg
      @Oblivion4eg 8 лет назад +2

      +jeremy nagel maybe for you it's a late answer, for everyone else - think of the time you want to count how many times something was done: someone entered a page, someone requested a new calculation, etc.

  • @recoveringheart
    @recoveringheart 12 лет назад

    @GhavleVivek Just maximize the player. Click the button at the bottom right corner of the player. You can click full screen and the text becomes crystal clear.

  • @sujansai8116
    @sujansai8116 2 года назад

    How can it be read that there is MyBeanFactoryPP class which implements the BeanFactoryPostProcessor interface and call the method inside it even before initializing the container? Because the Bean which is defined with class name MyBeanFactoryPP is inside the container right?

  • @sarikachugh6610
    @sarikachugh6610 7 лет назад

    I am able to manage to get output as per the placeholders substitution..But i am not getting the same result statement as per your output that is "Before bean initialization placeholder sustitution takes place very early so that ready spring.xml will be used by post processor etc..the way you got in your output some logs so to double check the output which i got as per the placeholder features that i added newly..

  • @rajarsh8345
    @rajarsh8345 9 лет назад +1

    If somebody's facing issue with, "Cannot convert from String to int" check in your property file, make sure you DONT use ";" after assigning the value to the variables in the file, if again you are having null pointer exception, then check that BeanFactoryPostProcessor should be implemented separately, it shouldn't be implemented along with any of the class.

  • @shaofeiliu9404
    @shaofeiliu9404 8 лет назад +1

    you said "value" can be castered to primary types(include string).But "PropertiesLoaderSupport.setLocations(Resource ...)" the param is Resource , not string or primary type.

    • @reachmanav
      @reachmanav 6 лет назад

      Also, is "locations" a keyword? i.e. I tried with
      But it gives a weird exception:
      Error creating bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' defined in class path resource [spring.xml]

  • @shardaprasad001
    @shardaprasad001 11 лет назад

    good one

  • @Neolkx
    @Neolkx 11 лет назад

    Have you added PropertyPlaceholderConfigurer to your xml configuration file? I'm using the same version and it works fine.

  • @nandhakasi
    @nandhakasi 8 лет назад +1

    Property configuration is not working. I am version 4.2.6. Error that I am getting
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' defined in class path resource [Spring.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'peopertyFile' of bean class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]: Bean property 'peopertyFile' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    • @nandhakasi
      @nandhakasi 8 лет назад

      Identified the problem. For OOTB class, should be location for which I gave my own name.

    • @abhijeetzade3336
      @abhijeetzade3336 6 лет назад

      Properties path should b in forward slash then property file is readable

  • @kalyanjiarava6623
    @kalyanjiarava6623 5 лет назад +1

    Is it mandatory to have bean factory post processor to use property place holder config

    • @divyagracie
      @divyagracie 2 года назад

      no, as you can see he removed it from spring.xml

  • @aakashkanchan6868
    @aakashkanchan6868 7 лет назад

    Sir I have Question is that if make all java class in different packages like separate package for all POJO class and some more package for different functionality so in which package i should make class for BeanPostProcessor?Shouls I make it in different Package Also?.......Thanks in Advance

  • @mmnajar
    @mmnajar 11 лет назад

    What purpose does BeanFactoryPostProcessor serve? Where would be a place that overriding the method in BFPP would benefit us the best?

  • @ruslanmostov7052
    @ruslanmostov7052 9 лет назад +1

    org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - this is working class path.

  • @sandeepdash123
    @sandeepdash123 12 лет назад

    Need to put the config file under src, same hierarchy as spring.xml. it will solve the issue.

  • @ruthggg
    @ruthggg 6 лет назад

    Hi,
    Can you explain please what the different between BeanPostProcessor and BeanFactoryPostProcessor?
    Thanks

    • @90AlmostFamous
      @90AlmostFamous 6 лет назад

      BeanFactoryPostProcessor gets called before beans are being instantiated, so because of that you can override or add properties. BeanPostProcessor gets called after beans have been instantiated.

    • @90AlmostFamous
      @90AlmostFamous 6 лет назад

      but im learing this too so i could be wrong

  • @amannitrr
    @amannitrr 8 лет назад

    I am not able to see the logs as shown in video 06:32 after beanfactory post process executes.... what would be reason for this?

    • @wilsoncardoso150
      @wilsoncardoso150 6 лет назад

      same here

    • @niharikapatnaik1199
      @niharikapatnaik1199 5 лет назад

      Can somebody pls help with the logs?

    • @niharikapatnaik1199
      @niharikapatnaik1199 4 года назад

      Finally got the logs, after almost a year. I needed to use the earlier version of springs; used 4.2.2 instead of 5.2.2. Now I can see the info logs in the console. You can try with even older versions such as 3.2.

    • @niharikapatnaik1199
      @niharikapatnaik1199 4 года назад

      @@wilsoncardoso150 Finally got the logs, after almost a year. I needed to use the earlier version of springs; used 4.2.2 instead of 5.2.2. Now I can see the info logs in the console. You can try with even older versions such as 3.2.

  • @benerjeeg9939
    @benerjeeg9939 11 лет назад

    nice

  • @vineettalekarr
    @vineettalekarr 11 лет назад

    I too get the number format exception even though the properties files is in the same location as the spring.xml .please help

  • @lavenderinmay
    @lavenderinmay 11 лет назад

    I am using spring 3.2.4, and I have the number format exception... I did exact what the video said. Is it because the framework version updated?

    • @reachmanav
      @reachmanav 6 лет назад

      You probably forgot to add "$" while mentioning the variables in spring.xml - "${pointA.pointX}"

    • @pallavikarpaklu2575
      @pallavikarpaklu2575 5 лет назад

      @@reachmanav I did exactly same. But i see type mismatch error :/

    • @pallavikarpaklu2575
      @pallavikarpaklu2575 5 лет назад

      Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'x'; nested exception is java.lang.NumberFormatException: For input string: "${pointA.pointX}"
      Caused by: java.lang.NumberFormatException: For input string: "${pointA.pointX}"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

  • @813jag
    @813jag 12 лет назад

    Hi,
    Thanks a lot for uploading such a nice video tutorial....
    throwing NumberFormat Exception while geting value from config propety file. saying can not convert string to int, I applied int parser as well still the exception is not resolved please help me.
    "exception is .TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'x'; nested exception is java.lang.NumberFormatException: For input string: "${pointA.pointX}"

  • @asing1313
    @asing1313 12 лет назад

    Oh sorry !!!!!
    The error in the below comment I have found. The error was I wrote the name of "PropertyPlaceholde­rConfigurer" class as "PropertPlaceholde­rConfigurer"
    I did not write the correct spelling

  • @Sciencefactory.
    @Sciencefactory. 12 лет назад

    Please make font size big and bold

  • @asing1313
    @asing1313 12 лет назад

    Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.spring.framework.beans.factory.config.PropertPlaceholderConfigurer] for bean with name 'org.spring.framework.beans.factory.config.PropertPlaceholderConfigurer#0' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: org.spring.framework.beans.factory.config.PropertPlaceholderConfigurer

  • @tipu7777
    @tipu7777 12 лет назад

    i got this error, can you please help .. spring.xml and properties file in next comment
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: ... Failed to convert property value of type [java.lang.String] to required type [int] for property 'x'; nested exception is java.lang.NumberFormatException: For input string: "0;"

  • @nikhar1234tare
    @nikhar1234tare 4 года назад

    what is the use of beanfactorypostproccesor

    • @manishakohli1540
      @manishakohli1540 4 года назад +1

      It is used to perform certain operation pre and post the bean factory instantiation i.e when the bean factory setup is done, if we an operation to be performed, it can be added by using beanfactorypostprocessor. I Hope it helps!

  • @syedtajammul3184
    @syedtajammul3184 8 лет назад

    does anyone get the same Value for triangle A as it is for triangle B

  • @jorgesegundo4184
    @jorgesegundo4184 12 лет назад

    Buy Glasses LOL !

  • @god_bika
    @god_bika Год назад

    speak louder oufffff