在类路径上检测到两个Spring WebApplicationInitializers

时间:2018-07-26 10:37:04

标签: java maven spring-boot

将maven spring-boot项目转换为多模块项目后,我开始在tomcat服务器上启动服务器时出错;

  @Component({
    selector: 'podcast-search',
    changeDetection: ChangeDetectionStrategy.OnPush, // turn this off if you want everything handled by NGRX. No watches. NgModel wont work
    template: `
      <h1>Podcasts Search</h1>
      <div>
        <input name="searchValue" type="text" [(ngModel)]="searchValue" ><button type="submit" (click)="doSearch()">Search</button>
      </div>
      <hr>
      <div *ngIf="showChannels">

        <h2>Found the following channels</h2>
        <div *ngFor="let channel of channels$ | async" (click)="loadChannel( channel )">{{channel.trackName}}</div>
      </div>
    `,
  })

  export class PodcastSearchComponent implements OnInit, OnDestroy  {
    channels$: Observable<Channel[]>;
    searchValue: string;
    showChannels = false;

    constructor(
      private store: Store<fromStore.PodcastsState>,

    ) {}

    ngOnInit() {

      this.channels$ = this.store.select(fromStore.getAllChannels).pipe(
        filter(channels => !!channels.length),
        // channels.length should always be truthy at this point
        tap(channels => {
          console.log('channels', !!channels.length, channels);
          this.showChannels = !!channels.length;
         }),
      );
    // this.store.select( fromStore.getAllChannels ).subscribe( channels =>{
    //   console.log('channels', !!channels.length, channels);
    //   this.channels$ =  of ( channels );
    //   this.showChannels = !!channels.length;
    //   this.ref.markForCheck();
    // } );

    }

  doSearch() {
    console.log( 'search', this.searchValue );
    this.store.dispatch( new fromStore.LoadChannels( this.searchValue ) );
  }

尽管我通过IntelliJ在本地运行它也可以正常工作。

有什么想法吗?也许Spring-boot启动程序依赖项应该在打包为war的子模块中,而不在父模块中?

注意:关于此的另一个问题并没有帮助

0 个答案:

没有答案