Spring方面在类似项目

时间:2015-07-11 00:51:29

标签: java spring aspect

我有2个战争项目类似的项目有共同的配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">

    <aop:aspectj-autoproxy proxy-target-class="true" />

    <bean class="config.store.PersistentAspect">
    </bean>

方面方法是:

@AfterReturning("@annotation(org.springframework.jmx.export.annotation.ManagedOperation) && !execution(* get*(..)) && !execution(* is*(..)) && !execution(* reset())")
public void do(JoinPoint jp) {
}

当我看到在两个项目中初始化应用程序日志方面时。问题是该方面只在一个项目和第二个项目中起作用。

当我开始记录org.springframework时,我可以看到,在它工作的项目中,这一行:

01:59:31.299 [RMI TCP Connection(4)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'config.store.PersistentAspect#0'

第二个没有。我应该如何调试它并找出它无效的原因?什么可以停止这方面的工作?另一个方面?

1 个答案:

答案 0 :(得分:0)

确定

当我打开整个春天的登录时,我发现了这个:

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.control.ScrollBar;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {

        HBox root = new HBox();

        // Declare ListView's
        ListView listView1 = new ListView<String>();
        ListView listView2 = new ListView<String>();

        // Fill Data inside ListView
        ObservableList<String> list = FXCollections.observableArrayList();
        for (int i = 0; i < 100; i++) {
            list.add("Value " + i);
        }
        listView1.setItems(list);
        listView2.setItems(list);

        root.getChildren().addAll(listView1, listView2);

        Scene scene = new Scene(root, 400, 400);
        primaryStage.setScene(scene);
        primaryStage.show();

        // Bind the ListView scroll property
        Node n1 = listView1.lookup(".scroll-bar");
        if (n1 instanceof ScrollBar) {
            final ScrollBar bar1 = (ScrollBar) n1;
            Node n2 = listView2.lookup(".scroll-bar");
            if (n2 instanceof ScrollBar) {
                final ScrollBar bar2 = (ScrollBar) n2;
                bar1.valueProperty().bindBidirectional(bar2.valueProperty());
            }
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

我只是想知道为什么它至少不是警告而只是调试信息。这个solution是否仍适用于Web服务等多线程应用程序?