小编Eva*_*oot的帖子

@Autowired在可运行内部无法正常工作

我有一个可运行的任务,正在尝试自动接线,但是当我这样做时,该任务无法运行。当我为可运行范围外的田地自动接线时,它工作正常。为什么会这样呢?除了在内部自动装配外,是否还有其他更清洁的方法可以在可运行内部获取自动装配字段的新实例?

这是我的可运行方法

Runnable task = new Runnable() {

                @Autowired
                ICruxPanelClientService CruxPanelClientService;

                public void run (){
            CruxPanelClientService.setCruxWebServiceBaseURL("http://10.41.181.23:8080");
            CronCruxModel m = new CronCruxModel();
            m = model1.get(model_var);
            System.out.println("EXECUTING");
            System.out.println(m.getService_status() + " ---------EXEexecution");
            System.out.println(m.getCat_name() + "Executing Name ");
        //  time = m.getService_time();
            UpdateCategoryRequest updateCategoryRequest = new UpdateCategoryRequest();
            CategoryModel categoryModel = new CategoryModel();
            categoryModel.setColor(m.getCat_color());
            categoryModel.setIcon(m.getCat_icon());
            categoryModel.setIconWhite(m.getCat_icon_white());
            categoryModel.setName(m.getCat_name());
            categoryModel.setId(m.getCat_id());
            categoryModel.setKey(m.getCat_catkey());
            categoryModel.setIndexOrder(m.getCat_indexOrder());
            updateCategoryRequest.setCategory(categoryModel);
            CruxPanelClientService.updateCategory(updateCategoryRequest);
            GetServiceDataIdByCategoryIdRequest request1 = new GetServiceDataIdByCategoryIdRequest();    
            request1.setId(m.getCat_id());
            GetServiceDataIdByCategoryIdResponse response1 = CruxPanelClientService.getServiceDataIdByCategoryId(request1);
            ArrayList<ServiceModel> service = new ArrayList<ServiceModel>();
            service = response1.getServiceModels();

            JSONArray json = new JSONArray(); …
Run Code Online (Sandbox Code Playgroud)

java multithreading spring-mvc autowired

4
推荐指数
2
解决办法
5151
查看次数

如何在angular JS中运行ng-repeat语句的次数有限

我有一个正在填充的表格如下:

<table>
          <tr>
            <th>Id</th>
            <th>Details</th>
            <th>Score</th>
          </tr>
          <tr ng-repeat="x in data.items">
            <td><a href="{{ x.get }}">{{ x.id }}</td>
            <td>
                <p><b>{{ x.name[0] }}</b></p>
                <p><u>Brand</u>: {{ x.Brand }}; <u>Category URL</u>: {{ x.mlnURL }};<u>Price</u>: Rs {{x.Price}} </p>
            </td>
            <td>
                <p><a href="{{x.explain}}"><b>{{ x.score }}</b></a></p>
                Classifier Score: {{ x.cscore }} <br>
                Document Score: {{ x.sscore }} </p>
            </td>
          </tr>
        </table>
Run Code Online (Sandbox Code Playgroud)

现在在这一行

<tr ng-repeat="x in data.items">
Run Code Online (Sandbox Code Playgroud)

而不是在data.items中运行所有x的敌人,我想根据用户的需要运行它有限次数.我有来自用户的这个数字输入并存储在变量中.我怎样才能做到这一点.

html javascript jquery angularjs

0
推荐指数
1
解决办法
88
查看次数