Full Idea
The foundation of virtue is the endeavour to preserve one's own being, and happiness consists in man's power of preserving his own being.
Gist of Idea
Both virtue and happiness are based on the preservation of one's own being
Source
Baruch de Spinoza (The Ethics [1675], IV Pr 18)
Book Reference
Spinoza,Benedict de: 'Ethics, Improvement of Understanding, Letters', ed/tr. Elwes,R [Dover 1955], p.201
A Reaction
Spinoza never actually says so, but this seems to me to point to a Hobbesian social contract account of virtue - that is, that virtue is not an ideal, but a strategy. Personally I prefer the Aristotelian view, that it is an ideal revealed to us by nature.