sw3bst3r
sw3bst3r

Reputation: 11

Does using the @Autowired anno and never calling a set method on your bean provide thread safety even if you are using class level variables inside?

So I am autowiring a service bean that I pass a map and it injects objects into it and returns it to my controller. Nowhere in my controller am I ever changing my bean, I send it info, and it returns me something. However, inside the bean, I am using class level variables in order to manage information as it moves around the class. Does this compromise thread safety?

Upvotes: 0

Views: 66

Answers (1)

sw3bst3r
sw3bst3r

Reputation: 11

I've removed class level variables, and begun passing the objects I need from method to method. Thank you for all of the input!

Upvotes: 0

Related Questions