Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
Code Obfuscation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code Obfuscation

    My PM is asking for Code Obfuscation to stop reverse engineering.

    If I obfuscate my code then class names would be changed and I would have to re write my spring applicationcontext file. Is there any support or easy ideas to achieve that ?

    Thanks,

  • #2
    It sounds like you're currently using XML to configure your application, but you've posted in the right place - the Spring JavaConfig project is a perfect solution for those that need obfuscation. Essentially, you'll drop using XML and start writing your configurations in pure java.

    Before:
    Code:
    <beans>
        <bean id="foo" class="com.myco.Foo"/>
    </beans>
    and you would access that bean as follows:
    Code:
    ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
    Foo foo = (Foo) ctx.getBean("foo");
    In this situation, you're quite right - obfuscation would render the beans.xml file inaccurate and the configuration would not work.

    Here's the same configuration using JavaConfig:
    Code:
    @Configuration
    public class AppConfig {
        public @Bean Foo foo() {
            return new Foo();
        }
    }
    And bootstrapping goes as follows:
    Code:
    JavaConfigApplicationContext ctx = new JavaConfigApplicationContext(Foo.class);
    Foo foo = ctx.getBean(Foo.class);
    As you can see, with JavaConfig it's 100% Java - no XML, no string identifiers, so everything will obfuscate together and work perfectly.

    Hope this gives you what you're looking for!

    Comment

    Working...
    X