Spring JavaConfig
  1. Spring JavaConfig
  2. SJC-89

Ensure OSGi / Spring Dynamic Modules compatibility

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.0 M1
    • Component/s: Compatibility
    • Labels:
      None

      Description

      SJC will need to be tested within an OSGi environment, fitted with OSGi bundle metadata, etc.

        Issue Links

          Activity

          Hide
          Daniel Stoch added a comment -

          Hi, we are using JavaConfig under OSGi and it seems that these two things does not work correctly:
          1. Injecting a singleton bean into another bean - each time a dataSource() method is called a new DataSource instance is created (so in the following example it will be called twice):
          @Configuration
          public class ApplicationConfig {

          @Bean
          public AccountRepository accountRepository()

          { return new JdbcAccountRepository(dataSource()); }

          @Bean
          public DataSource dataSource()

          { return new DriverManagerDataSource(...); }

          }

          2. @ExternalBean annotation does not work - external bean is not injected.

          Show
          Daniel Stoch added a comment - Hi, we are using JavaConfig under OSGi and it seems that these two things does not work correctly: 1. Injecting a singleton bean into another bean - each time a dataSource() method is called a new DataSource instance is created (so in the following example it will be called twice): @Configuration public class ApplicationConfig { @Bean public AccountRepository accountRepository() { return new JdbcAccountRepository(dataSource()); } @Bean public DataSource dataSource() { return new DriverManagerDataSource(...); } } 2. @ExternalBean annotation does not work - external bean is not injected.
          Hide
          Chris Beams added a comment -

          Hi Daniel,

          Which version of JavaConfig are you using? M3, or are you working against the latest snapshots?

          How are you bootstrapping JavaConfig? Via JavaConfigApplicationContext, or with XML+ConfigurationPostProcessor.

          Any additional information you can provide, and ideally a small example bundle that demonstrates the problem will help greatly.

          Thanks!

          Show
          Chris Beams added a comment - Hi Daniel, Which version of JavaConfig are you using? M3, or are you working against the latest snapshots? How are you bootstrapping JavaConfig? Via JavaConfigApplicationContext, or with XML+ConfigurationPostProcessor. Any additional information you can provide, and ideally a small example bundle that demonstrates the problem will help greatly. Thanks!
          Hide
          Daniel Stoch added a comment -

          I'm using JavaConfig 1.0.0.m3 and I'm bootstrapping JavaConfig via XML+ConfigurationPostProcessor.
          I'll try to prepare an example that demonstrates the problem.

          Is it any chance that with the latest snapshots these problems will gone?

          Show
          Daniel Stoch added a comment - I'm using JavaConfig 1.0.0.m3 and I'm bootstrapping JavaConfig via XML+ConfigurationPostProcessor. I'll try to prepare an example that demonstrates the problem. Is it any chance that with the latest snapshots these problems will gone?
          Hide
          Chris Beams added a comment -

          Daniel,

          As I'm not yet sure what the cause of your problem is I can't say for sure whether upgrading to the M4 snapshots will help you. However, given that any fix will be developed against M4 anyway, it would be a good idea to give it a shot.

          The location of the snapshots has recently changed. This isn't formally documented just yet, but you can read up on how/where to get the latest here: http://forum.springframework.org/showthread.php?t=55733&highlight=javaconfig&page=2

          Show
          Chris Beams added a comment - Daniel, As I'm not yet sure what the cause of your problem is I can't say for sure whether upgrading to the M4 snapshots will help you. However, given that any fix will be developed against M4 anyway, it would be a good idea to give it a shot. The location of the snapshots has recently changed. This isn't formally documented just yet, but you can read up on how/where to get the latest here: http://forum.springframework.org/showthread.php?t=55733&highlight=javaconfig&page=2
          Hide
          Chris Beams added a comment -

          Unintentionally closed. Re-opening.

          Show
          Chris Beams added a comment - Unintentionally closed. Re-opening.
          Hide
          Chris Beams added a comment -

          Resolving this issue, as it's a duplicate of SPR-5932. See the comments within for further details.

          Show
          Chris Beams added a comment - Resolving this issue, as it's a duplicate of SPR-5932 . See the comments within for further details.

            People

            • Assignee:
              Chris Beams
              Reporter:
              Chris Beams
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1.5h
                1.5h

                  Development