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 6834587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:07:48+00:00 2026-05-26T23:07:48+00:00

In one of the Spring classes, org.springframework.web.servlet.view.tiles2.TilesConfigurer , the following code is run: Class

  • 0

In one of the Spring classes, org.springframework.web.servlet.view.tiles2.TilesConfigurer, the following code is run:

Class clazz = getClass().getClassLoader().loadClass(
    "org.apache.tiles.extras.complete.CompleteAutoloadTilesInitializer");
this.tilesInitializer = (TilesInitializer) clazz.newInstance();

Why didn’t the author just write

this.tilesInitializer = new org.apache.tiles.extras
    .complete.CompleteAutoloadTilesInitializer()

Is there a difference in the output or an improvement to doing it the first way?

Update The code in the TilesConfigurer class is exactly as in the first example. It is not loading the string out of a DI layer. It’s a hard coded string.

  • 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-05-26T23:07:49+00:00Added an answer on May 26, 2026 at 11:07 pm

    In the second case the dependency exists in the code (at compile time), while in the first case the dependency is only created when this code is run.

    Doing things the first way can be useful for a couple of reasons:

    • You want to speed up program loading (in the second case the
      classloader will load the Apache tiles class and its dependencies when this spring
      class is loaded, in the first case it will wait to do so until this spring code is
      called)

    • You want to have code that can stand alone without this dependency
      (in the second case you cannot compile or load the code without the
      tiles.extras…. class files present, but in the first case you can,
      and they might just give some extra functionality if present).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my domain model I have following Classes.A 'UserProfile' has one 'SecurityPrincipal' class SecurityPrincipal{
Here is the context for Spring Batch: <beans:beans xmlns:beans=http://www.springframework.org/schema/beans xmlns:b=http://www.springframework.org/schema/batch xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
Trying to override a tostring in one of my classes. return string.Format(@ name =
i want to call 2 views within one controller in spring with java. for
One of the most difficult things about understand Spring is that Spring supports multiple
I just migrating one of our applications from pure JDBC to Spring's JDBCTemplate. I
I have many cookie-cutter spring beans and don't want to explicitly define each one
I'm reading the book Spring Recipes right now, and am puzzled by one thing:
I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my
I want to use @PreAuthorize annotation on service methods with Spring Security. One of

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.