File tree Expand file tree Collapse file tree 6 files changed +14
-3
lines changed
java/ru/mystamps/web/controller Expand file tree Collapse file tree 6 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -144,26 +144,27 @@ public class UserService {
144
144
145
145
<rule
146
146
name=" FieldInjectionInControllers"
147
- message=" Use constructor injection instead of field injection in controllers "
147
+ message=" Use constructor injection instead of field injection in @Controller-s "
148
148
class=" net.sourceforge.pmd.lang.rule.XPathRule"
149
149
language=" java" >
150
150
151
151
<description >
152
- Prefer constructor injection over field injection in controller classes.
152
+ Prefer constructor injection over field injection in @Controller classes.
153
153
</description >
154
154
155
155
<properties >
156
156
<property name =" xpath" >
157
157
<value >
158
158
<![CDATA[
159
- //ClassOrInterfaceDeclaration[ends-with( @Image, "Controller") ]//FieldDeclaration[../Annotation/*/Name[@Image="Autowired" or @Image="Inject"]]
159
+ //TypeDeclaration[Annotation/*/Name[ @Image= "Controller"] ]//FieldDeclaration[../Annotation/*/Name[@Image="Autowired" or @Image="Inject"]]
160
160
]]>
161
161
</value >
162
162
</property >
163
163
</properties >
164
164
<priority >4</priority >
165
165
<example >
166
166
<![CDATA[
167
+ @Controller
167
168
public class UserController {
168
169
@Inject
169
170
private UserDao userDao;
Original file line number Diff line number Diff line change 21
21
import javax .validation .Valid ;
22
22
23
23
import org .springframework .beans .propertyeditors .StringTrimmerEditor ;
24
+ import org .springframework .stereotype .Controller ;
24
25
import org .springframework .ui .Model ;
25
26
import org .springframework .web .bind .annotation .InitBinder ;
26
27
import org .springframework .web .bind .annotation .PathVariable ;
42
43
import ru .mystamps .web .model .RegisterAccountForm ;
43
44
import ru .mystamps .web .service .UserService ;
44
45
46
+ @ Controller
45
47
public class AccountController {
46
48
47
49
private final UserService userService ;
Original file line number Diff line number Diff line change 21
21
import javax .validation .Valid ;
22
22
23
23
import org .springframework .beans .propertyeditors .StringTrimmerEditor ;
24
+ import org .springframework .stereotype .Controller ;
24
25
import org .springframework .ui .Model ;
25
26
import org .springframework .web .bind .annotation .InitBinder ;
26
27
import org .springframework .web .bind .annotation .PathVariable ;
36
37
import ru .mystamps .web .model .AddCountryForm ;
37
38
import ru .mystamps .web .service .CountryService ;
38
39
40
+ @ Controller
39
41
public class CountryController {
40
42
41
43
private final CountryService countryService ;
Original file line number Diff line number Diff line change 21
21
22
22
import javax .servlet .http .HttpServletResponse ;
23
23
24
+ import org .springframework .stereotype .Controller ;
24
25
import org .springframework .web .bind .annotation .PathVariable ;
25
26
import org .springframework .web .bind .annotation .RequestMapping ;
26
27
import org .springframework .web .bind .annotation .RequestMethod ;
27
28
28
29
import ru .mystamps .web .entity .Image ;
29
30
import ru .mystamps .web .Url ;
30
31
32
+ @ Controller
31
33
public class ImageController {
32
34
33
35
@ RequestMapping (value = Url .GET_IMAGE_PAGE , method = RequestMethod .GET )
Original file line number Diff line number Diff line change 23
23
import org .slf4j .Logger ;
24
24
import org .slf4j .LoggerFactory ;
25
25
26
+ import org .springframework .stereotype .Controller ;
26
27
import org .springframework .web .bind .annotation .RequestHeader ;
27
28
import org .springframework .web .bind .annotation .RequestMapping ;
28
29
import org .springframework .web .bind .annotation .RequestMethod ;
32
33
import ru .mystamps .web .service .SiteService ;
33
34
import ru .mystamps .web .support .spring .security .CustomUserDetails ;
34
35
36
+ @ Controller
35
37
@ RequestMapping (Url .NOT_FOUND_PAGE )
36
38
public class NotFoundErrorController {
37
39
private static final Logger LOG = LoggerFactory .getLogger (NotFoundErrorController .class );
Original file line number Diff line number Diff line change 26
26
import java .util .Map ;
27
27
28
28
import org .springframework .beans .propertyeditors .StringTrimmerEditor ;
29
+ import org .springframework .stereotype .Controller ;
29
30
import org .springframework .ui .Model ;
30
31
import org .springframework .validation .annotation .Validated ;
31
32
import org .springframework .validation .BindingResult ;
47
48
import ru .mystamps .web .service .SeriesService ;
48
49
import ru .mystamps .web .util .CatalogUtils ;
49
50
51
+ @ Controller
50
52
public class SeriesController {
51
53
52
54
private static final Integer SINCE_YEAR = 1840 ;
You can’t perform that action at this time.
0 commit comments