Remove @Autowired from constructors where class has single constructor

Closes gh-5226
This commit is contained in:
Andy Wilkinson
2016-03-01 16:03:07 +00:00
parent 3ca67e669d
commit 355860fd09
25 changed files with 35 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package sample.data.jpa.service;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.HotelSummary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
@@ -35,7 +34,6 @@ class CityServiceImpl implements CityService {
private final HotelRepository hotelRepository;
@Autowired
public CityServiceImpl(CityRepository cityRepository,
HotelRepository hotelRepository) {
this.cityRepository = cityRepository;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ import sample.data.jpa.domain.RatingCount;
import sample.data.jpa.domain.Review;
import sample.data.jpa.domain.ReviewDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
@@ -42,7 +41,6 @@ class HotelServiceImpl implements HotelService {
private final ReviewRepository reviewRepository;
@Autowired
public HotelServiceImpl(HotelRepository hotelRepository,
ReviewRepository reviewRepository) {
this.hotelRepository = hotelRepository;
@@ -71,7 +69,7 @@ class HotelServiceImpl implements HotelService {
@Override
public Review addReview(Hotel hotel, ReviewDetails details) {
Review review = new Review(hotel, 1, details);
return reviewRepository.save(review);
return this.reviewRepository.save(review);
}
@Override