小编Pap*_*urf的帖子

ibm jdk和oracle jdk有什么区别?

我正在编写将在AIX服务器上运行的Java代码.我想知道IBM的JDK和Oracle的JDK之间的区别,以及JDK是否具有相同的类.IBM JDK是否具有Oracle JDK中的所有类?

是否有任何IBM文档描述了两个JDK之间的差异?

java ibm-jdk

11
推荐指数
2
解决办法
2万
查看次数

Spring - 带注释的构造函数对象的AspectJ切入点

我正在使用Spring框架(4.0.5)和AspectJ进行AOP Logging开发一个java(JDK1.6)应用程序.

我的Aspect类工作正常,但我无法为构造函数对象创建切入点.

这是我的目标:

@Controller
public class ApplicationController {
    public ApplicationController(String myString, MyObject myObject) {
        ...
    }
    ...
    ..
    .
}
Run Code Online (Sandbox Code Playgroud)

这是我的Aspect类:

@Aspect
@Component
public class CommonLogAspect implements ILogAspect {
    Logger log = Logger.getLogger(CommonLogAspect.class);

    // @Before("execution(my.package.Class.new(..)))
    @Before("execution(* *.new(..))")
    public void constructorAnnotatedWithInject() {
        log.info("CONSTRUCTOR");
    }
}
Run Code Online (Sandbox Code Playgroud)

如何为构造函数对象创建切入点?


谢谢

java aop spring aspectj spring-aop

8
推荐指数
1
解决办法
7340
查看次数

log4j警告问题 - apache commons

我正在使用apache commons库和log4j.我有一个xml配置文件和一个log4j.properties文件.我想在我的xml配置文件中指定我的log4j属性路径.要加载我的设置我做:

//Loading my xml file
this.config = new XMLConfiguration(this.xmlFileName);  
Run Code Online (Sandbox Code Playgroud)

此时会出现以下警告:

log4j:WARN No appenders could be found for logger (org.apache.commons.configuration.ConfigurationUtils).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Run Code Online (Sandbox Code Playgroud)

但是我还没有调用任何log4j对象.一旦我读完了xml文件,我就可以成功使用我的log4j实例.有没有办法删除这些警告?

java log4j apache-commons

6
推荐指数
1
解决办法
1万
查看次数

CDI不适用于简单的适配器

我已将CDI功能添加到server.xml文件中<feature>cdi-1.2</feature>.

我的行家模块包含的beans.xml里面<module_name>/src/main/resources/META-INF的文件夹.

这是beans.xml内容:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                           http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
       version="1.1" bean-discovery-mode="all">
</beans>
Run Code Online (Sandbox Code Playgroud)

但是当我使用@Inject注释它不起作用时,我的bean总是如此null.

码:

package ch.webapp.presentation;

...

@Path("/test/")
public class MyController {
    @Inject
    private MyService myService;

    @GET
    @Path("/foo/{count}")
    @OAuthSecurity(scope = "login")
    @Produces("application/json")
    public Response news(@PathParam("count") int count) {
        return Response
                .ok(myService.getBar(count))
                .build();
    }
}
Run Code Online (Sandbox Code Playgroud)

编辑:

那是我的豆子

package ch.webapp.service;

...

@RequestScoped
public class MyService {
    public String getBar(int count) {
        return "foo";
    }
}
Run Code Online (Sandbox Code Playgroud)

我通过扩展MFPJAXRSApplication类来初始化jax-rs …

cdi websphere-liberty ibm-mobilefirst mobilefirst-adapters open-liberty

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

在JTable中更改一个单元格的背景颜色

可能重复:
更改Swing JTable单元格颜色

我开发了一个显示JTable的swing应用程序.我希望当用户修改单元格值时,单元格修改了更改颜色.

这是我在用户修改单元格时运行的代码:

this.myTable.getColumnModel().getColumn(column).setCellRenderer(new StatusColumnCellRenderer()); 
Run Code Online (Sandbox Code Playgroud)

这是我的单元格Render类的代码:

public class StatusColumnCellRenderer extends DefaultTableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {

        //Cells are by default rendered as a JLabel.
        JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

        //Get the status for the current row.
        TableModelLotti tableModel = (TableModelLotti) table.getModel();

        if(isSelected)
            l.setBackground(Color.GREEN);

        //Return the JLabel which renders the cell.
        return l;
    }
}
Run Code Online (Sandbox Code Playgroud)

java swing jtable tablecellrenderer

1
推荐指数
1
解决办法
4万
查看次数