相关疑难解决方法(0)

spring @PostConstruct不在JBoss7中触发

更新在WebSphere和Netweaver中运行的应用程序以在JBoss6.2 EAP中运行后,我遇到了麻烦.

我发现使用@PostConstruct(javax.annotation.PostConstruct)注释的init()方法的Spring管理的@Repository(org.springframework.stereotype.Repository)在JBossEAP中部署时没有运行init()方法6.2.0.

该类看起来如下所示:

        package com.company.productname.api.dao.impl;


        // ... imports removed ....

        @Repository
        public class UserRoleDao extends AbstractBaseDao {

            private static final Log LOG = LogFactory.getLog(UserRoleDao.class);

            private boolean testInitInvoked = false;


            // .... some code removed .... 

            /**
             * Prepare the caches used to lookup market roles
             */
            @PostConstruct
            protected void init() {
             testInitInvoked = true;
            if (LOG.isDebugEnabled())LOG.debug("UserRoleDao.init() method called");

                      // .. . . . some code removed ......
              }


            @Override
            public Mask getMask(final String aMaskName) {
                LOG.debug("getRoleMask entered, testInitInvoked = …
Run Code Online (Sandbox Code Playgroud)

java spring jboss7.x

7
推荐指数
1
解决办法
2748
查看次数

标签 统计

java ×1

jboss7.x ×1

spring ×1