Open mlotysz opened 7 years ago
@mlotysz
I need some help with private static PriceCatDao priceCatDao = new PriceCatDao();
. Can i make a object of this class in MovieDao.java
or should i use @Autowired
? When i do that - it's making an error about bean.
https://spring.io/blog/2016/03/04/core-container-refinements-in-spring-framework-4-3 (Short version: use constructor injection, remove static
, add final
, optionally remove Autowired
)
It doesn't work for me. Pics:
@mlotysz
I will leave it now. Because i need more explain. I can't use it to static movies
variable so i change it on final
. It's still doesn't work so i will abandon this issue to make other be success. I'm waiting for your suggestions. `(add @you to highlight this issue)
Sure. The way you initialize movies
map is wrong. You could use InitializingBean
or @PostConstruct
instead: http://stackoverflow.com/a/30726748 (or rewrite it to plain Java code, use static blocks...)
Use lowercase for package names: https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html
Remove sparkling
println
Split big methods and name it accordingly: -- https://github.com/rafek1241/Patronage-17-java/blob/Workflow/patronage-2-work/src/main/java/pl/patronage/rszac/Dao/UserDao.java#L40 -- https://github.com/rafek1241/Patronage-17-java/blob/Workflow/patronage-2-work/src/test/java/pl/patronage/rszac/Dao/UserDaoTest.java#L112
Add missing braces to
if
statements, use code formatterUse java 8
foreach
instead ofIterator
andwhile
@Autowired MovieDao movDao = new MovieDao();
is nonsense, use@Autowired MovieDao movDao;
(BTW why is not calledmovieDao
?)