小编Noo*_*ere的帖子

Spring bean实例化排序

我遇到了Bean实例化排序很重要的问题.目前,Bean3从下面运行基于数据库的缓存放置操作,Bean 1使用Proxy Bean2查询新创建的缓存.优先级是Bean3和Bean 2在Bean1实例化之前完全实例化,即当Spring容器出现时.这些bean是单独的JARS,Bean2对Bean1的引用不使用Autowired.而是服务定位器给它一个参考.我们使用的是Spring 2.5.2而不是使用XML来实例化bean.任何帮助赞赏!

java spring java-ee applicationcontext

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

{{notification.header}} {{notification.message}} 在访问 Keycloak 管理控制台时加载

我们最初在虚拟机上运行了一个 dockerized 1.9.3 keycloak,我们可以访问管理控制台。我们后来不得不放弃这个虚拟机,但我们最终克隆了另一个包含所有内容的虚拟机。

dockerized keycloak 在反向代理 NGINX 后面运行,它通过以下线程传递所有必需的标头

http://keycloak-user.88327.x6.nabble.com/keycloak-user-ssl-apache2-difficulties-td1570.html

 RequestHeader set X-Forwarded-Proto "https" 
 RequestHeader set X-Forwarded-Port "443" 
Run Code Online (Sandbox Code Playgroud)

我尝试了很多不同的东西,但无论我做什么,当我尝试访问 Keycloak 管理控制台时都遇到以下错误

   {{notification.header}} {{notification.message}} loading....
Run Code Online (Sandbox Code Playgroud)

感谢任何帮助 -

java jboss nginx jboss-tools keycloak

5
推荐指数
1
解决办法
3679
查看次数

Spring @autowired返回null

这个特定类的成员私有字段(注释为@autowired)位于服务JAR中,当我试图在我的代码中获取该类的实例时,@ autowired成员总是返回null.我在我的项目的context.xml中有下面的组件扫描语句,它试图在JAR中查找base-package,但是仍然会出现空值被注入到带注释的成员中.JAR内部还有一个context.xml,它具有与下面相同的组件扫描条目.JAR源代码现在无法更改,有什么我遗漏的吗?

<!-- local WEB-INF/spring-context/spring-application-context.xml -->
<context:annotation-config /> 
<context:component-scan base-package="blah.blah" />
Run Code Online (Sandbox Code Playgroud)
//this code within my project
//wjc.getMethod() dereferencing comes back null
 public class A{
    WithinJARInterface wjc = new WithinJARInterfaceImpl()
    List someObject = wjc.getMethod()
 }
Run Code Online (Sandbox Code Playgroud)
 //this code interface within JAR
 public interface WithinJARInterface{
    public List getMethod() throws Exception(); 
 }
Run Code Online (Sandbox Code Playgroud)
 //this code within JAR
 public class WithinJARInterfaceImpl implements WithinJARInterface{

    //below member always comes back NULL
    @Autowired
    private JARService jService;

    public List getMethod(){.....}

 }
Run Code Online (Sandbox Code Playgroud)
 public interface JARService{
    public List method1();
 }
Run Code Online (Sandbox Code Playgroud)
  @Service("JARService") 
   public …
Run Code Online (Sandbox Code Playgroud)

java spring autowired

2
推荐指数
1
解决办法
2380
查看次数