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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:31:14+00:00 2026-05-26T15:31:14+00:00

I realize that Grails service classes are Spring managed singletons. I also know that

  • 0

I realize that Grails service classes are Spring managed singletons. I also know that you can reference one service class from another by just declaring a local def with the serviceClassName in camel case like that. What surprised me was that I can’t seem to cross reference service classes together like so

 class FirstService {

   def secondService
 ...
 }

 class SecondService {

   def firstService
 ...
 }

Is this true for everyone, or did I mess up somewhere in the … section?

  • 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-26T15:31:15+00:00Added an answer on May 26, 2026 at 3:31 pm

    Grails isn’t able to inject when there are circular references. You should actually be getting an exception along the lines of FactoryBean is not fully initialized yet. There’s a JIRA issue about this where they stated they won’t be fixing this, as it’s more to do with Spring than Grails (http://jira.grails.org/browse/GRAILS-5080)

    However, there is a workaround that is cited in the JIRA and I can verify does work with Grails 2.0.RC1. In SecondService, make it protected def firstService and add def grailsApplication below that and then add the method def initialize() { this.firstService = grailsApplication.mainContext.firstService }. Lastly, in BootStrap.groovy, add def firstService and then in the init closure, add secondService.initialize(). Not a pretty solution, but this will get everything hooked up the way you want it.

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

Sidebar

Related Questions

I realize that you can't 100% know that this will work in all browsers.
I realize that this rule might differ from one company's coding standards to another,
i realize that ShortDateFormat variable represents the user's preferences. i also realize that if
I realize that it's possible to define a static class method as private and
I am attempting to write integration tests for a Grails service that does, among
I realize that there are a lot of questions regarding friend classes in C++.
I realize that you can use SoundPlayer to play a sound in C#; however,
I realize that this can be a matter of preference, but I have noticed
I realize that you can use a Socks5 proxy with WebProxy. That being said,
I'm building out a Grails app and realize that a lot of custom stuff

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.