小编Dre*_*pie的帖子

webpack + angular2错误:未捕获的ReferenceError:未定义__decorate

chrome控制台错误:未捕获ReferenceError:未定义__decorate这是代码https://github.com/Dreampie/angular2-demo

运行:

npm安装

npm run typings install

npm跑步开始

在浏览器中打开localhost:80

有人帮忙吗?

webpack webpack-dev-server angular

15
推荐指数
1
解决办法
9507
查看次数

spring data Page/Pageable不能反序列化,怎么用?

如果在控制器中使用Page/Pageable with rest,我会收到错误,因为它们没有用于反序列化的空构造

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.springframework.data.domain.Page, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information
 at [Source: java.io.PushbackInputStream@67635da8; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:892) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:139) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736) ~[jackson-databind-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2810) ~[jackson-databind-2.6.4.jar:2.6.4]
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:221) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 30 common frames omitted
Run Code Online (Sandbox Code Playgroud)

spring spring-data spring-data-jpa

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

Vue:如何使用商店与组件?

//商店

export default {
  state: {
    aboutModels: []
  },
  actions: {
    findBy: ({commit}, about)=> {
      //do getModels
      var aboutModels = [{name: 'About'}] //Vue.resource('/abouts').get(about)
      commit('setModels', aboutModels)
    }
  },
  getters: {
    getModels(state){
      return state.aboutModels
    }
  },
  mutations: {
    setModels: (state, aboutModels)=> {
      state.aboutModels = aboutModels
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

//零件

import {mapActions, mapGetters} from "vuex";

export default {
  name: 'About',
  template: require('./about.template'),
  style: require('./about.style'),
  created () {
    document.title = 'About'
    this.findBy()
  },
  computed: mapGetters({
    abouts: 'getModels'
  }),
  methods: mapActions({
    findBy: 'findBy'
  })
} …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-router vue-component vuex vuejs2

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

在Angular2 + Webpack中使用templateUrl的相对路径

import {Component} from 'angular2/core';

@Component({
  selector: 'app',
  styleUrls: ['./app.component.less'],
  templateUrl: './app.component.html'
})
export class AppComponent {
  name:string = 'Demo'
}
Run Code Online (Sandbox Code Playgroud)

当使用templateUrl和styleUrls的相对路径时,我得到:错误404,找不到文件:

zone.js:101 GET http://localhost/app.component.html 404(未找到)

代码:https://github.com/Dreampie/angular2-demo

我认为这不是好设计,因为在不同的情况下可能会建立目录不一样,我可以将它改为相对当前路径吗?

raw-loader可以解决这个问题,但是html-loader,less-loader不是为了工作template,styles,它只是在工作string,为什么不能支持他们呢?

import {Component} from 'angular2/core';

@Component({
  selector: 'app',
  styles: [require('./app.component.less')],
  template: require('./app.component.html')
})
export class AppComponent {
  name:string = 'Demo'
}
Run Code Online (Sandbox Code Playgroud)

得到其他错误:

browser_adapter.js:77 EXCEPTION: Error during instantiation of Token Promise<ComponentRef>!.BrowserDomAdapter.logError
browser_adapter.js:77 ORIGINAL EXCEPTION: Expected 'styles' to be an array …
Run Code Online (Sandbox Code Playgroud)

node.js webpack webpack-dev-server angular2-template angular

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

如何在spring数据jpa中使用redis提供二级缓存?

如何在spring数据jpa中使用redis提供二级缓存?

不仅hibernate,我希望所有jpa提供者都可以使用这个缓存.

有人可以帮忙吗?

spring spring-data spring-data-jpa

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

spring web ResponseEntity无法序列化

如果使用 @Cacheable 作为返回值“ResponseEntity”,我收到序列化错误。

\n\n
Caused by: org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [org.springframework.http.ResponseEntity]\n
Run Code Online (Sandbox Code Playgroud)\n\n

演示\xef\xbc\x9a

\n\n
@Controller\n@CacheConfig(cacheNames = "logs")\npublic class LogController {\n  @Cacheable(key = "#id")\n  @RequestMapping(value = LogConstants.LOGS_ID_PATH, method = RequestMethod.GET)\n  public ResponseEntity<Log> findById(@PathVariable Long id) {\n   //....\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

spring spring-mvc spring-data spring-data-redis

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

如何自定义@FeignClient Expander以转换参数?

假装默认扩展器转换参数?

final class ToStringExpander implements Expander {

    @Override
    public String expand(Object value) {
      return value.toString();
    }
  }
Run Code Online (Sandbox Code Playgroud)

我想自定义它来转换用户以支持GET参数,像这样

@FeignClient("xx")
interface UserService{

   @RequestMapping(value="/users",method=GET)
   public List<User> findBy(@ModelAttribute User user);
}

userService.findBy(user);
Run Code Online (Sandbox Code Playgroud)

我能做什么?

spring spring-cloud netflix-feign

2
推荐指数
3
解决办法
4563
查看次数

redis.clients.jedis.exceptions.JedisDataException: 请在调用此方法之前关闭管道或多块

我想要页面 zrange,得到错误:请在调用此方法之前关闭管道或多块。,如何解决这个问题(我的集群不支持多命令https://github.com/CodisLabs/codis/blob/master/doc/unsupported_cmds .md)?

runWithPipeline(new JedisPipelinedCallback() {
  @Override
  public void execute(Pipeline pipeline) {
    int offset = 0;
    boolean finished = false;

    do {
      // need to paginate the keys
      Set<byte[]> rawKeys = pipeline.zrange(rawKnownKeysKey, (offset) * PAGE_SIZE, (offset + 1) * PAGE_SIZE - 1).get();
      finished = rawKeys.size() < PAGE_SIZE;
      offset++;
      if (!rawKeys.isEmpty()) {
        List<byte[]> regionedKeys = new ArrayList<byte[]>();
        for (byte[] rawKey : rawKeys) {
          regionedKeys.add(getRegionedKey(rawRegion, rawKey));
        }

        pipeline.del(regionedKeys.toArray(new byte[regionedKeys.size()][]));
      }
      pipeline.sync();
    } while (!finished);

    pipeline.del(rawKnownKeysKey);
  }
});
Run Code Online (Sandbox Code Playgroud)

// 创建 {@link …

pipeline redis jedis

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

jpa namedQuery针对不同的数据类型错误?

我怎样才能使用jpa findBy和两个不同数据类型的参数?一些代码如:

@Entity
@Data
@Cacheable
@Table(name = "user")
public class UserEntity {
  @Id
  @GeneratedValue
  private int id;

  @Column
  private String username;

}


public interface UserRepository extends JpaRepository<UserEntity, Integer> {

  UserEntity findByIdOrUsername(String idOrUsername);
}
Run Code Online (Sandbox Code Playgroud)

当启动应用程序时,出现了一些错误:init方法的调用失败; 嵌套异常是java.util.NoSuchElementException

2016-01-15 17:00:47.294 ERROR 36266 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private tv.acfun.cloud.service.user.repository.UserRepository tv.acfun.cloud.service.user.controller.UserController.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': …
Run Code Online (Sandbox Code Playgroud)

spring spring-data spring-data-jpa

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